Tuesday, 11 August 2009

Mount a VHD within Windows 7 and Server 2008 R2

Ever needed to mount a .vhd file into Windows? No, not many people have. However the other day I found that I couldn't find an .iso file that I had for some software. Then I remember it was in an old virtual machine I no longer used. So I restored the .vhd and .vmc files from a backup and was about to download and install Virtual PC or Virtual Server. However I didn't really want to go through the hassle of setting up and configuring those products just to get a file out. I then remembered that Windows 7 Ultimate includes the ability to run a virtual instance of XP and the ability to boot from a .vhd file. So I decided to take a look in Device Manager and Disk Management to see if there was an option to mount a .vhd file. And there was ! Below are some simple instructions on how to mount and dismount a .vhd file.

Instructions to Mount a vhd:
  1. Open up Disk Management, you can Right-Click on Computer and choose Manage and then select Disk Management to do this.
  2. Right-Click on Disk Management and choose Attach VHD.
  3. Enter the path to the VHD. You can choose to mark it Read-Only as well. Click OK.
  4. The drive will mount and display in Disk Management. You’ll notice the disk icon is also blue to help you distinguish it as a mounted VHD.
Dismount Instructions:
  1. To dismount, Right-Click the disk and select Detach VHD.
  2. You will be given the option to delete the VHD as well, but it is not the default. Click OK to detatch.

This allowed me to just browse to my missing .iso file and simply copy and paste from one drive to another. After finding this I wondered if this feature would be added to Windows Server 2008 R2 as R2 and Windows 7 are meant to share a lot of features. So I checked by 2008 R2 release candidate and I was pleased to find that it has been included.

No comments:

Post a Comment