文章目录
默认是xfs文件系统
如果是xfs,收缩会损坏文件系统,导致文件丢失,要先备份。
mount 会报错 can’t read superblock xfs
这时只能格式化了 mkfs.xfs -f /dev/mapper/centos-home
1、提前备份重要数据,xfs减小会导致数据丢失
备份可以用xfsdump,数据不大也可以备份到机器之外(此处略)
2、卸载卷/dev/mapper/cl-home
umount /home
3、减少卷/dev/mapper/cl-home大小(该步骤会导致数据丢失,请看第1点)
[root@localhost ~]# lvreduce -L 10G /dev/mapper/cl-home WARNING: Reducing active logical volume to 10.00 GiB. THIS MAY DESTROY YOUR DATA (filesystem etc.) Do you really want to reduce cl/home? [y/n]:y Size of logical volume cl/home changed from 178.25 GiB (45633 extents) to 10.00 GiB (2560 extents). Logical volume cl/home successfully resized.
4、增加卷/dev/mapper/cl-root大小
[root@localhost ~]# lvextend -l +100%FREE /dev/mapper/cl-root Size of logical volume cl/root changed from 50.00 GiB (12800 extents) to 218.26 GiB (55874 extents). Logical volume cl/root successfully resized.
5、调整xfs文件系统大小
[root@localhost ~]# xfs_growfs /dev/mapper/cl-root
6、重新挂载、恢复数据
如果直接挂载会报错:
[root@localhost ~]# mount /dev/mapper/cl-home /home/ mount: /dev/mapper/cl-home: can't read superblock
[root@localhost ~]# mkfs.xfs -f /dev/mapper/cl-home
格式化后挂载:
mount /dev/mapper/cl-home /home/
挂载后恢复数据
此步骤可以用xfsrestore,或者手动拷贝(参照第1点)
7、查看结果
[root@localhost ~]# df -h
注意: # xfs_repair /dev/mapper/centos-home -L # 说明:-L是修复xfs文件系统的最后手段,慎重选择,它会清空日志,会丢失用户数据和文件。
参考
centos7下xfs格式的LVM卷空间伸缩实战
http://www.viper.im/archives/centos7-xfs-lvm-resize.html
CentOS 7扩展根分区
https://segmentfault.com/a/1190000007645451
如果某个fstab 中的文件系统故障,mount不上,启动会报错,进入维护模式
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
可以 查看报错内容 journalctl -x | grep mount
手动mount 看报啥错
然后修复
或者改fstab注释掉错误的文件系统
还有一种可能是新增了硬盘或者u盘,导致硬盘序号发生变化
可以把磁盘名称更改为UUID。
<span class="hljs-comment"># blkid </span>
/dev/sdc1: UUID=<span class="hljs-string">"ab4c28b5-1708-483c-973a-40f91d320a9d"</span> TYPE=<span class="hljs-string">"ext4"</span>
..
<span class="hljs-comment"># cat /etc/fstab </span>
#
# /etc/fstab
# Created by anaconda on Tue Aug 8 13:10:48 2017
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl-root / xfs defaults 0 0
UUID=a51fd6f8-a756-4e8f-ba44-5589fb99861e /boot xfs defaults 0 0
UUID=7D74-6C54 /boot/efi vfat umask=0077,shortname=winnt 0 0
/dev/mapper/cl-swap swap swap defaults 0 0
UUID=ab4c28b5-1708-483c-973a-40f91d320a9d /data ext4 defaults 0 0
参考
系统启动报错:Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
https://www.jianshu.com/p/ea57fb7834f2
CentOS 7磁盘寻找不到,卡在sulogin,造成的开机失败问题–Error getting authority…
https://www.cnblogs.com/redheat/p/7477380.html