Resizing volumes in RHEL
- Ensure disk is already expanded from hypervisor
- Check the list of disks attached
lsblk
- Check if the disk expansion was recognised by RHEL
fdisk /dev/sda
Press p to check properties
Press q to quit fdisk
- Delete the partition for the disk
fdisk /dev/sda
Press d and select the partition number (e.g 3)
Press n to re-create partition
Press t to select type. 8e is for local LVM filesystem
Press w to write the changes
- Reprobe the disks
modprobe -s
- Resize the PV
pvresize /dev/sda
- Verify the disk is re-sized
vgdisplay
- Verify the lv
lvdisplay and confirm the LV that we want to expand
- Extend LV
lvextend -l +100%FREE /dev/rhel_bastion/root
- Verify the LV size was extended
lvdisplay
- Extend the filesystem to recognise the new disk size.
For xfs filesystem: xfs_growfs /dev/rhel_bastion/root
For other filesystem: resize2fs /dev/rhel_bastion/root
Updated Steps
- Check list of disks attached
lsblk
- Recreate root partition
fdisk /dev/sda
Press p to check properties
Press d → 2 to delete partition 2
Press n → 2 → Enter → Default Value → n to create new partition
Press w to save the configuration
- Run
partprobe -s to sync the partition configuration
- Verify the volume group
vgdisplay
- Expand the root partition
lvextend -l +100%FREE /dev/mapper/rhel-root
- Expand the file system
xfs_growfs /dev/mapper/rhel-root