Extend CentOS Logical Volumes with LVM and XFS Online
Grow an XFS logical volume on CentOS using LVM’s lvextend and xfs_growfs. Verify layout with pvs/vgs/lvs, keep free space, and use snapshots for recoverability.
19 Apr 2026, 21:59 UTC

Desired Outcome
Grow a mounted XFS logical volume on CentOS without unmounting or rebooting, while keeping the filesystem online and data intact.
Prerequisites
- CentOS 8 or CentOS 9 (or RHEL‑compatible) with
lvm2andxfsprogsinstalled. - Root or sudo privileges.
- At least one unused block device (e.g.,
/dev/sdb) that can become a Physical Volume (PV). - An existing Volume Group (VG) or the ability to create a new one.
- A mounted XFS logical volume (LV) you wish to extend.
Procedure
Verify the current LVM layout
Run
pvs,vgs, andlvsto see which devices are already part of the VG and how much free space remains.# pvs # vgs # lvsCreate a new Physical Volume (PV)
Replace
/dev/sdbwith the device you intend to add. This operation will wipe any existing data on that disk.# pvcreate /dev/sdbAttach the PV to an existing Volume Group
If you already have a VG named
vg_data, add the new PV. Otherwise, create a new VG.# vgextend vg_data /dev/sdb # OR # vgcreate vg_data /dev/sdbExtend the logical volume
Assume the LV you want to grow is
/dev/vg_data/lv_data. The-L +5Gflag adds 5 GB to the current size.# lvextend -L +5G /dev/vg_data/lv_dataResize the XFS filesystem online
After the LV has been extended, XFS can grow without unmounting.
# xfs_growfs /dev/vg_data/lv_dataVerify the new capacity
Check that the filesystem now reports the increased size.
# df -h /data
Expected Checks
pvsshould show the new PV undervg_datawith its size reflected.vgsshould report more free space in the VG after the PV is added.lvsshould listlv_datawith the new size.df -hmust show the mount point’s size increased by roughly 5 GB.
Recovery Options
- Before extending, create a snapshot of the LV:
If the extension fails or you need to roll back, copy data from the snapshot back to the original LV or restore from a backup.# lvcreate -s -n lv_data_snap1 -L 1G /dev/vg_data/lv_data - Always maintain at least 10 % free space in the VG; otherwise, future extensions or snapshots will fail.
Limitations & Caveats
- XFS cannot be shrunk; reducing an LV requires a different filesystem that supports shrinkage (e.g., ext4).
- Running
lvextendon a busy LV can temporarily increase I/O; monitoriostatif performance impact is a concern. - Incorrectly targeting a device during
pvcreatewill erase all data on that device. Verify the device name withlsblkbefore proceeding. - Snapshots consume free VG space; ensure you have enough before creating large snapshots.
Practical Check – Write Test File
After the extension, confirm write access by creating a small file.
# touch /data/testfile
# ls -l /data/testfile
If the file appears and no errors occur, the volume is healthy.
Conclusion
By following the steps above, you can safely grow an XFS logical volume on CentOS while keeping the filesystem online. Remember to keep backups, monitor free space, and understand that shrinking is not supported for XFS.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.