What is LVM?
LVM (Logical Volume Manager) is a device mapper framework for the Linux kernel that provides logical volume management, originally written by Heinz Mauelshagen in 1998 while at Sistina Software. It acts as a thin software layer on top of physical hard disks and partitions, creating an abstraction that allows dynamic storage resizing, snapshots, and flexible disk management without downtime.
LVM organizes storage into three layers: Physical Volumes (PVs), Volume Groups (VGs), and Logical Volumes (LVs). Logical volumes can be resized online by adding or removing physical extents (PEs), and most modern Linux distributions support having the root filesystem on a logical volume.
Common Use Cases
- Combine physical disks: Merge multiple hard drives into a single logical volume (similar to JBOD) to create large storage pools without hardware RAID.
- Resize filesystems online: Grow or shrink filesystem sizes without unmounting or rebooting the server, adapting to changing storage needs.
- Snapshots for backups: Create LVM copy-on-write snapshots for consistent backups of production volumes without service interruption.
- Migrate data without downtime: Use the
pvmovecommand to relocate data between physical drives while the logical volume stays online and accessible.