firoz@rhel:~$
all labs
StorageCompletedFebruary 2026

LVM Storage: Online Resize, Shrink & Snapshot Rollback

Built a multi-disk LVM layout on RHEL, grew an XFS filesystem online, shrank an ext4 volume safely, and used a snapshot to roll back a bad change.

lvmxfsext4storagerhcsa

Environment

  • ›RHEL 9.4
  • ›3 x 5 GiB virtual disks (/dev/sdb, /dev/sdc, /dev/sdd)
  • ›Packages: lvm2, xfsprogs, e2fsprogs

Objectives

  1. 01Create a volume group from two physical volumes and grow it across disks
  2. 02Extend a live XFS filesystem without downtime
  3. 03Take an LVM snapshot before a risky change and restore from it
  4. 04Shrink an ext4 logical volume safely (XFS cannot be shrunk)

Walkthrough

Step 1

Create physical volumes and a volume group

Initialised two disks as PVs and combined them into a single volume group, then checked the free extents available.

$ pvcreate /dev/sdb /dev/sdc
$ vgcreate vg_data /dev/sdb /dev/sdc
$ vgdisplay vg_data

Step 2

Create and mount an XFS logical volume

Created a 6 GiB logical volume spanning both disks, formatted it XFS, and mounted it with an entry in fstab using its UUID.

$ lvcreate -n lv_web -L 6G vg_data
$ mkfs.xfs /dev/vg_data/lv_web
$ mkdir -p /srv/web
$ blkid /dev/vg_data/lv_web
$ mount /dev/vg_data/lv_web /srv/web

Step 3

Grow the filesystem online

Extended the logical volume by 2 GiB using the remaining free space, then grew the XFS filesystem in place — no unmount required.

$ lvextend -L +2G /dev/vg_data/lv_web
$ xfs_growfs /srv/web
$ df -h /srv/web

Step 4

Snapshot before a risky change, then roll back

Took a copy-on-write snapshot of a separate ext4 volume before editing config files on it. After intentionally breaking the config, I unmounted, reverted using lvconvert --merge, and remounted with the original data intact.

$ lvcreate -s -n lv_app_snap -L 1G /dev/vg_data/lv_app
$ umount /srv/app
$ lvconvert --merge /dev/vg_data/lv_app_snap
$ mount /srv/app

Step 5

Shrink an ext4 volume safely

Because XFS can't shrink, this step used an ext4 volume: unmounted it, ran a filesystem check, shrank the filesystem first, then shrank the logical volume — never the other way around.

$ umount /srv/archive
$ e2fsck -f /dev/vg_data/lv_archive
$ resize2fs /dev/vg_data/lv_archive 3G
$ lvreduce -L 3G /dev/vg_data/lv_archive
$ mount /srv/archive

Outcomes

  • ✓Comfortable growing live filesystems without scheduling downtime
  • ✓Internalised the 'shrink the filesystem before the LV, never after' rule
  • ✓Snapshot + merge gave a real rollback path for config changes — documented as part of a change-management checklist