remove home partition centos 7
Step 1 - Copy /home Contents
To backup the contents of /home, do the following:
mkdir /temp
cp -a /home /temp/
Once that is finished at your back at the prompt, you can proceed to step 2.
Step 2 - Unmount the /home directory
umount -fl /home
Step 3 - Note the size of the home LVM volume
We run the lvs command to display the attributes of the LVM volumes
lvs
Sample output:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home cl -wi-a----- 406.94g
root cl -wi-ao---- 50.00g
swap cl -wi-ao---- 7.81g
Step 4 - Remove the home LVM volume
lvremove /dev/cl/home
Step 5 - Resize the root LVM volume
Based on the output of lvs above, I can safely extend the root LVM by 406GiB.
lvextend -L+406G /dev/cl/root
Step 6 - Resize the root partition
xfs_growfs /dev/mapper/cl-root
Step 7 - Copy the /home contents back into the /home directory
cp -a /temp/home /
Step 8 - Remove the temporary location
rm -rf /temp
Step 9 - Remove the entry from /etc/fstab
Using your preferred text editor, ensure you open /etc/fstab and remove the line for /dev/mapper/cl-home.
Step 10 - Don't miss this!
Run the following command to sync systemd up with the changes.
dracut --regenerate-all --force