缩容
目标分区/dev/centos/home,挂载点/home
xfs文件系统只能扩大,不能缩小,要通过别的手段实现缩容
首先备份目标分区
xfsdump -f /home.xfsdump /home
卸载目标分区
umount /home
调整目标分区的lv容量,这里缩成5G
[root@centos /]# lvreduce -L 5G /dev/centos/home
WARNING: Reducing active logical volume to 5.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce centos/home? [y/n]: y
Size of logical volume centos/home changed from <61.12 GiB (15646 extents) to 5.00 GiB (1280 extents).
Logical volume centos/home successfully resized.
重新格式化分区,加-f强制格式化
mkfs.xfs /dev/centos/home -f
挂载目标分区
mount /dev/centos/home /home
使用xfsrestore恢复文件
xfsrestore -f /home.xfsdump /home
扩容
目标分区/dev/cetnos/root,挂载点/
首先扩容分区的lv,可以参考红帽的 文档
[root@centos /]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 106.12 GiB (27167 extents).
Logical volume centos/root successfully resized.
You have mail in /var/spool/mail/root
然后扩容xfs
xfs_growfs /