LVM Partition Management
Extending an LVM partition without downtime: the fdisk/lvs/lvextend/resize2fs sequence, and when to reach for LVM over BTRFS.
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--lvThen grow the filesystem to match:
resize2fs /dev/mapper/ubuntu--vg-ubuntu--lvVerify with:
df -hCommon add-ons worth knowing
Extend a logical volume to fill the whole volume group:
lvextend -l +100%FREE vgdata/lv1The 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/lv1Snapshots of a thin volume:
lvcreate -s -n snap1 vgdata/thin1Conclusion
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