12 de mayo de 2026

Technical Guide: Online XFS Filesystem Expansion using LVM and Parted

This technical document details the successful procedure for expanding a full XFS filesystem at the mount point /opt/repo/main on the server mylnxsrv. The process involves a complete online expansion of the storage stack layers: the physical partition, the LVM Physical Volume (PV), the LVM Logical Volume (LV), and finally the XFS filesystem itself.


1. System overview

The following system specifications were captured on the server mylnxsrv:

  • Operating System: Oracle Linux Server release 8.10.

  • Kernel: 5.15.0-319.201.4.2.el8uek.x86_64.

  • Hypervisor: VMware (Full Virtualization).

  • CPU: Intel(R) Xeon(R) Gold 6130 CPU @ 2.10GHz (4 Cores).

  • Memory: 5.6 GB Total (approx. 4.1 GB available).


2. Initial state assessment

The mount point /opt/repo/main reached 100% utilization, with only 93MB available, causing a critical storage shortage. While the underlying disk /dev/sda had its capacity increased at the hypervisor level to 1074GB, the internal partition sda1 and the LVM layers remained at 537GB.

Filesystem configuration (/etc/fstab)

The system uses XFS for its primary data repository. XFS is a high-performance, 64-bit journaling filesystem that supports online resizing.

/dev/mapper/ol-root       /                        xfs     defaults        0 0
UUID=c7f69...             /boot                    xfs     defaults        0 0
UUID=F3F4-5A30            /boot/efi                vfat    umask=0077...   0 2
/dev/mapper/ol-swap       none                     swap    defaults        0 0
UUID=c08f75...            /opt/repo/main           xfs     defaults        0 0


3. Step-by-step extension procedure

Step A: Resize the partition

Command: parted /dev/sda resizepart 1 100%

The parted command was used to extend partition 1 to occupy 100% of the newly available disk space.

  • Status before: sda1 size was 537GB.

  • Status after: sda1 size increased to 1074GB.

Step B: Resize the LVM physical volume (PV)

Command: pvresize /dev/sda1

This command notifies the LVM layer that the underlying partition size has changed.

  • Status after: pvs confirmed that <1000.00g was now recognized, with 500.00g of Physical Free space (PFree) available for use.

Step C: Extend the logical volume (LV)

Command: lvextend -l +100%FREE /dev/mapper/vg_repos-lv_main

This extends the Logical Volume to consume all newly available free space in the Volume Group (vg_repos).

  • Status After: lvs showed the lv_main size increased from <500.00g to <1000.00g.

Step D: Grow the XFS filesystem

Command: xfs_growfs /opt/repo/main

Since XFS supports online resizing, this command expands the filesystem to fill the newly enlarged Logical Volume while it remains mounted and active.


4. Final verification

The storage stack now fully reflects the 1000GB (approx. 1TB) capacity. Disk utilization for the repository has been reduced from 100% to 51%.

Final filesystem status:

[root@mylnxsrv ~]# df -h /opt/repo/main
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/vg_repos-lv_main  1000G  504G  497G  51% /opt/repo/main

Final block device status (lsblk):

sda                    8:0    0 1000G  0 disk 
└─sda1                 8:1    0 1000G  0 part 
  └─vg_repos-lv_main 252:2    0 1000G  0 lvm  /opt/repo/main

Note: For XFS filesystems, always target the mount point with the grow command rather than the block device path. Unlike ext4, targeting the device path (/dev/mapper/...) can result in an error.

No hay comentarios.: