LVM and growth

Extend a logical volume

Verify free extents, backups, device identity, and filesystem support before increasing usable capacity.

Growth normally moves outward in two steps: enlarge the logical volume, then enlarge the filesystem inside it.

The good news: for ext4 and XFS both steps work online, on a mounted filesystem, with the application running. Growing is the safe direction. You are adding blocks, not removing any.

Check before you grow

Inspect the current stack and free volume-group space first:

sudo vgs vg0
#  VG  #PV #LV #SN Attr   VSize    VFree
#  vg0   1   2   0 wz--n- <199.00g 49.00g

df -h /srv/data
#  Filesystem           Size  Used Avail Use% Mounted on
#  /dev/mapper/vg0-data  98G   88G  5.2G  95% /srv/data

VFree at 49 GB means the pool can cover a 20 GB extension. If VFree is near zero you first need to add a physical volume or grow the underlying disk. Confirm you are targeting the right volume, and confirm a recent backup exists. This is a low-risk operation, but it still rewrites volume metadata.

Extend both layers

Use explicit sizes. +20G says “grow by 20 GB”, which is harder to get wrong than an absolute target:

sudo lvextend -L +20G --resizefs vg0/data

--resizefs (short form -r) tells lvextend to also grow the filesystem, calling resize2fs for ext4 or xfs_growfs for XFS on your behalf. Some tools can resize the filesystem with the logical volume like this, but you should still verify both layers afterward:

sudo lvs vg0/data
#  LV   VG  Attr       LSize
#  data vg0 -wi-ao---- 120.00g

df -h /srv/data
#  Filesystem           Size  Used Avail Use% Mounted on
#  /dev/mapper/vg0-data 118G   88G   25G  79% /srv/data

Both numbers moved. That is the check that matters.

The classic failure

Someone runs lvextend without --resizefs, sees it succeed, and walks away. lvs shows the new size, but df does not move and the application keeps failing with a full disk. The volume grew. The filesystem was never told.

The fix is harmless: run the missing step (sudo resize2fs /dev/vg0/data for ext4). But recognize the signature: LV size and filesystem size disagree, and the difference is exactly the extension you just made.

Try this on a test volume: write a dry-run expansion plan that includes current sizes, target size, backup, commands, validation, and the point where rollback stops being simple.

Lesson completed