Extend Logical Volume size on RHEL/CentOS

Scenario: Extend/Growing Logical Volume size for /opt on RHEL/CentOS.
System: CentOS/RHEL 6/7

Login as root then follow below steps:
1) Check free size in Volume Group (vgs). If still there free size then continue to step-2.
# vgs

[root@VTEST01 ~]# vgs
 VG #PV #LV #SN Attr VSize VFree
 VolGroup 2 7 0 wz--n- 59.50g 12.00g
[root@VIDHOLXDTESTAP01 ~]#

2) Check the LV Path of /opt.
# lvdisplay |grep opt

# lvdisplay | grep opt
[root@VTEST01 ~]# lvdisplay |grep opt
 LV Path /dev/VolGroup/lv_opt
 LV Name lv_opt
[root@VTEST01 ~]#

3) Based on our need,select 1 from 3 example below:
a. Example added 100MB to /opt.
# lvextend -L+100M /dev/VolGroup/lv_opt

[root@VTEST01 ~]# lvextend -L +100M /dev/VolGroup/lv_opt
 Size of logical volume VolGroup/lv_opt changed from 5.00 GiB (1280 extents) to 5.10 GiB (1305 extents).
 Logical volume lv_opt successfully resized.
[root@VTEST01 ~]#

b. Example extend /opt to 5.5GB.
# lvextend -L5.5G /dev/VolGroup/lv_opt

[root@VTEST01 ~]# lvextend -L5.5G /dev/VolGroup/lv_opt
 Size of logical volume VolGroup/lv_opt changed from 5.10 GiB (1305 extents) to 5.50 GiB (1408 extents).
 Logical volume lv_opt successfully resized.
[root@VTEST01 ~]#

C. Example extend all remaining free size to /opt
# lvextend -l +100%FREE /dev/VolGroup/lv_opt

4) Once done,we can view the new size by type one of these command
# df -aTh
# lvs
# lvdisplay


Leave a Reply

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