Below is the procedure on how to extend the disk of a Windows 2003 virtual server.

Before starting please note the following:

  • Microsoft's diskpart utility can only be used to extend dynamic disks. Before using this utility you will need to convert your disks to dynamic using the Disk Management utility in the Computer Management console.
  • System or boot volumes cannot be extended using diskpart.
  • GParted cannot manage dynamic disks. If you are resizing a system or boot disk, configure it as a dynamic disk after it has been resized. If you convert to dynamic first, you may not be able to convert it back to a basic disk.
  • Before making any changes ensure you have a backup of your server, or at the least a snapshot of your VM.

1. Power down your VM gracefully
2. SSH to the ESX Server hosting the VM
3. cd to the directory containing your .vmdk disk file (you can check the name and location on the Hardware tab of your VM in Virtual Infrastructure Manager). e.g.

cd /vmfs/volumes/vmStore

4. Use vmkfstools to extend the disk using the following syntax: (Please use a double dash, not a single dash. WordPress automatically reformats this from a double to single dash)

vmkfstools --extendvirtualdisk [size] [vmdk filename]

Size can be in Mb, for example 5000m, or in Gb, for example 5g. e.g.

vmkfstools --extendvirtualdisk 11g S05010094.vmdk

If you are resizing your C: drive or system/boot partition, continue at step 9. Otherwise, continue below:

5. Power up your VM
6. In Computer Management ? Disk Management you should now see the unallocated space on the disk.
7. Open a command prompt window and use the diskpart utility to extend the partition.

Diskpart
List volume
Select volume z
Extend size=x disk=y

Where z = the volume number, x= the size in MB and y= the disk number in Disk Management

8. Your server may need a restart for the changes to take effect.

If you are resizing your C: drive , follow steps 1-4 above. Then:

9. Obtain a copy of the GParted live CD iso, copy it to your ESX server and configure it as your CD ROM drive on your VM.

Note: GParted will only recognize your disks if your VM's SCSI Controller is configured to emulate a BUS Logic SCSI controller. Changing type from LSI Logic to BUS Logic is dangerous. Make sure you know what you are doing or you could make your disk inaccessible to Windows.

10. Change SCSI Controller type from BUS Logic to LSI Logic.
11. Boot your VM from the ISO image.
12. Use GParted to delete the extra space and extend your volume into the unallocated space.
13. Power down VM. Change SCSI Controller type from LSI Logic to BUS Logic. Configure VM to boot from hard disk.
14. Power on VM, chkdsk should run as part of the startup proces and your disk should then be extended.