SOLUTION VERIFIED - Updated March 13 2018 at 7:49 AM -
- Red Hat Enterprise Linux
- The root partition is an LVM logical volume.
- How do I resize the root LV after installation on Red Hat Enterprise Linux?
Note: Resizing non-LVM root partitions is not covered in this document and is not supported by Red Hat Global Support Services.
- Determine which Logical Volume provides the root (
/
) device, in the example below the/dev/mapper/VolGroup-lv_root
device provides root.
[root@host ~]# df -h / Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 360G 212G 130G 62% /
- Verify the free Physical Extents (PE) in the Volume Group in which the Logical Volume is residing.
[root@host ~]# vgdisplay VolGroup | egrep 'PE Size|Free PE' PE Size 4.00 MiB Free PE / Size 109467 / 427.61 GiB
- After confirming the free Physical Extents (PE), resize the Logical Volume by the desired amount by specifying the number of extents to extend by with the
-l
flag or by specifying a size to extend by via the-L
flag. For example:
[root@host ~]# lvextend -l +125 /dev/mapper/VolGroup-lv_root Extending logical volume lv_root to 365.13 GiB Logical volume lv_root successfully resized
OR
[root@host ~]# lvextend -L +500M /dev/mapper/VolGroup-lv_root Extending logical volume lv_root to 365.62 GiB Logical volume lv_root successfully resized
- Resize the mounted filesystem.
- The resize2fs command in the e2fsprogs rpm could only be used on an unmounted filesystem in RHEL4 system, but after RHEL5, it could be used to extend a mounted filesystem.
[root@host ~]# ext2online /dev/VolGroup/lv_root
[root@host ~]# resize2fs /dev/mapper/VolGroup-lv_root
For xfs filesystem we need to run xfs_growfs
instead of resize2fs
.
Please refer the article for more information How to grow/extend XFS filesytem using xfs_growfs command?
[root@host ~]# xfs_growfs /dev/VolGroup/lv_root
Note: If you miss this step, no error will occur, however only the logical volume size will increase, thus when you mount the filesystem it will still be the same size.
or
Adding -r will grow filesystem after resizing the volume.
# lvextend -L +500M /dev/mapper/VolGroup-lv_root -r
- More information on increasing the size of logical volumes in general can be found here:
How to extend a logical volume and its filesystem online in Red Hat Enterprise Linux?