Linux LVM
Add flexible layers to storage
Imagine a computer with two disks: a large photo folder is on one, and the other has unused space. A shared pool could give the photo storage more room without moving every file to a new, fixed section of a disk, called a partition. The pool can be enlarged or divided as needs change, but the storage device and the way files are organized on it still need separate checks.
This approach is managed with Logical Volume Manager (LVM). It pools selected storage and divides it into virtual block devices called logical volumes. A physical volume (PV) is a disk or partition initialized for LVM. A volume group (VG) pools capacity from one or more PVs. A logical volume (LV) takes an allocation from that pool and appears to the operating system as a block device, often at /dev/<vg>/<lv>. A filesystem, the structure that stores and organizes files, is then created on the LV and mounted at a directory so files can use it.
The path looks like this: disk or partition → PV → VG → LV → filesystem → mount point. LVM maps logical extents in an LV to physical extents in the VG. Extent size is chosen when the VG is created and sets the granularity of allocation. If a VG has free extents, an LV can often grow without repartitioning the underlying device. The filesystem may still need its own resize step, and the safe order depends on the filesystem.
Shrinking needs extra care. If the LV becomes smaller before its filesystem, filesystem data can be cut off. Check the filesystem type, its supported shrink procedure, available space, and backups before changing either layer. LVM's flexibility does not make resizing risk-free, and not every filesystem can shrink while mounted.
Use these reports to see how the layers fit together:
pvs
vgs
lvs
lsblk
pvs reports physical volumes, vgs summarizes volume groups and free space, and lvs lists logical volumes. lsblk displays block devices as a tree, helping relate LVM devices to disks and partitions. The reports answer different questions. Free space in a VG is capacity available for allocation; it does not show whether a filesystem is mounted or healthy.
An LV may contain a filesystem used for one purpose, while the storage beneath it comes from several PVs. When a filesystem needs more room, check the VG's free extents, then plan the LV and filesystem changes together. Verify the resulting size at both layers.
LVM snapshots preserve a point-in-time view while changed blocks are tracked; classic and thin snapshots store those changes differently. They are not independent backups. They rely on the same storage environment, and their useful lifetime depends on the snapshot type and available capacity. An LVM logical volume also does not provide redundancy just because it is logical. Keep a separate backup and recovery plan for data that must survive device or pool failure.




