You will build a flexible LVM storage stack on a server and grow a live filesystem without unmounting it. By the end you will expand capacity with zero downtime, the way production systems add space.

Learning Objectives

  • Assemble physical volumes into a volume group.
  • Carve a logical volume and put a filesystem on it.
  • Extend the volume and filesystem online.
  • Time: ~3 hours · Difficulty: Advanced · Prereqs: a server with two spare disks.

Architecture Overview

Environment Setup

You will need: a Linux server with LVM2 and two empty disks (/dev/sdb, /dev/sdc).

Before you begin: verify the disks are empty with lsblk.

Step-by-Step Execution

01
Initialize physical volumes and a group

This labels the disks for LVM and pools them into one resizable group.

sudo pvcreate /dev/sdb /dev/sdc && sudo vgcreate data /dev/sdb /dev/sdc
[ROOT REQUIRED] Creates PVs and the 'data' volume group.
02
Create and format a logical volume

The LV behaves like a partition but can grow across both disks.

sudo lvcreate -L 10G -n srv data && sudo mkfs.ext4 /dev/data/srv
03
Mount it
sudo mkdir -p /srv/store && sudo mount /dev/data/srv /srv/store
04
Grow the volume online

Extend the LV, then grow the filesystem, all while it stays mounted and in use.

# lvextend -L +5G /dev/data/srv && resize2fs /dev/data/srv
Size of logical volume data/srv changed to 15.00 GiB The filesystem is now 3932160 (4k) blocks long.

Progress So Far

Testing & Validation

df -h /srv/store && sudo vgs && sudo lvs

You should see the larger size while the mount stayed active. If so, you grew storage with zero downtime.

Troubleshooting
  • Filesystem size unchanged: run resize2fs (ext4) or xfs_growfs (xfs) after lvextend.
  • VG out of space: add a disk with pvcreate + vgextend before lvextend.
  • Cannot create PV: the disk has an existing signature; wipe with wipefs after confirming it is empty.

Extension Ideas

Key Results

  • Grew a mounted filesystem from 10GB to 15GB with zero downtime.
  • Pooled two disks into one flexible volume group.
  • Decoupled filesystem size from physical disk limits.
  • Verified capacity changes with df, vgs, and lvs.