Tuesday 8 January 2008

How to resize a VMWare disk

One of my three virtual machines was having low disk space problems. The virtual disk is 8GB in size, but apparently not enough. I decided to increase the size to 12GB, but thats not easy to do!

There are multiple ways to perform this task. I normally do the Process 2 mentioned below, but there is an easy way that I didn't know before: VMWare Converter.

Using VMWare Converter:

  1. Turn off the virtual machine;
  2. Start the VMWare Converter application;
  3. Open the wizard;
  4. Select 'standalone virtual machine' as the source and destination system;
  5. Choose 'Select volumes and resize to save or add space';
  6. Enter a new size and voila, you're done!

A site mentions that the expand process is slow and that VMWare Tools might need to be reinstalled.

Using the VDiskManager:

  1. Turn off the virtual machine;
  2. Commit/remove all the snapshots first! (I forgot to mention this, thanks JimO)
  3. Create a good backup of the files!;
  4. Open a Command Prompt and go to:
    C:\Program Files\VMWare\VMWare Server

  5. Run this command to expand the virtual disk:
    vmware- vdiskmanager -x 12GB "My harddisk.vmdk

  6. Note: Because this only expands the disk and not the partition, you'll need to resize the partition table as well. This can be done by 3rd party tools like 'Partition Magic', but also with 'diskpart.exe', builtin into Windows. In my case, this disk is a boot disk, meaning it can't be done on the virtual machine itself. I used another my 2nd virtual machine, running Windows XP.

    Add the increased hard disk to a second virtual machine (must be turned off first!).

  7. Power up this 2nd virtual machine;

  8. Open a Command Prompt and type:
    diskpart

  9. Type:
    list volume

    Remember the volume number (#) of your volume!

  10. Type:
    select volume (the number from step 8)

  11. Type:
    extend

  12. Turn off this 2nd virtual machine and remove the hard disk from the virtual machine configuration;

  13. Finished! (Windows automatically recognizes the new and correct disk and volume size)

No comments: