Sizing correctly a virtual hard disk (VHD) during the creation of a virtual machine is not really easy. Well, it is possible to see big and to set the maximum size at 100GB, but I am not a great fan of always oversize an infrastructure.
So, it happened yesterday that my virtual machine hosting my SharePoint 2007 development environment was running out of disk space and the question on how to resize a vhd file came to my mind. My friend google gave me a lot of answers but none of them were working totally. Basically, you have several steps to follow :
For the first step, there are essentially two main choices : VHD Resizer, which is free and available on the vmTools web site, or VHD Utility from Xtralogic. I decided to go for the VHD Resizer tool and I was quite happy with that. The main reason was that I wanted to expand my VHD at the lowest price...(at the end, it costed me a bit...)
Regarding the second step, it was another story. On the web, there are a lot (and when I say "a lot", I really mean a lot) of tools, free or not, to manage partitions and disks. To give some examples, you have Partition Magic, gParted and Paragon Partition Manager to give only the few I tested. Then, you can also use diskpart or even vhdmount to manipulate the drives and expand them.
gParted is free and you can download a live CD in the ISO format that allows you to mount the drive directly from the Virtual PC application. Unfortunately, it did not work for me, Windows Server was not able to see the new disk size.
The same problem occurred with Partition Magic.
At last, I have given a try to Partition Manager 9.0 Server. It costs $299 and it is quite expensive, but when I realized that I had spent already more than half a day to solve this resizing problem, I rapidly decided to go with that tool. Then only problem I see with that kind of product is that you cannot really test if copying a hard disk (especially a Windows Server 2003 boot disk) works, because most of these tools (it was the case for PM 9.0) works only in simulation mode if you have only the trial version. So, spending 299 dollars without really knowing if it will fit the needs is a bit worrying.
Then, using PM 9.0, I copied my original hard disk to the target one, I resized the partition to take the whole disk and.......it worked perfectly. It took 1 hour to copy everything and to make the partition bootable for a 40GB disk. Windows Server 2003 was not only able to see the new disk capacity, but the disk was bootable.
Again, I would have preferred to do it using free tools, but with PM 9.0 Server (the server version is important here, because Windows Server 2003 is supported) I did it end-to-end with success.
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.