geoffwilliams@home:~$

Growing EXT4 LVM filesystem to use all free space

Growing filesystems is thankfully quite easy and can be done online. Most of the time I just want to use all available free space in a PV, to reclaim space freed by deleting another LV. There are just 3 steps:

  1. Take a backup
  2. Extend the LV to use all free space:
# reize LV `root` to use all remaining free space in `vg`
# pay attention to warnings about data loss! Your growing the filesystem so there shouldnt be any warnings.
# Make sure to do `+100%FREE` not `100%FREE` - they are very different
lvextend -l +100%FREE /dev/vg/root
  1. Grow the EXT4 filesystem in LV root to use the whole LV:
resize2fs /dev/vg/root

Done!

Post comment