Red Hat
Conceptual illustration: a metallic hard drive and a blue segmented storage bar expanding into free space beside a terminal prompt tile.

Extend an LVM Partition and Filesystem on RHEL

For an existing, unencrypted LVM layout on a supported RHEL release. CentOS Linux 7/8 are legacy, end-of-life systems.

Increasing a virtual disk does not automatically enlarge its partition, LVM physical volume or filesystem. This walkthrough grows an existing final partition and then adds a deliberate amount of capacity to an existing logical volume. Device names below are examples; identify the actual layout first.

Extend A Partition

Check the storage layers and recovery path

Have a verified backup and console access before changing partition boundaries. Record the original disk layout and LVM metadata. A VM snapshot alone is not a substitute for recoverable application data. This example assumes /dev/sda2 is the final partition, belongs to volume group rhel, and has contiguous unallocated space immediately after it. Do not use it unchanged for LUKS, RAID, multipath, thin pools or a different disk layout.

lsblk -f
findmnt /
sudo pvs
sudo vgs
sudo lvs -o lv_name,vg_name,lv_size,devices
sudo sfdisk --dump /dev/sda
sudo vgcfgbackup rhel

Save the partition-table dump and LVM backup outside the disk being changed. Confirm that the hypervisor or storage platform has expanded the correct disk. If Linux still reports the old disk size, use the rescan procedure appropriate to that controller; do not guess a sysfs path.

Grow the existing partition

The growpart utility extends a partition into adjacent free space without requiring a delete-and-recreate sequence. On RHEL the package is commonly cloud-utils-growpart; verify availability in your enabled repositories. Start with a dry run:

sudo dnf install cloud-utils-growpart
sudo growpart -N /dev/sda 2
sudo growpart /dev/sda 2
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS /dev/sda

Proceed only if the preview identifies the intended partition. NOCHANGE means it cannot grow further; investigate the disk geometry instead of forcing it. If the kernel cannot accept the revised partition table, stop and arrange a controlled reboot before continuing. A device-busy error must not simply be ignored.

Resize the physical volume and logical volume

sudo pvresize /dev/sda2
sudo pvs
sudo vgs
sudo lvextend --resizefs --size +10G /dev/rhel/root

The final command adds 10 GiB as an example; choose an increment supported by the available volume-group space. --resizefs requests the corresponding filesystem growth. XFS can grow but cannot be shrunk. If the filesystem step fails after the logical volume grows, diagnose that step; do not repeatedly add more space. Reserving some free extents can be useful for later operational needs.

Verify capacity and stop on unexpected results

sudo lvs -o lv_name,vg_name,lv_size
findmnt -no SOURCE,FSTYPE,TARGET /
df -hT /

Compare the final partition, PV, LV and filesystem sizes. Keep the original metadata and backup until application checks pass. The related Ansible LVM expansion guide explains how to use an absolute target size in automation.

References

Leave a Reply

Your email address will not be published. Required fields are marked *