What is LVM (Logical Volume Manager) and what problems does it solve?

Answer

LVM adds a layer of abstraction between physical disks and filesystems, enabling flexible volume management. The hierarchy: Physical Volumes (PV) — raw disks or partitions (pvcreate /dev/sdb). Volume Groups (VG) — a pool combining one or more PVs (vgcreate myvg /dev/sdb /dev/sdc). Logical Volumes (LV) — virtual partitions carved from a VG (lvcreate -L 50G -n data myvg), formatted and mounted like regular partitions. Key advantages: online resize (lvextend -L +20G /dev/myvg/data && resize2fs /dev/myvg/data — no unmounting needed), snapshots for consistent backups (lvcreate -L 10G -s -n snap /dev/myvg/data), and easy addition of new disks to an existing VG. LVM is essential for production servers where disk requirements change over time.