方案:將/home目錄壓縮一部分空間到/
1、備份/home目錄下文件
tar -czvf /root/home.tgz -C /home .
2、測試備份文件
tar -tvf /root/home.tgz
3、解除/home掛載
umount /dev/mapper/centos-home
有可能有target is busy錯誤,使用
umount -l /dev/mapper/centos-home
4、刪除邏輯分區
lvremove /dev/mapper/centos-home
有可能有Logical volume centos/home contains a filesystem in use,使用
lvremove -f /dev/mapper/centos-home
仍然不行,可能需要先註銷登錄,然後重新登錄,繼續運行
5、創建新的/home邏輯分區(這裏以400G爲例),並重新掛載
lvcreate -L 400GB -n home centos
mkfs.xfs /dev/centos/home
mount /dev/mapper/centos-home
6、把其餘的空間分配給/分區
lvextend -r -l +100%FREE /dev/mapper/centos-root
7、還原/home分區數據
tar -xzvf /root/home.tgz -C /home
8、最後重啓先電腦(可選)
reboot