3.2 Logical Volume Manager (LVM) Architecture & Volume Management

Key Takeaways

  • Initialize block devices as physical volumes (PVs). A volume group (VG) pools PV capacity, and logical volumes (LVs) expose block devices from that pool.

  • LVM commonly defaults to 4 MiB physical extents. A 400 MiB linear LV uses 100 extents at that extent size.

  • Use pvmove when the source is readable and another PV in the same VG has capacity. Verify evacuation before removing the old PV from the group.

  • On a supported setup, lvextend -r requests both LV and filesystem growth. Verify the two sizes separately.

  • Shrink an ext4 filesystem offline before reducing its LV boundary. For a smaller XFS volume on RHEL 9, create a new filesystem and restore data.

Last updated: November 2026

Logical Volume Manager (LVM) Architecture & Volume Management

Logical Volume Manager (LVM) separates the block devices that supply storage from the block devices applications use. This lets an administrator allocate free space and move data across devices within a volume group. The filesystem still has its own resizing and maintenance rules.

1. The LVM Three-Tier Architecture

LVM organizes physical storage devices into dynamic, flexible virtual pools through three sequential abstraction layers:

+-------------------------------------------------------------+
|                   Logical Volumes (LVs)                     |
|        /dev/vg_data/lv_app          /dev/vg_data/lv_db      |
|         (ext4 Filesystem)            (XFS Filesystem)       |
+-------------------------------------------------------------+
                               | (Allocated Extents)
+-------------------------------------------------------------+
|                     Volume Group (VG)                       |
|                         vg_data                             |
|               Pooled Storage (Physical Extents)             |
+-------------------------------------------------------------+
                               ^
            +------------------+------------------+
            |                                     |
+-----------------------+             +-----------------------+
| Physical Volume (PV)  |             | Physical Volume (PV)  |
|       /dev/sdb1       |             |       /dev/sdc1       |
+-----------------------+             +-----------------------+

1. Physical Volumes (PVs)

A Physical Volume is any raw block device—such as a whole disk (/dev/sdb), a partition (/dev/sdb1), or a hardware RAID logical drive—initialized for use by LVM. By default, initialization places an LVM label in the second 512-byte sector. It assigns a unique identifier and reserves space for metadata and data according to the creation settings.

2. Volume Groups (VGs)

A Volume Group is a centralized storage pool created by combining one or more Physical Volumes. A VG abstracts the boundaries of individual drives. For example, three 500 GB drives contribute about 1.5 TB of raw capacity before metadata and alignment overhead.

3. Logical Volumes (LVs)

A Logical Volume is carved out of a Volume Group's free space. To the Linux operating system, an LV functions identically to a standard physical block partition. It can be formatted with any filesystem (ext4, XFS) and mounted into the VFS hierarchy. LVs are exposed via device-mapper paths: /dev/<vg_name>/<lv_name> or corresponding device-mapper names under /dev/mapper/. Use the VG/LV path for scripts; mapper names escape hyphens.

Extents: Physical Extents (PE) & Logical Extents (LE)

The fundamental atomic building block of LVM allocation is the Physical Extent (PE). When a Volume Group is constructed, its total storage capacity is segmented into fixed-size chunks called Physical Extents.

  • The default PE size is 4 MiB, though it can be defined during VG creation (-s flag) in powers of two (e.g., 8 MiB, 16 MiB, 64 MiB).
  • A Logical Volume is composed of Logical Extents (LEs). In a standard linear volume, each LE maps directly to one physical extent on a disk. If an administrator creates an LV with a size of 400 MiB in a VG configured with 4 MiB PEs, LVM allocates exactly 100 physical extents to the volume.

2. LVM Administration Lifecycle: PVs, VGs, and LVs

Use disposable lab devices and confirm their identity and contents before initializing or removing any storage. The commands below assume two unallocated spare partitions of at least 50 GiB each.

Phase 1: Physical volumes

pvcreate /dev/sdb1 /dev/sdc1
pvs
pvdisplay /dev/sdb1

pvscan scans physical volumes. If an existing PV’s backing device expands, pvresize /dev/sdb1 lets that PV use the enlarged device after the kernel reports its new size. Inspect pvs afterwards.

Phase 2: Volume groups

vgcreate -s 8M vg_data /dev/sdb1 /dev/sdc1
vgs
vgdisplay vg_data

Use vgscan to discover volume groups, vgextend vg_data /dev/sdd1 to add an eligible PV, and vgreduce to remove an empty PV from a group. For a deliberate VG move, unmount its filesystems, deactivate it with vgchange -an vg_data, then use vgexport before moving all member PVs. Use vgimport on the receiving host, check the group and activate it with vgchange -ay vg_data. vgremove destroys a retired group; check its LVs and devices before removing it.

Worked example: To retire a readable PV, add a replacement with enough free extents to the same group and run pvmove /dev/sdb1 /dev/sdd1. LVs can remain in use during the move. Check the result and ensure pvs shows no allocations left on the source. Then vgreduce vg_data /dev/sdb1 removes it from the group. pvremove /dev/sdb1 removes the PV label if the device is ready to be repurposed. If the source cannot read its allocated extents, investigate redundancy or restore options before proceeding.

Phase 3: Logical volumes

lvcreate -n lv_app -L 40G vg_data
lvs
lvdisplay /dev/vg_data/lv_app
mkfs.xfs /dev/vg_data/lv_app
mount /dev/vg_data/lv_app /opt/app

The example assumes the mount point already exists. In LVM input, G denotes GiB. The -L option requests a size, and -l can request an extent count or percentage. For example, -l 50%FREE uses half of the currently free extents, whereas -l 50%VG uses half of total VG capacity and can fail if there are insufficient free extents. Treat them as alternative allocations and check remaining capacity first.

Use lvchange -an to deactivate a specified LV only after its consumers release it, and lvchange -ay to activate it again. lvresize can change LV size in either direction; identify whether the request grows or shrinks the device before applying it. lvremove destroys an LV’s contents and should be used only after verifying the exact target and retiring its data.

3. Dynamic Volume Expansion and Reduction in Production

Expanding an active storage volume involves two distinct layers:

  1. The LVM block container (the Logical Volume).
  2. The filesystem residing inside that container (ext4 or XFS).

The Unified Expansion Workflow: lvextend -r

Check the available VG capacity with vgs. On a supported setup, -r (or --resizefs) requests the LV and filesystem changes from one command. Either layer can fail, so verify the LV with lvs and the mounted filesystem with df -h before treating the change as complete:

# Add 20 GiB to lv_app and automatically expand its filesystem
lvextend -L +20G -r /dev/vg_data/lv_app

# On a separate existing LV, +100%FREE requests all remaining free extents
# lvextend -l +100%FREE -r /dev/vg_data/lv_data

If performing manual resizing, note the tool-specific requirements:

  • ext4 Manual Resize: lvextend -L +20G /dev/vg_data/lv_ext followed by resize2fs /dev/vg_data/lv_ext, assuming that separate LV holds ext4 and the kernel supports online growth.
  • XFS Manual Resize: lvextend -L +20G /dev/vg_data/lv_app followed by xfs_growfs /opt/app (XFS must be mounted; using the mount point works with the documented RHEL 9 procedure).

Volume Reduction (Shrinking): Rules and Dangers

RHEL 9 does not support shrinking XFS in place. Reducing the LV first would truncate the device behind the filesystem and risk data loss. If the XFS volume must be smaller, plan a backup and restore to a distinct smaller filesystem, or copy and verify the data in a controlled migration.

ext4 supports offline shrinking. For example, on a backup-protected lab system, suppose an ext4 filesystem sits inside a 50 GiB LV and its used space and minimum supported filesystem size permit a 29 GiB target. Shrink the unmounted filesystem to 29 GiB before reducing the LV to 30 GiB. The extra 1 GiB gives room for the two tools’ size and allocation boundaries; verify both results before extending the filesystem to fill the new LV if needed.

umount /mnt/extlab
e2fsck -f /dev/vg_data/lv_ext
# Continue only after resolving check failures and confirming capacity.
resize2fs /dev/vg_data/lv_ext 29G
# Continue only after verifying that the filesystem shrink succeeded.
lvreduce -L 30G /dev/vg_data/lv_ext
e2fsck -f /dev/vg_data/lv_ext
mount /dev/vg_data/lv_ext /mnt/extlab

Confirm the final filesystem and LV sizes with the relevant tools. Stop if a check or shrink fails. The device boundary must always contain the entire filesystem.

4. Advanced LVM Features: Thin Provisioning & Snapshots

LVM Thin Provisioning

Standard LVM volumes are "thick provisioned"—allocating physical extents immediately upon creation. A 100 GiB linear thick LV reserves the needed physical extents even if its filesystem contains only 2 GiB of files.

Thin Provisioning allocates storage blocks dynamically on demand only when data is written:

  1. An administrator creates a Thin Pool (a shared container holding raw physical blocks).
  2. Multiple Thin Logical Volumes are carved from the pool with virtual sizes that exceed physical capacity (overprovisioning):
# Create an 80 GiB Thin Pool inside vg_data
lvcreate --type thin-pool -L 80G -n thinpool vg_data

# Create two virtual 100 GiB thin volumes out of the 80 GiB physical pool
lvcreate -V 100G -T vg_data/thinpool -n lv_vm_disk1
lvcreate -V 100G -T vg_data/thinpool -n lv_vm_disk2

Overprovisioning risk: In the independent example above, two 100 GiB virtual volumes share a pool with 80 GiB of data capacity. Monitor both data and metadata usage with lvs -o lv_name,data_percent,metadata_percent. An exhausted pool can stall or fail writes depending on its settings. If you configure automatic extension, enable pool monitoring and keep enough free space in the VG. Review threshold and extension settings under /etc/lvm/lvm.conf.

LVM Snapshots & Rollback

A classic LVM snapshot starts with a reserved copy-on-write area. On changes to the origin, the snapshot retains the old blocks it needs. It presents a point-in-time view using preserved blocks and unchanged blocks on the origin. If a classic snapshot fills its reserved area, it can become invalid. A storage snapshot can be crash-consistent; coordinate application quiescence or backups when application consistency is required.

# Ensure the VG has room for a 10 GiB classic snapshot.
lvcreate --snapshot -n snap_app_prepatch -L 10G /dev/vg_data/lv_app

# If you choose to discard the origin’s later changes, stop its users.
umount /opt/app
# Ensure the snapshot is also closed.
lvconvert --merge /dev/vg_data/snap_app_prepatch
lvs

LVM may defer the merge to the next activation if the origin or snapshot is open. Verify that the merge has completed and the origin contains the expected state before returning the service to use. Store independent backups elsewhere; a snapshot depends on the underlying storage.

LVM Software RAID

LVM can create RAID logical volumes using its own commands and the kernel’s RAID and device-mapper facilities. Fault tolerance depends on the selected RAID level and device placement:

  • RAID0 (Striping): lvcreate --type raid0 -i 2 -L 50G -n lv_stripe vg_data (stripes data across two PVs without redundancy).

  • RAID1 (Mirroring): lvcreate --type raid1 -m 1 -L 50G -n lv_mirror vg_data (mirrors blocks across 2 PVs for redundancy).

  • RAID5 / RAID6 / RAID10: Native parity and striping configurations across multiple physical volumes.

  • RHEL 9 LVM administration

  • LVM pvmove, thin provisioning, and snapshot merging

Test Your Knowledge

A mounted XFS filesystem on /dev/vg_data/lv_web needs an extra 30 GiB. The VG has enough free extents and the RHEL 9 resize tools are available. Which command requests LV and filesystem growth together?

A

lvextend -L +30G -r /dev/vg_data/lv_web

B

lvresize -L +30G /dev/vg_data/lv_web && resize2fs /dev/vg_data/lv_web

C

xfs_growfs /srv/web alone

D

lvreduce -L 30G /dev/vg_data/lv_web

Test Your Knowledge

A readable PV /dev/sdb1 will be retired. Its replacement /dev/sde1 is in the same VG and has enough free extents. Which command migrates the allocated extents while the LVs remain active?

A

pvremove /dev/sdb1

B

vgreduce vg_storage /dev/sdb1

C

pvmove /dev/sdb1 /dev/sde1

D

pvdisplay /dev/sdb1

Test Your Knowledge

A RHEL 9 administrator must move an XFS workload to a smaller LV. The data fits the new capacity and the maintenance plan permits a controlled cutover. Which procedure preserves the data?

A

Shrink the active XFS filesystem with resize2fs

B

Reduce the current LV, then repair the truncated filesystem

C

Reduce the current LV while forcing LVM to ignore filesystem checks

D

Create a smaller LV and XFS filesystem, then restore and verify the data before cutover

Sections you finish are checked off in the contents.