How to shrink home and add more space on centos7

XFS filesystem cannot be shrunk.

Do this via the console or enable root ssh login, do not use a sudo user.

• backup the contents of /home

> tar -czvf /root/home.tgz -C /home .

• test the backup

> tar -tvf /root/home.tgz

• unmount home

> umount /dev/mapper/centos-home

If you can't unmount because of a busy file system check lsof /home/
This will show some processes that are active on the home volume.

You can kill the processs with the PID number kill -9 PIDNUMBER. (-9 means force)

• remove the home logical volume

> lvremove /dev/mapper/centos-home

• recreate a new 25GB logical volume for /home, format and mount it

> lvcreate -L 25GB -n home centos
> mkfs.xfs /dev/centos/home
> mount /dev/mapper/centos-home

• extend your /root volume with ALL of the remaining space and resize (-r) the file system while doing so

> lvextend -r -l +100%FREE /dev/mapper/centos-root

• restore your backup

> tar -xzvf /root/home.tgz -C /home

• check /etc/fstab for any mapping of /home volume. IF it is using UUID you should update the UUID portion. (Since we created a new volume, UUID has changed)