Shrink /home partition - CentOS 7 +XFS +VirtFS

Operating System & Version
CentOS7
cPanel & WHM Version
Latest

_groupone

Registered
Nov 8, 2022
2
0
1
California
cPanel Access Level
Root Administrator
We need to reallocate space from /home to root / due to a space issue. You cannot shrink XFS partitions. While I have no problem backing up /home, deleting the partition reallocating the space and recreating /home, and restoring the data, there is this lovely caveat called VirtFS in Cpanel, which is running in /home. I'm unsure how to deal with VirtFS in this regard safely. Please help!
 

_groupone

Registered
Nov 8, 2022
2
0
1
California
cPanel Access Level
Root Administrator
Hey there! For your specific plan, you can ignore the VirtFS area, as that will be recreated as necessary. It's just important that you don't delete data from within VirtFS on a live server.
Does this sound like a solid plan to you? (referencing some of this from a serverfault.com article)

Step1.
- backup the contents of /home (tarball and ftp off contents)

Step2.
- umount /dev/mapper/centos-home

Step3.
- lvremove /dev/mapper/centos-home

Step4.
- lvcreate -L 200GB -n home centos
- mkfs.xfs /dev/centos/home
- mount /dev/mapper/centos-home

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

Step6.
- ftp tarball back, extract to /home