I built flexible storage with LVM, layering physical volumes into a volume group and carving logical volumes that resize online. Growing a mounted filesystem with lvextend plus an online resize delivered more space with zero downtime.

Objective & Context

LVM decouples filesystems from physical disks, enabling live growth and snapshots. This lab builds the PV/VG/LV stack, extends a volume online, and takes a snapshot for consistent backups, the storage flexibility behind the server and backup labs.

Environment & Prerequisites

  • Linux with LVM2 and spare block devices.
  • An ext4 or xfs filesystem on an LV.
  • Root access for storage operations.

Step-by-Step Execution

1. Build the LVM stack [ROOT REQUIRED]

pvcreate /dev/sdb /dev/sdc && vgcreate data /dev/sdb /dev/sdc && lvcreate -L 10G -n vol data

2. Grow the volume and filesystem online

lvextend -L +5G /dev/data/vol && resize2fs /dev/data/vol

3. Snapshot for a consistent backup

lvcreate -s -L 2G -n vol-snap /dev/data/vol
Logical volume data/vol successfully resized to 15.00 GiB
Logical volume "vol-snap" created.

Validation & Testing

Confirm df -h shows the larger size while the filesystem stayed mounted, and that the snapshot is usable for backup. Pass criteria: online growth with zero downtime and a consistent snapshot for point-in-time backup.

Advanced: Troubleshooting
  • Resize didn't apply: extend the LV first, then grow the filesystem (resize2fs/xfs_growfs).
  • Snapshot fills up: size snapshots for expected change rate or they invalidate.
  • VG out of space: add a PV with pvcreate and vgextend before lvextend.

Key Results

  • Grew a mounted filesystem online with zero downtime.
  • Pooled multiple disks into one flexible volume group.
  • Captured consistent snapshots for point-in-time backups.
  • Decoupled filesystem size from physical disk boundaries.