I made a mistake in setting up one of our XenServer-based Linux VMs. I created a separate swap (good) and a large separate /home directory (bad) when really it should have been a large separate /var directory instead.
Now that /var has almost saturated the root disk, I would like to reintegrate /home back into the root partition, delete the old 921GB /home partition, then grow the root partition to 921GB leaving the /swap partition untouched.
Currently:
[root@ /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 50G 43G 4.0G 92% /
tmpfs 3.9G 0 3.9G 0%
/dev/shm /dev/xvda1 485M 72M 388M 16% /boot
/dev/mapper/VolGroup-lv_home 921G 200M 874G 1% /home
So more clearly, I need to know how to move /home and it's contents to the root partition (/dev/mapper/VolGroup-lv_root) and have Linux recognize it as the OS's home directory, delete the /dev/mapper/VolGroup-lv_home partition, and then grow the /dev/mapper/VolGroup-lv_root partition to take up the additional 921GB available.
I'm open to swapping /home and /var's locations if possible, but this is a production server. I can make instant snapshots at will though, so some late night experimentation is possible! 😉
Thanks!
Best Answer
It's fairly straightforward, as root: