How to Increase the Hard Disk Size of Guest OS

How to Increase the Hard Disk Size of Guest OS

The original copy of these instructions is located here -->

When I need to increase the size of a virtual disk (.vmdk), you use the console command vmkfstools and the Gparted LiveCD. If you did not know, Gparted is an open source Partition Magic Alternative. Available on sourceforge.net

These steps are for a Windows VM. They should work for any OS, however.

1. Download the Gparted LiveCD ISO. You will need to save it to a location you can use it to boot the VM, like uploading it using the VI client to the ESX host's data store.

2. Shutdown the virtual machine you want to resize

3. Log into the ESX Server via Putty, or however you can get to the console.

4. Use vmkfstools to increase the size of the .vmdk For example if you had a VM named "MyOS" in a folder called "myVMFS" and you wanted to increase it from 20GB to 24GB you would type (it is case sensitive):

vmkfstools -X 24g /vmfs/volumes/myVMFS/myOS.vmdk

or

vmkfstools -X 24576m /vmfs/volumes/myVMFS/myOS.vmdk

5. Boot the VM to the Gparted ISO

6. Once the Gparted partition editor loads, click your disk in the partition list

7. Click the Resize/Move button

8. Drag the arrow to extend the size of the partition. Be sure to work out the free space before and/or after the partition by sliding the whole partition either left or right.

9. Next click the Apply button to start the resizing process.

10. After it completes click the Close button

11. Reboot the VM without the Gparted ISO to the VM's OS.

12. You will have to wait for a chkdsk on the reboot. Then Windows will reboot again.

13. Check your new disk size in My Computer and Disk Manager!

As an alternative to steps 3 & 4, you can resize the disk using the VI client GUI by choosing to Edit Settings, then click on the HD you want to resize, type in the new size, click OK. Again, the VM has to be powered off in order to do this. Doing this still requires you to run the Gparted utility to resize a partition, otherwise you will only be able to ADD a partion using the new space. If the disk you are resizing happens to be a non-system disk, you may be able to extend the partition within Windows to use the new space.

-


Another way to do this is to use a "ghost" program:

1) Add a second HDD to the vm. The end size you want. In you're case 40Gb.

2) Restart VM and boot off a bootable ghost disk.

3) Use ghost program to clone disk 1 to disk 2.

4) After this is done power off VM.

5) Remove 1st HDD and set the 2nd drive to drive 1 in Virtual device node under edit VM settings.

6) Power up vm and that should be it.

-


The above steps were mostly taken from the discussion boards on this site and tweaked slightly for readability and spelling.

Tags (1)
Comments

Exactly what I needed, thanks!

Version history
Revision #:
1 of 1
Last update:
‎07-01-2009 12:55 PM
Updated by: