Select Page

I was having a go at upgrading an XP virtual machine to Vista. During the exercise, I faced a number hard disk management issues. First, I needed to enlarge the virtual machine’s disk size as required by Vista. Once the disk was successfully enlarged, I then needed to extend the system partition before the Vista upgrade can proceed. After upgrade completes, I need to do shrink the virtual disk as it’s already quite large in size.

Allow me to first introduce two tools I used in the exercise. The first is the VMWare Disk Manager tool (vmware-vdiskmanager.exe). This virtual disk manager is included in the VMWare Server installation package.

According to VMWare Server Online Library:

VMWare Virtual Disk Manager is a utility in VMWare Server that lets you create, manage, and modify virtual disk files from the command line or within scripts.

One key feature is the ability to enlarge a virtual disk so its maximum capacity is larger than it was when you created it. This way, if you find you need more disk space on a given virtual disk, but do not want to add another virtual disk or use ghosting software to transfer the data on a virtual disk to a larger virtual disk, you can simply change the maximum size of the disk. This is something you cannot do with physical hard drives.

Haaa.. How many of you realized that you can indeed enlarge a virtual disk size. I never knew that. All this while, whenever I needed to increase the size of a VMWare virtual disk, I would either recreate the disk or add another disk and extend it within Windows. This time, however, I decided to venture into the unknown territory.

The second tool I used is available in Windows itself. It’s called Diskpart.exe. What is Diskpart?

You can use the Diskpart.exe utility to manage disks, partitions, and volumes from a command-line interface. You can use Diskpart.exe on both Basic disks and Dynamic disks. If an NTFS volume resides on a hardware RAID 5 container that has the capability of adding space to the container, you can extend the NTFS Volume with Diskpart.exe while the disk remains a Basic disk.

I wanted to see if I can enlarge the virtual disk manually by modifying the virtual disk configuration file itself. So I opened up the disk configuration file (*.vmdk). Mine is called XPPROSP2_Disk01.vmdk. Following is how it looked like at first:

# Disk DescriptorFileversion=1

CID=76347eae
parentCID=ffffffff
createType="twoGbMaxExtentSparse"# Extent description
RW 4192256 SPARSE "XPPROSP2_Disk01-s001.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s002.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s003.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s004.vmdk"
RW 8192 SPARSE "XPPROSP2_Disk01-s005.vmdk"

# The Disk Data Base
#DDB

ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "16383"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.adapterType = "ide"
ddb.toolsVersion = "6535"

The configuration above is for a virtual hard disk 8GB in size, not pre-allocated, and split into 2GB.

For my Vista upgrade, I needed at least a 12GB harddisk. Yes, Vista really has a steep hard disk space requirement. Thus, I needed two additional 2GB virtual disk files in the configuration above. Here is what I did. I modified the virtual disk configuration file:

# Disk DescriptorFileversion=1

CID=76347eae
parentCID=ffffffff
createType="twoGbMaxExtentSparse"# Extent description

RW 4192256 SPARSE "XPPROSP2_Disk01-s001.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s002.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s003.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s004.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s005.vmdk"
RW 4192256 SPARSE "XPPROSP2_Disk01-s006.vmdk"
RW 8192 SPARSE "XPPROSP2_Disk01-s007.vmdk"

# The Disk Data Base
#DDB
ddb.virtualHWVersion = "4"
ddb.geometry.cylinders = "16383"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.adapterType = "ide"
ddb.toolsVersion = "6535"

VMWare Disks ManagementI also created the two files (s005, and s006). How? If any of the s00x files are sized at 320KB, copy and paste it then rename it as required. Why those sized at 320KB? Well, I assume that’s probably the initial size for an empty 2GB disk part of a virtual disk. Don’t believe me? Create a second disk and check out its size. Oh yes, you can also create a second disk and then rename the files created as required in the configuration file above and remove the second disk later.

Once I’ve completed the above, I started up the XP Virtual Machine. Voila! I now have an XP machine with 12GB hard disk, which should allow me to do an OS upgrade to Vista. But before that, I still need to add the new disk space into the existing single partition. I tried running Diskpart.exe from within Windows itself. Diskpart however, is not able to extend a system partition while it’s online.

I thus, had to search for my long lost Hiren CD. Thanks to Hiren and Partition Magic, I’m able to extend the disk without problems. With the virtual disk enlarged and system partition extended, I can then start my Vista upgrade process.

I was later introduced to this interesting article on Diskpart. It shows how to use Diskpart from an NTFS Boot disk (or the Vista CD) to extend a system partition. Read the How to extend your system volume. This could be very useful if you are faced with a hard disk full problem, especially if the disk is the system volume itself.

One hour plus later, (Vista really took its own sweet time in performing the upgrade), I now have a running Vista virtual machine in my physical machine.

I upgraded to Vista Business. After the upgrade, I noticed that Vista does indeed swallow up almost 12GB of data. I’m left with about 1GB worth of disk space in the virtual disk.

I thus, tried out the Shrink Disk utility inside the VMWare Tool Kit. This doesn’t seem to work in Vista. It even suggested that I try running the tool as Administrator, which I already am doing. Since I can’t shrink the disk while it was online, I began searching for a method to shrink the disk offline, manually.

I was then introduced to the VMWare Disk Management utility. This utility allows for virtual disks to be shrunk while the virtual machine is offline. Here are the commands:

VMware Server Path>vmware-mount.exe V: E:VMacsXPPROSP2XPPROSP2.01XPPROSP2_Disk01.vmdk
VMware Server Path>v:

V:>dir
Volume in drive V has no label.
Volume Serial Number is 503C-7517

Directory of V:
19/09/2006  05:43              24 autoexec.bat
19/09/2006  05:43              10 config.sys
03/10/2007  10:09              Downloads
21/09/2008  09:19              Program Files
20/09/2008  23:57              Users
21/09/2008  09:23              Windows
2 File(s)             34 bytes
4 Dir(s)   1,538,777,088 bytes free
V:>c:

VMware Server Path>vmware-vdiskmanager.exe -p V:Using log file vdiskmanager.log
100% wiping done.

VMware Server Path>vmware-mount.exe V: /d
VMware Server Path>vmware-vdiskmanager.exe -k E:VMacsXPPROSP2XPPROSP2.01XPPROSP2_Disk01.vmdk

Using log file C:DOCUME~1ADMINI~1LOCALS~1Tempvmware-Administratorvdiskmanager.log
Shrink: 100% done.

Shrink completed successfully.

In the end, I managed to shrink the virtual disks by about 1GB. Vista really is huge in size. Perhaps there’s a way to install a lean and mean Vista?

There you go. A brief introduction to the usages of the VMWare Disk Manager and Diskpart. If you run a lot of virtual machines on VMWare, you might want to familiarize yourself with the VMWare Disk Manager Tool. It certainly is a life saver when faced with disk sizing issues. For physical machines, Diskpart is certainly worth taking a look at. Both utilities are free too. Isn’t that great?

Grab Them Now!