What Is Logical Volume Management (LVM) in Linux?
Logical Volume Management (LVM) is a storage management framework for Linux that provides a flexible abstraction layer between physical storage hardware and the operating system's filesystems. Unlike traditional partition-based storage, LVM allows system administrators to aggregate multiple physical drives into unified storage pools, allocate dynamic partitions that can span across disks, resize storage volumes on the fly without downtime, and create point-in-time snapshots for backups. This article explains the fundamental architecture of LVM, details its core components, outlines its primary operational advantages, and demonstrates the basic workflow for managing storage using LVM.
The Architecture of LVM
Traditional disk management ties filesystems directly to fixed partition tables (such as MBR or GPT) on a single physical drive. LVM eliminates these physical constraints by organizing storage into three hierarchical layers:
- Physical Volumes (PV): These are the raw block
devices—such as an entire hard drive, an SSD, or a standard disk
partition (e.g.,
/dev/sdbor/dev/nvme0n1p1). Initializing a disk as a PV marks it for use within the LVM subsystem by adding an LVM header. - Volume Groups (VG): A Volume Group acts as a single, unified pool of storage created by combining one or more Physical Volumes. Inside the VG, disk space is divided into fixed-size chunks known as Physical Extents (PEs), typically 4MB by default. The total capacity of a VG is the sum of the capacities of its member PVs.
- Logical Volumes (LV): Logical Volumes are the functional equivalent of traditional disk partitions, carved out of the Volume Group. An LV consists of an allocation of Physical Extents from the VG. Filesystems (such as ext4 or XFS) are formatted directly onto Logical Volumes, which are then mounted into the Linux directory tree.
Key Advantages of LVM
- Dynamic Resizing: Logical Volumes can be expanded or shrunk while the system remains online, provided the underlying filesystem supports live resizing. If a Volume Group runs out of free space, administrators can add a new physical drive to the VG to expand available capacity instantly.
- Multi-Disk Spanning: A single Logical Volume can span across multiple physical drives seamlessly, eliminating the limitation of being constrained to the capacity of a single disk.
- Snapshots: LVM supports point-in-time copy-on-write (COW) snapshots. A snapshot records the state of an LV at a specific moment by only saving changes made after the snapshot was created, providing a fast and safe mechanism for backups and system upgrades.
- Data Striping and Mirroring: LVM can stripe data across multiple physical disks to increase read and write throughput, or mirror data across drives to provide redundancy against drive failure, functioning similarly to software RAID.
- Thin Provisioning: LVM enables overcommitting storage capacity by allocating actual disk space only when data is written, rather than reserving the full allocated volume size in advance.
Basic LVM Command Workflow
Managing storage through LVM follows a sequential path through its three architectural layers:
1. Initializing Physical Volumes
To prepare raw disks or partitions for LVM:
pvcreate /dev/sdb /dev/sdcTo verify the initialized devices:
pvs
# or for detailed output:
pvdisplay2. Creating a Volume Group
To combine the Physical Volumes into a unified pool named
vg_data:
vgcreate vg_data /dev/sdb /dev/sdcTo check the status and available space of the pool:
vgs
# or for detailed output:
vgdisplay3. Creating and Formatting a Logical Volume
To carve out a 50 GB Logical Volume named lv_storage
from the vg_data group:
lvcreate -L 50G -n lv_storage vg_dataThe volume is then accessible as a block device at
/dev/vg_data/lv_storage or
/dev/mapper/vg_data-lv_storage. It can be formatted and
mounted like any standard partition:
mkfs.ext4 /dev/vg_data/lv_storage
mount /dev/vg_data/lv_storage /mnt/data4. Extending a Logical Volume
If the filesystem requires more space, the volume and its filesystem can be extended on the fly:
# Extend the LV by 20GB and resize the underlying filesystem in a single command
lvextend -L +20G -r /dev/vg_data/lv_storageLVM simplifies enterprise and modern Linux storage by decoupling filesystems from rigid hardware geometry, making storage allocation adaptable to changing capacity requirements.