Wednesday, 2 September 2015

Extending a VMWare RHEL Logical Volume

Extending a VMWare RHEL Logical Volume 



To extend a logical volume within an VMWare virtual machine, follow these steps


1.    Turn off VM
2.    Change disk size
3.    Turn on VM
4.    Run fdisk -l to find name of disk that needs to be extended (/dev/sda by default for primary disk)
5.    Run fdisk /dev/sda (or whatever disk is called from step above)
6.    Enter p to print partition table
7.    Enter n for new primary partition
8.    Enter p for new primary
9.    Enter the next available partition number based on the output from step 6
10.    Enter the next free cylinder block if this isn’t already defaulted
11.    Leave last cylinder block as default
12.    Enter t to change partition type
13.    Enter 8e to set Linux LVM
14.    Enter w to write the partition table changes
15.    Restart the VM
16.    Run fdisk -l to confirm new partition is there
17.    Run pvcreate /dev/sda3 (or whatever the partition created was called
18.    Run vgextend vg_volgroupname /dev/sda3 substituting vg_volgroupname for the name of the volume group you are extending and /dev/sda3 for the name of the partition that was created
19.    Run lvextend /dev/vg_ volgroupname/lv_logvolname /dev/sda3 substituting volgroupname and logvolname for the names of the volume group and logical volume. Change /dev/sda3 for the name of the new partition
20.    Run resize2fs /dev/vg_volgroupname/lv_logvolname substituting volgroupname and logvolname for the names of the volume group and logical volume or ext2online /mountpoint if you get an error that an online partition can’t be resized
21.    Run df -h to check that the volume is now extended
22.    Reboot the server to check it comes back up ok and check the space again with df -h




No comments:

Post a Comment