Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.2.2. Logical Volume Manager (LVM)

💡 First Principle: LVM adds a virtualization layer between partitions and filesystems. Instead of formatting a partition directly, you combine one or more partitions (Physical Volumes) into a pool (Volume Group), then carve flexible logical units (Logical Volumes) from that pool. The key benefit: logical volumes can be resized, moved, and snapshotted without downtime.

Without LVM, resizing a partition requires unmounting, repartitioning, and hoping the adjacent space is free. With LVM, extending a logical volume is a two-command operation: lvextend to grow the LV, then resize2fs or xfs_growfs to grow the filesystem to fill it.

LVM Command Reference:
Physical Volumes (PV):
pvcreate /dev/sdb1             # Initialize a partition as a PV
pvdisplay                      # Detailed view of all PVs
pvs                            # Summary list of PVs
pvmove /dev/sdb1               # Migrate data off a PV (for disk removal)
pvremove /dev/sdb1             # Remove PV designation
pvresize /dev/sdb1             # Resize PV after extending underlying partition
pvscan                         # Scan for PVs (useful after adding a disk)
Volume Groups (VG):
vgcreate vg_data /dev/sdb1 /dev/sdc1   # Create VG from one or more PVs
vgextend vg_data /dev/sdd1             # Add a PV to an existing VG
vgdisplay vg_data                      # Detailed VG information
vgs                                    # Summary of all VGs
vgreduce vg_data /dev/sdb1            # Remove a PV from a VG (after pvmove)
vgremove vg_data                       # Delete a VG (LVs must be removed first)
vgexport vg_data                       # Prepare VG for move to another system
vgimport vg_data                       # Import a VG on a new system
vgchange -ay vg_data                   # Activate a VG
Logical Volumes (LV):
lvcreate -L 20G -n lv_home vg_data    # Create a 20 GB LV
lvcreate -l 100%FREE -n lv_data vg_data  # Use all free space
lvdisplay /dev/vg_data/lv_home         # Detailed LV information
lvs                                    # Summary of all LVs
lvextend -L +10G /dev/vg_data/lv_home  # Extend LV by 10 GB
lvextend -l +100%FREE /dev/vg_data/lv_home  # Extend to use all free VG space
lvresize -L 50G /dev/vg_data/lv_home   # Set absolute size
lvremove /dev/vg_data/lv_home          # Delete LV (data destroyed)
lvchange -ay /dev/vg_data/lv_home      # Activate an LV
Extending a Filesystem After lvextend:
# For ext4:
lvextend -L +10G /dev/vg_data/lv_home
resize2fs /dev/vg_data/lv_home        # Grow filesystem to fill new LV size

# For xfs (online):
lvextend -L +10G /dev/vg_data/lv_home
xfs_growfs /home                       # Use mount point, not device path

# One-step (-r resizes the filesystem too — works for ext4 AND XFS):
lvextend -r -L +10G /dev/vg_data/lv_home  # -r runs resize2fs or xfs_growfs automatically (via fsadm)

⚠️ Exam Trap: lvextend grows the logical volume but does NOT grow the filesystem inside it. You must run resize2fs (ext4) or xfs_growfs (xfs) as a second step. Skipping this step leaves the filesystem the same size even though the LV is larger. The -r flag on lvextend automates this for ext4.

Reflection Question: A team member extended an LV with lvextend -L +50G /dev/vg_prod/lv_db but the application still reports the same disk space as before. What did they forget, and what command resolves it?

Alvin Varughese
Written byAlvin Varughese
Founder18 professional certifications