What LVM does
The Linux Logical Volume Manager adds a flexible layer between physical disks
and filesystems. Raw disks become Physical Volumes, PVs are pooled into a
Volume Group, and Logical Volumes are carved from that pool — resizable,
movable and snapshottable without repartitioning. The command set mirrors these
layers: pv* for physical volumes, vg* for groups, lv* for logical volumes.
This reference lists the commands you actually use, with their key flags.
How it works
Provisioning flows top-down through the three layers, then you format and mount the resulting LV like any block device:
pvcreate /dev/sdb /dev/sdc # initialise disks as PVs
vgcreate datavg /dev/sdb /dev/sdc # pool them into a VG
lvcreate -L 50G -n web datavg # carve a 50G LV named "web"
mkfs.ext4 /dev/datavg/web # format it
mount /dev/datavg/web /srv/web # mount it
Growing later is two steps: lvextend -L +20G /dev/datavg/web then a filesystem
resize, or lvextend -r to do both. Snapshots (lvcreate -s) give you a
copy-on-write point-in-time view for backups.
Tips and notes
lvextend -rresizes the filesystem in one step — no separateresize2fs.-l 100%FREEconsumes all remaining extents;-Ltakes a fixed human size.- Use
pvmovebeforevgreduceto drain a disk you want to remove from a group. - Thin pools (
lvcreate --type thin-pool) allow over-provisioning — monitor pool usage closely to avoid running out of backing space.