There are many ways to expand a drive within a VMWare image and I have outlined two approaches below depending on your setup. I have used both these methods successfully on a Windows Server 2003 Vmware image (Vmware Workstation 5.0)

Method 1

Advantages: You get to keep your Vmware snapshots
Limitations: You can’t extend all volumes, I had trouble trying to extend the system/boot volume. According to a Microsoft Knowledge Base article you can’t extend a volume if the system page file is located on the partition. You could try to move the page file to a partition that you do not wish to extend.

My setup:
C: System Drive 10 GB
D: Data 4GB

Let’s say that we want to expand the D drive from 4GB to 10GB

  1. Shutdown the VMWare Image
  2. Add a new disk to the VMWare image (the size should be that which you want to allocate to another volume, in this example 6GB).
  3. Boot up the VMWare image into Windows and go to Disk Management (Administrative Tools -> Computer Management -> Disk Management)
  4. A wizard should be displayed to initialize and convert the new disk. If you are not prompted then you may need to Rescan. Do not assign a new volume at this stage.
  5. You need to convert the D drive and the new drive to both be dynamic disks.
  6. Once both the drives are dynamic, then right click on the D drive and select Extend Volume.
  7. Follow the wizard to allocate the new space to the D drive.

Once you complete the wizard, the D drive should now be 10GB. That’s method 1 complete. If this worked for you, great! If not then take a look at Method 2 below.

Method 2

Advantages: You can successfully expand a system/boot drive.
Limitations: You have to remove all your snapshots (the vmware-vdiskmanager utility requires this.)

My Setup:
C: System Drive 8GB
D: Data 4GB
E: Data 4GB
Disk before resizing

Let’s say that we want to expand the C volume from 8GB to 12GB. Assume that the C drive is full to capacity (that’s why we are expanding it right!)

  1. If the Vmware image is running, shut it down.
  2. You need to find the name of the Vmware (.vmdk) file that represents the virtual disk that you want to expand. Go to VM->Settings and locate the drive
    that you want to expand. The disk file field on the right hand side will display the name of the .vmdk file. Virtual Machine Settings
  3. You need to remove any snapshots present in the Vmware image. Note: By deleting the snapshots the system still remains in its current state.
  4. Open up a command prompt and issue the following command: vmware-vdiskmanager -x 12GB “Windows Server 2003 Standard Edition.vmdk” where 12GB is the desired size of the expanded volume.
    Running vdiskmanager
  5. This expansion may take a while but when it is complete, boot up into Windows and go to Disk Management (Administrative Tools -> Computer Management -> Disk Management)
    You should see something similar to the following screenshot. The disk has been expanded but the new space is as yet unallocated. Now in theory you should be able to use the Windows diskpart utility to allocate this space but this would not work on a boot/system disk for me.
    Viewing the new unallocated space
  6. So with diskpart not up to the task, what are your options?:
    • Buy some Windows partition software (i.e. Partition Magic) at a cost of USD200- USD300 for a Server edition or
    • You could use Knoppix (free) to allocate the new space to the C drive. Knoppix is a bootable Live Linux CD and it happens to have a utility called QTparted.
  7. Since everyone likes free stuff, I went with Knoppix in this case. Download Knoppix (the iso image) to the machine which hosts the VMware image.
  8. Now you need to point your CD/DVD drive in your VMWare image to the iso image. How do I do this?
  9. Reboot your VMware image and have it boot from the cd drive. You may need to modify the BIOS settings in order to change the boot order to have the system boot from the CD drive. The exact settings that you need to modify will depend on the exact BIOS that you have. It should be straightforward to change this.
  10. After Knoppix boots , start at the large letter K at bottom left. Select K | System | QTParted to launch the utility. You will see the list of disks within the VMware on the left hand side. Selecting one of these disks will provide you with more details about that disk. In the following screenshot you can see the C drive with the 8GB allocated and the 4GB unallocated.
    Viewing disk in QTParted under Knoppix
  11. Right click on the drive that you want to expand and select Resize.
    Knoppix Context menu
  12. A dialog will be displayed and you can expand the allocated space by dragging the partition to the right. You could also type in the values into the textboxes. After allocating all the new space you now see that the total size is approx. 12GB.
  13. Click OK to exit the dialog. At this stage you have not commited the changes yet. Go to the main menu of QTParted and select the Commit option. The following prompt will be displayed.
    Commit Changes Warning
  14. Choose Yes to commit the changes. You will see the following two screenshots as it commits the changes.
    Commit Changes Progress 1
    Commit Changes Progress 2
  15. After the operation completes, you should see that the new volume now is 12GB in size with only 8GB in use (we now have 4GBs free :))
    Drive after changes commited
  16. Now, shutdown the Vmware image and boot back into Windows (you may need to change the boot order to accomplish this).
  17. Don’t be alarmed if CHKDSK wants to run some tests on your drive. It detected the changes you made in Knoppix and wants to verify that everything is ok.
    Chkdsk scan
  18. You may need to restart Windows again because it will have detected new hardware.
    Windows detect new hardware
  19. Once Windows is back up, go to Disk Management (Administrative Tools -> Computer Management -> Disk Management) and you should now see that the C drive has the extra 4GB as promised.
    Disk Management
    Disk with new space
  20. Also, in Windows Explorer, right click on the C drive and choose Properties. You will see now that there is over 4GB of free space. :))
    Disk Properties showing free space

Job Done!

Lessons for the future:
When you are creating future Vmware image make sure to allocate plenty of space to the drives.
You can set that they only grow as required so they only ever take up the space that you require at any point in time.