How to increase the size of root (LVM) partition in the Ubuntu/RHEL systems?

1. First boot the system and check  /  partition size by below command.
# df –h

2. Check and record the output of the commands:
# pvdisplay
# vgdisplay
# lvdisplay

3. Now add external HD (i.e. 8GB) to the system.

4. Reboot the system from the Live CD or from local Live ISO (In case of Virtual Machine).

5. Now check the output of the command:
# fdisk  -l (this command should show the new added 8GB partition)

6. Make a partition of newly added 8 GB HDD using below command.
# fdisk -cu /dev/sdb

After completion It will show the additional 8GB partition in the system i.e. /dev/sdb1.

7. Now create the PV of the newly added partition.
# pvcreate /dev/sdb1

8. Run command to get the information:
# pvdisplay (this command should show the newly created pv)

9. Now extend the existing VG.
Run the command:
# vgextend  vg1  /dev/sdb1

10. Check the output of the vgdisplay:
# vgdisplay  (It will show you the output with extended size)

11. Extend the LV. 
Run the command:
# lvextend –L +8G /dev/mapper/vg1-lv_root    

Now check the output of command:
# lvdisplay  (It will show you the root partition with extended size)

12. Run the command:
# e2fsck -f /dev/mapper/vg1-lv_root    

13. Run the command:
# resize2fs /dev/mapper/vg1-lv_root    

14. To verify the output, mount the root partition on /media and check the size of root using df -h command.
# mount  /dev/mapper/ vg1-lv_root     /media

15. Now reboot the system (without Live CD) and verify that the changes made are permanent or not.




No comments:

Post a Comment