Pages

Thursday, September 25, 2008

SharePoint VHD Expansion

In my experience, a typical standalone MOSS installation on a Server 2003 machine will use at least 12-14Gb of space, not counting any other add-ons you're using (antivirus, etc). Unfortunately for those of us who use Virtual Server/Virtual PC for SharePoint development purposes, the default drive setup is a fixed-size 16Gb IDE drive, which doesn't leave much wiggle room. If you, like me, saw the 16 gigs during the installation and said "oh, that should be enough", and are now eating your words, this post is for you.

Virtual Server/Virtual PC doesn't have a built-in way to resize .vhd files, but fortunately there are a few options available. Instead of using a somewhat pricey tool like Ghost, there are a few free alternatives. My favorite is appropriately named VhdResizer, and is available here [vmtoolkit.com]. After its installed, just point it at your old .vhd (shut down the vm first) and plug in the name/path of where you want the newer, bigger one. Allocating space for the new drive might take a while (particularly if you're using a slow usb drive). Hang on to your old .vhd, just in case.

After the new .vhd has been created we have to resize the partion to use the additional space. To do this, you'll need to fire up a command prompt and go to your Microsoft Virtual Server\Vhdmount directory. After you get there, use the vhdmount and expand tools and these instructions to resize the partition.

BTW, this applies to any .vhd file, but since most SharePoint devs use virtual environments, I thought I'd add it here to make it easy to find.

A few things to note: If you can't find the command line tools, you might have a older version of Virtual Server. Just upgrade to at least 2005 SP1 and you should find what you need. Also, you might ask why you can't just use dynamically sized disks when you create your VM. The answer is... you can, but they'll be slower. So if you're running your vm's from a portable drive or on a slow laptop hard drive, they'll be reeealy slow. Fixed-size disks will give you a slight speed boost.