← All posts
January 15, 20242 min read

LVM Partition Management

Extending an LVM partition without downtime: the fdisk/lvs/lvextend/resize2fs sequence, and when to reach for LVM over BTRFS.

#linux#disk#lvm

A basic operation that comes up often: extending the size of an LVM partition.

Check the current disk configuration with fdisk -l, lsblk, vgs, pvs. Changes should target the /dev/mapper entry — there's no need to touch /dev/sd* or /dev/nvme* directly.

lvextend --size 236G /dev/mapper/ubuntu--vg-ubuntu--lv

Then grow the filesystem to match:

resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv

Verify with:

df -h

Common add-ons worth knowing

Extend a logical volume to fill the whole volume group:

lvextend -l +100%FREE vgdata/lv1

The filesystem-grow step afterwards depends on the filesystem: ext4 → resize2fs /dev/vgdata/lv1, XFS → xfs_growfs /mountpoint (note it takes the mount point, and XFS volumes cannot be shrunk). Or do both in one step:

lvextend -r --resizefs /dev/vgdata/lv1

Snapshots of a thin volume:

lvcreate -s -n snap1 vgdata/thin1

Conclusion

LVM is a great tool if you want robust, if unglamorous, dynamic partition management. BTRFS is simpler to work with, but can cost more CPU than LVM+ext4 — which is why many people still prefer LVM for server systems.

References