How to Extend Disk Partition Size on Rocky Linux

Step-by-step guide to extend disk partitions on Rocky Linux, including growpart, LVM extension, and filesystem resizing for XFS and ext4

How to Extend Disk Partition Size on Rocky Linux

This guide explains how to extend a disk partition on Rocky Linux after increasing the virtual disk size in a hypervisor such as ESXi, XCP-ng, or Proxmox.

Prerequisites

  • Disk size already increased in hypervisor
  • Root or sudo access
  • Understanding of disk, partition, and filesystem layout

1. Verify Disk and Partition Layout

List Block Devices

lsblk

Example output:

NAME        SIZE TYPE MOUNTPOINT
sda          60G disk
├─sda1      600M part /boot/efi
├─sda2        1G part /boot
└─sda3     58.4G part
  ├─rl-root 55.2G lvm  /
  └─rl-swap  3.2G lvm  [SWAP]
sdb           6T disk
└─sdb1        6T part /data

Check Filesystem Types

df -T

This identifies whether the filesystem is xfs or ext4, which determines the resize method.

2. Extend the Partition

Use growpart to extend the partition to use all available space.

Dry Run (Recommended)

growpart /dev/sdb 1 --dry-run

Apply Changes

growpart /dev/sdb 1

Replace /dev/sdb and partition number 1 with your actual disk and partition.

3. Extend Logical Volume (If Using LVM)

This step is only required if the partition is part of an LVM volume group.

lvextend -l +100%FREE /dev/sdb1

This extends the logical volume to use all remaining free space.

4. Resize the Filesystem

XFS Filesystem (Common for System Drives)

xfs_growfs /dev/sdb1

XFS must be grown while mounted.

EXT4 Filesystem (Common for Data Drives)

resize2fs /dev/sdb1

EXT4 can be resized online or offline depending on configuration.

5. Verify the Result

df -h

Confirm that the filesystem reflects the newly expanded size.

Best Practices

  • Always take a snapshot or backup before resizing disks
  • Verify correct device names before executing commands
  • Use --dry-run where available
  • Confirm filesystem type before resizing
  • Monitor system logs for errors after resizing

Common Scenarios

  • System disk (XFS + LVM): grow partition → extend LV → grow filesystem
  • Data disk (EXT4, no LVM): grow partition → resize filesystem
  • Large storage volumes: ensure alignment and capacity planning

Summary

Extending disk capacity on Rocky Linux involves three key steps: expanding the partition, extending the logical volume (if applicable), and resizing the filesystem. Following this structured approach ensures safe and reliable storage expansion.

Note: Incorrect disk operations can result in data loss. Always verify commands before execution.

Last Updated: 
2026/03/18

Sitemap | Tech Articles | Cordeos News | Tech Notes | IT Support Jobs