[backcolor=rgba(255, 255, 255, 0.9)] 2.查看分区
[backcolor=rgba(255, 255, 255, 0.9)]df -h (centos-home和centos-root每人的名字可能不一样)
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 3.备份home分区文件
[backcolor=rgba(255, 255, 255, 0.9)] tar cvf /tmp/home.tar /home
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 4.卸载/home,如果无法卸载,先终止使用/home文件系统的进程
[backcolor=rgba(255, 255, 255, 0.9)]umount /home (卸载)
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 卸载时,发现/home在使用中,所以先终止。
[backcolor=rgba(255, 255, 255, 0.9)]fuser -km /home/(终止)
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 再次卸载,没有报错,表示成功
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 5.删除/home所在的lv
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)]lvremove /dev/mapper/centos-home
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 6.扩展/root所在的lv
[backcolor=rgba(255, 255, 255, 0.9)]lvextend -L +100G /dev/mapper/centos-root
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 7.扩展/root文件系统
[backcolor=rgba(255, 255, 255, 0.9)]xfs_growfs /dev/mapper/centos-root
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 8.重新创建home lv (创建时计算好剩余的磁盘容量,建议比剩余小1G左右)
[backcolor=rgba(255, 255, 255, 0.9)]lvcreate -L 41G -n /dev/mapper/centos-home
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 9.创建文件系统
[backcolor=rgba(255, 255, 255, 0.9)]mkfs.xfs /dev/mapper/centos-home
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 10.挂载home
[backcolor=rgba(255, 255, 255, 0.9)]mount /dev/mapper/centos-home
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)] 11.home文件恢复
[backcolor=rgba(255, 255, 255, 0.9)]tar xvf /tmp/home.tar -C /home/
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)]12.再次使用df -h查看系统磁盘大小
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)]
[backcolor=rgba(255, 255, 255, 0.9)]以下是调整centos7 把home空间大小划分给root分区视频
[backcolor=rgba(255, 255, 255, 0.9)]