How to resize a VMWARE virtual disk and Resize LVM on CentOS.
*WARNING* THIS CAN RESULT IN FILE SYSTEM CORRUPTION IF DONE IMPROPERLY.
Backup SERVER is *STRONGLY* recommended.
First just check the partition table of the virtual disk in the VM
# fdisk -l /dev/sda
Disk /dev/sda: 68.7 GB, 68719476736 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 8354 66999082+ 8e Linux LVM
Now, shutdown the guest in preparation to resize the virtual disk
# shutdown
Resize the guest OS partition using VSphere Client (ESXi) or other VMtool (See VMWare support)
Boot the AirWave VM guest back up, and add a new partition with the free space of the virtual disk. Make sure to use partition id 8e for Linux LVM.
# fdisk /dev/sda
# n {new partition}
# p {primary partition}
# 3 {select partition number, by default 3 is the next available}
# t {select partition id we just made (3)}
# 8e {Linux LVM partition}
# p {print. the new device should be described as Linux LVM}
# w {write to memory}
You will need to reboot if fdisk updated kernel tables, just follow the recommendation message that will show up.
# reboot
You can check the partition table after the reboot if you like, make sure it looks like what you expect
fdisk -l /dev/sda
Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 8354 66999082+ 8e Linux LVM
/dev/sda3 8355 10443 16779892+ 8e Linux LVM
Now, create a new physical volume from the new partition
# pvcreate /dev/sda3
Then extend the existing volume group, you may want to use vgdisplay to list and identify the volume groups you have.
# vgextend VolGroup00 /dev/sda3
Now, extend the logical volume, again, use lvdisplay to list and identify the logical volumes you have.
# lvextend -L<TOTAL_VOLUME_DESIRED_SIZE>G /dev/VolGroup00/LogVol00 /dev/sda3
And finally, resize the filesystem in the logical volume
# resize2fs /dev/VolGroup00/LogVol00
Done.