Linux LVM Commands Reference

pvcreate, vgcreate, lvcreate and lvm management commands with common flags.

Searchable LVM command reference covering physical volume (pv), volume group (vg), logical volume (lv) and snapshot operations with the create, display, extend, resize and remove commands and their key flags.

What are the three LVM layers?

Physical Volumes (PVs) are raw disks or partitions initialised with pvcreate. Volume Groups (VGs) pool one or more PVs into a single storage space with vgcreate. Logical Volumes (LVs) are carved out of a VG with lvcreate and act like partitions you format and mount. The pv*, vg* and lv* command families map to these layers.

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 -r resizes the filesystem in one step — no separate resize2fs.
  • -l 100%FREE consumes all remaining extents; -L takes a fixed human size.
  • Use pvmove before vgreduce to 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.