How to Increase Hard Disk Size Without adding a new disk
1. Resize actual disk
Use the vmware-vdiskmanager utility in order to change the actual size of the Virtual Disk.
- Turn off the virtual machine
- Find the name_of_VM.vmdk file
- Execute
vmware-vdiskmanager -x SIZEGb/SizeMb name_.vmdk
where SizeGb/SizeMb is the new dimension of your HD.
2. Boot the VM and do as follows:
- Use fdisk utility,
fdisk /dev/sda
- see the partition table,
Command (m for help): p Disk /dev/sda: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 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 318 2449912+ 8e Linux LVM
- delete the second partition,
Command (m for help): d Partition number (1-4): 2 Command (m for help): p Disk /dev/sda: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux
- recreate the partition,
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (14-391, default 14): Using default value 14 Last cylinder or +size or +sizeM or +sizeK (14-391, default 391): Using default value 391 Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 8e Changed system type of partition 2 to 8e (Linux LVM) Command (m for help): p Disk /dev/sda: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 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 391 3036285 8e Linux LVM
- write all the changes,
Command (m for help): w
3. Reboot the VM
In order to get everything work you should reboot your machine and do as follows on the VM:
- resize the physical partition:
pvresize -v -d /dev/sda2
- extend the logical volume
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
- resize the Volume Group:
resize2fs /dev/VolGroup00/LogVol00

