系统做好后有时候根分区大小不能满足我们的需求,需要重新调整大小。重新调整大小后,/home 下的东西将丢失,注意做好备份。
df -h #查看系统分区大小,这里/根分区大小为50G,/home为66,为了实验我们将/分区调整为60G


记下以下信息:
/dev/mapper/centos-root
/dev/mapper/centos-home
首先卸载/home分区:如无法卸载,则是有进程占用/home,终止占用进程:fuser -m /home
umount /home

删除/home所在的lv:

删除/home所在的lv:
lvremove /dev/mapper/centos-home


扩展/root所在的lv,扩展/root文件系统 :
lvextend -L +10G /dev/mapper/centos-root #这里我们增加10G,相应/home也应该减少10G
xfs_growfs /dev/mapper/centos-root
df -h


service network restart
vgdisplay #查询剩余空间


lvcreate -L 55G -n home centos #重新创建home lv,设置的大小不可比剩余空间多


mkfs.xfs /dev/centos/home #创建文件系统
mount /dev/centos/home /home #挂载 home
df -h #查看新分区大小

