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.
Previous
How do iptables and nftables handle packet filtering rules?
Next
How does /etc/fstab work and what are important mount options?
More Linux / Shell Scripting Questions
View all →- Advanced What are Linux namespaces and cgroups, and how do they underpin containers?
- Advanced How do iptables and nftables handle packet filtering rules?
- Advanced How does /etc/fstab work and what are important mount options?
- Advanced How do sysctl kernel parameters work and what are important tuning examples?
- Advanced How do you use perf and flame graphs for performance analysis on Linux?