Thursday, February 19, 2009

Mounting a Virtual PC disk image with VHDMount in Vista

As a SharePoint developer, I do a lot of work on Virtual machines. I use VMware occasionally, but I mostly use Virtual PC or Virtual Server from Microsoft. Through the years, I’ve accumulated many, many virtual machine images – hard drives are cheap, so cleanup gets delayed at times.

Recently, I came across a need to get a file off of an existing VHD file for one of my virtual machines. I wondered if there was some kind of voodoo magic that would enable me to simply mount the VHD file on my local host machine without having to spin up the virtual machine to just get at a single file. The Google turned me on to this:

Virtual server contains a command line utility called vhdmount that enables exactly what I want to do. That’s great, if you have virtual server installed. I do have virtual server installed on two different machines in my network, one x86, one x64, but the machine where the VHD file was located only had Virtual PC, and Virtual PC doesn’t come with the vhdmount command.

It turns out, that doesn’t matter – the vhdmount command that works in virtual server can be copied to a machine that has virtual PC installed, and from there it can be used to mount disks just like any machine that has Virtual Server installed. However, there’s an extra step involved…

To get vhdmount working on your Vista machine with only Virtual PC installed, do the following:

  • Copy the vhdmount folder from an existing virtual server installation. It will be located (by default) in c:\Program Files\Microsoft Virtual Server. I’d recommend copying it to c:\Program Files\Microsoft Virtual PC, but it should work from any folder. Be sure to match the bits – if you have x86 vista, copy the files from x86 virtual server.
  • Open up Computer Management (Click the Start Menu, right click “Computer” and select Manage).
  • In the left hand navigation tree, select “Device Manager”
  • From the menu, select “Action >> Add Legacy Hardware”
  • On the Welcome to the Add Hardware Wizard, click Next
  • Select “Install the hardware that I manually select from a list (Advanced) and click Next
  • Leave “Show All Devices” selected and click Next
  • Click “Have Disk”, browse to the Vhdmount folder (C:\Program Files\Microsoft Virtual PC\Vhdmount if you followed my advice earlier – select either INF file, it doesn’t matter), click OK
  • Under Manufacturer, ensure “(Standard system devices)” is selected. Under “Model”, ensure “Microsoft Virtual Server Storage Bus” is selected. Click Next.
  • Click Next to install the hardware. Be patient – it takes a while.
  • Close the wizard when finished.

If all goes well, you’ll get a success message and your new device should be properly installed under System devices in Device Manager.


Now, follow the instructions in the blog mentioned earlier and you should be able to mount a VHD drive in Vista without having to install virtual server.

No comments:

Post a Comment