How to reduce the /home partition and expand the /root partition on Centos7

Back up the content of /home, then delete the logical volume where the /home file system is located, expand the /root file system, and create a new /home:
tar cvf /tmp/home.tar /home #backup/home
umount /home #unmount /home, If it cannot be uninstalled, first terminate the process that uses the /home file system
lvremove /dev/centos/home #Delete the lv where /home is located
lvextend -L +50G /dev/centos/root #Extend the lv where /root is located, add 50G
xfs_growfs / dev/centos/root #Extend/root file system
lvcreate -L 56G -n home centos #Recreate home lv
mkfs.xfs /dev/centos/home #Create file system
mount /dev/centos/home /home #Mount
df -h

 Pro test feasible

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326834868&siteId=291194637