I use this trick quite often for Windows 2003 machines (this is not needed on Windows 2008 machines, you can use diskpart directly here!)
After time the OS disk grows out it’s free space, usually this happens due to Windows updates or logfiles.
So, here’s how to extend an OS disk of a Windows 2003 machine using diskpart and VMware (ESX 2.0, vSphere, ESX3.5 anything will do):
- Shut down the virtual machine in question.
- Connect the virtual machine OS disk to another virtual machine, this can be a running virtual machine (please note that you do need to reboot this machine after you are done):- Click edit settings on the running virtual machine.- Click on “Add…” to add hardware to the machine.
– Select “Hard disk”
– Select “Use an existing virtual disk”
– Browse to the virtual disk.
– Click “Next” and “Finish”
Your running virtual machine should now look like this:
Click “OK” to apply the settings.
- Now go to edit settings again, and change the size of the virtual disk.
Click “OK” once again.
- Now open the console of the running machine. And start a command prompt.
- Type “diskpart”.Within diskpart, type “list disk” to display available disks, you should notice the disk with the free space:
Now select that disk, using “select disk 2” (2 being the disk number offcourse..)
After that, select the appropriate partition, using “select part 1” (1 being the partition number)
Now extend the partition using the “extend” command.
- Now shut down the virtual machine, and remove the added disk. After that you can power on the initial virtual machine.