Expanding a live ext4 filesystem on LVM
Enlarge your home


Posted on 2013-08-04
Tags: Linux LVM ext4

When installing my machine I used an encrypted LVM with ext4 as the filesystem for both /home and /. I allocated 50 GB for /home and 30 GB for / and left the rest unused, in order to be able to use it where needed, mostly to try out and see if it is a nice setup or not.

Today I was messing around with virtual machines and noticed I only had 15 GB free space on my home partition and needed more. So I did some searching in order to find out how to increase the size of /home and was surprised at how easy it was:

$ sudo lvextend -L+50G /dev/System/home
Extending logical volume home to 102 GiB
Logical volume home successfully resized
$ sudo resize2fs /dev/mapper/System-home
resize2fs 1.42.8 (20-Jun-2013)
Filesystem at /dev/mapper/home is mounted on /home; on-line resizing required
old desc_blocks = 180, new_desc_blocks = 261

This can even be done online, that is without unmounting the filesystem, if you have a kernel newer than 2.6.