This morning I came in to find that my root partition on my workstation was full, eaten up by the development VM (virtual machine) that had grown to 145GB. SIGH! This has happened in the past and usually I delete old VMs, move VMs to my home directory on /home etc.

Today I decided it was time to fix the problem. The root partition is 193G and /home is 280G. The home dir has about 210G free and after removing the development VM from root, it now has 150GB free. If I merge the two partitions I’ll have 360GB of free space to use for VMs etc. I will lose the nice ability to reinstall linux and not format /home partition as now it will be part of root but it avoids the day to day minutiae of managing free space between the two partitions.

I’m fortunate that I can free up the space on root enough to copy the contents of /home over to it. Otherwise the process would involve freeing up space on /home and reusing it on /root, blah blah blah.

First let’s copy /home to a new directory on root, this will create a /home-new/home but that’s ok.

rsync -avzX /home /home-new

Next, let’s unmount and remove /home.

umount /home
lvremove /dev/vg0/home

That freed up 280G, so we can now grow the root partition to use up that space.

lvextend -l +100%FREE /dev/vg0/root

So far so good, now we need to grow the filesystem of the root partition to use the new space as well. I’m using XFS, make sure you use the proper filesystem tool to resize the one you are using.

xfs_growfs /

Let’s restore home.

mv /home-new/home/* /home/

Update /etc/fstab not to mount /home as a different partition. Then reboot just to make sure things are good.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s