12 July 2010

Extend/Grow a ext4 LVM volume

To extend a LVM volume that holds a ext4 filesystem can be tricky, as many tools only can process ext2 and ext3. But with the correct tools, this is straightforward. 

Ensure e4fsprogs is installed. 

Unmount the volume to be expaneded: 
umount /websvc

Extend the volume:
lvextend -L+10G /dev/mapper/VolGroup01-LogVol01

The option +10G extends the volume 10 GB. Another method would be to give a TOTAL desired size:
lvextend -L30G /dev/mapper/VolGroup01-LogVol01

 Run a file system check:
e4fsck -f /dev/mapper/VolGroup01-LogVol01

Then extend the filesystem:
resize4fs /dev/mapper/VolGroup01-LogVol01

That is it. 

1 comment:

Xander said...

Exactly what I needed to know. Thanks! (P.S. On Ubuntu, you can use e2fsprogs, which supports ext4 file systems).