Home CentOS/RHELLVM on RHEL 9: Create, Extend and Resize Logical Volumes

LVM on RHEL 9: Create, Extend and Resize Logical Volumes

by Knowledge Base Linux
LVM on RHEL 9 storage volumes merging illustration

Running out of disk space on a production server used to mean downtime, new partitions and risky data moves. With LVM on RHEL 9, storage becomes flexible: you can grow a filesystem while it is mounted and serving traffic. This guide shows the complete LVM workflow on RHEL 9 and CentOS Stream 9 — creating physical volumes, volume groups and logical volumes, then extending and resizing them safely online.

Prerequisites

  • A RHEL 9 or CentOS Stream 9 server with a free disk or free space in a volume group
  • Root or sudo access
  • A recent backup — storage operations are safe when done correctly, but a backup is cheap insurance

How LVM on RHEL 9 Is Organized

LVM has three layers. Physical volumes (PVs) are disks or partitions initialized for LVM. One or more PVs form a volume group (VG), a pool of space. From that pool you carve logical volumes (LVs), which you format and mount like normal partitions. Because LVs are drawn from the pool, they can span disks and grow on demand — the whole point of using LVM on RHEL 9 servers.

Inspect what you already have at any time:

pvs
vgs
lvs
lsblk

Step 1: Create a Physical Volume and Volume Group

Assume a new 100 GB disk appeared as /dev/sdb. Initialize it and create a volume group called data_vg:

pvcreate /dev/sdb
vgcreate data_vg /dev/sdb
vgdisplay data_vg

Never run pvcreate on a disk that still contains data you need — it writes LVM metadata onto the device.

Step 2: Create and Format a Logical Volume

Create a 40 GB logical volume named data_lv, format it with XFS (the RHEL 9 default) and mount it:

lvcreate -n data_lv -L 40G data_vg
mkfs.xfs /dev/data_vg/data_lv
mkdir -p /data
echo "/dev/data_vg/data_lv  /data  xfs  defaults  0 0" >> /etc/fstab
mount -a
df -h /data

Always test an fstab edit with mount -a before rebooting; a typo here can drop the server into emergency mode. Leave the remaining 60 GB of the VG unallocated as your growth reserve.

Volume growth chart showing how LVM on RHEL 9 extends storage

Step 3: Extend a Logical Volume Online

When /data fills up, grow it by 20 GB and resize the filesystem in the same command using the -r flag of lvextend:

lvextend -r -L +20G /dev/data_vg/data_lv
df -h /data

The -r option calls the right resize tool automatically — xfs_growfs for XFS, resize2fs for ext4. Without it you must run the filesystem resize yourself, and forgetting that step is the classic beginner mistake: the LV grows, but the filesystem does not.

To consume all remaining space in the VG instead of a fixed amount:

lvextend -r -l +100%FREE /dev/data_vg/data_lv

Step 4: Add a New Disk to the Volume Group

If the VG itself is out of space, add another disk. Initialize it, extend the group, then grow the LV as before:

pvcreate /dev/sdc
vgextend data_vg /dev/sdc
vgs
lvextend -r -L +50G /dev/data_vg/data_lv

This is exactly why LVM on RHEL 9 beats plain partitions: capacity planning becomes an incremental task instead of a migration project. To check how full your volumes and filesystems are overall, see our guides on how to check disk space in Linux and how to check if your VPS storage is full.

Step 5: Reduce a Volume (Carefully) and Remove Volumes

Shrinking is the one dangerous LVM operation. XFS filesystems cannot be shrunk at all; ext4 can, but only while unmounted, and the filesystem must be reduced before the LV. Prefer growing into free space over shrinking whenever possible. Removing a volume you no longer need is straightforward:

umount /data
lvremove /dev/data_vg/data_lv

Step 6: Take an LVM Snapshot Before Risky Changes

One underused benefit of LVM on RHEL 9 is snapshots: an instant, space-efficient point-in-time copy of a volume. Before a major application upgrade or a risky data import, snapshot the volume so you can roll back in minutes:

lvcreate -s -n data_snap -L 5G /dev/data_vg/data_lv

If the change goes wrong, unmount the volume and merge the snapshot back with lvconvert --merge /dev/data_vg/data_snap. If everything works, simply remove the snapshot with lvremove — remember that a snapshot grows as the original volume changes, so do not keep snapshots around forever on busy systems.

Troubleshooting

“Insufficient free space”: the VG has no unallocated extents. Check with vgs — either add a disk (Step 4) or free space from another LV.

The LV grew but df shows the old size: the filesystem was not resized. Run xfs_growfs /data for XFS or resize2fs /dev/data_vg/data_lv for ext4.

Server boots into emergency mode after an fstab edit: boot from rescue media, fix the entry or add the nofail option, and always validate with mount -a before rebooting.

Conclusion

LVM on RHEL 9 turns storage from a fixed decision into a flexible resource: create volumes from a shared pool, extend them online with lvextend -r, and add disks to the group when the pool runs dry. Keep some VG space in reserve, validate fstab changes, and disk-full emergencies become a two-minute fix instead of an outage. The RHEL 9 logical volumes guide covers snapshots, RAID LVs and thin provisioning when you are ready to go further.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.