When a Rocky Linux server starts running out of disk space, expanding the virtual disk is only the first step. If the system uses LVM, you also need to grow the partition, resize the physical volume, extend the logical volume, and grow the filesystem.
This guide walks through expanding the root and /home logical volumes on a Rocky Linux 9.7 system after the underlying disk has already been increased in a hypervisor such as VMware, Proxmox, Hyper-V, or a similar platform.
Goal
Expand available storage on a Rocky Linux 9.7 LVM system without reinstalling the operating system or moving data manually.
Why This Matters
In many server and homelab environments, Linux virtual machines start small and grow over time. Logs, application data, user files, containers, databases, and updates can eventually fill the root or home filesystem.
Rocky Linux commonly uses LVM and XFS by default. That combination is reliable and flexible, but the resize process needs to be done in the right order.
Warning: Disk and LVM changes affect live storage. Take a backup or snapshot before making changes, especially on production systems.
Prerequisites
- Operating system: Rocky Linux 9.7 using LVM
- Disk expansion: The virtual disk has already been increased in VMware, Proxmox, Hyper-V, or another platform
- Access: Root or sudo privileges
- Protection: Backup or snapshot strongly recommended
Step 1: Verify the Current Disk and LVM Layout
Start by checking the current disk, filesystem, volume group, logical volume, and physical volume layout.
lsblk df -h vgs lvs pvs
On many Rocky Linux installations, the main disk may appear as /dev/sda, with the LVM partition commonly located at /dev/sda2. Your system may use a different disk name, especially on NVMe or virtualized storage.
Practical tip: Do not assume your disk is /dev/sda. Confirm the actual disk and partition names with lsblk before running any resize commands.
Step 2: Install the growpart Utility
After increasing the disk at the hypervisor level, the Linux partition still needs to be extended so the operating system can see the additional space.
dnf install -y cloud-utils-growpart
Step 3: Expand the LVM Partition
Most Rocky Linux LVM installations use partition 2 for the LVM physical volume. The following command expands partition 2 on /dev/sda.
growpart /dev/sda 2
Replace /dev/sda and partition number 2 if your system uses a different disk or partition layout.
Important: Verify the target disk and partition before running growpart. Expanding the wrong partition can cause operational issues.
Step 4: Resize the LVM Physical Volume
Once the partition has been expanded, notify LVM that the physical volume has more available space.
pvresize /dev/sda2 pvs
The pvs command should show the updated physical volume size and any free space available inside the volume group.
Step 5: Extend the Logical Volumes
At this point, you can decide how to allocate the newly available space. You can give all free space to root, split it between root and home, or manually assign specific sizes.
Option A: Allocate All Free Space to Root
This option is useful when the root filesystem needs all available capacity.
lvextend -l +100%FREE /dev/rl/root xfs_growfs /
Option B: Split Free Space Between Root and Home
This example gives roughly half of the currently free space to root, then gives the rest to home.
lvextend -l +50%FREE /dev/rl/root lvextend -l +100%FREE /dev/rl/home xfs_growfs / xfs_growfs /home
Option C: Manually Allocate Specific Sizes
Use this approach when you want predictable allocation instead of percentage-based growth.
lvextend -L +50G /dev/rl/root lvextend -L +100G /dev/rl/home xfs_growfs / xfs_growfs /home
Deployment note: Leaving some free space in the volume group can be useful for future growth, snapshots, or emergency expansion.
Step 6: Verify the Final Result
After extending the logical volumes and growing the filesystems, confirm the final sizes.
df -h
The root and home filesystems should now reflect the expanded sizes.
Important Notes
- XFS behavior: Rocky Linux 9 commonly uses XFS by default.
- Online expansion: XFS filesystems can be expanded while mounted.
- No shrinking: XFS filesystems cannot be shrunk.
- Filesystem check: Verify filesystem type before resizing.
df -T
Example One-Line Expansion Command
For a straightforward lab system where you want to allocate all newly available free space to root, the process can be combined into a single command sequence.
Warning: Review each command before using a chained one-liner. A typo in a storage command can have serious consequences.
growpart /dev/sda 2 && pvresize /dev/sda2 && lvextend -l +100%FREE /dev/rl/root && xfs_growfs /
Final Thoughts
Expanding Rocky Linux LVM storage is straightforward once you understand the order of operations: grow the partition, resize the physical volume, extend the logical volume, and grow the filesystem.
For homelab and production systems alike, the safest approach is to confirm the disk layout first, take a backup or snapshot, then expand only the volumes that actually need more capacity.
