Saturday, June 12, 2010

Mount a .VHD file in Windows 7 and 2008 R2

In one of my earlier blog post here I went through an easy way to convert a physical machine to VHD without downtime that can be attached to a Virtual Machine running on Virtual PC or Hyper-V. Today we will see how we can mount or attach the same VHD on a system running Windows 7 or Windows 2008 R2 without any virtualization software.

First open Disk Management by right clicking on computer and selecting manage or type diskmgmt.msc in run window or command prompt or powershell.

Disk2vhd-5 - Copy
Navigate to Disk Management and right click on it and select Attach VHD, above screenshot for reference. This will popup a window asking to browse for the VHD location.

As you can see from the screenshot below there is a check box as Read-only. If this box is checked, the VHD file will open in read-only mode so that we can not modify anything on VHD. If unchecked we will be able to write/delete/modify files and folders on the VHD.

Disk2vhd-6

Click  browse and navigate to the location of VHD and select the VHD. In my case its on my external USB hard disk.

Disk2vhd-7

After selecting the VHD click Open and then on OK.

Disk2vhd-8

This will pop up a driver installation balloon at the notification area on the task bar as shown below.

Disk2vhd-9

After the driver gets installed successfully the VHD is mounted as disk in the disk management console as shown in below screenshot.

Disk2vhd-10

Open up computer and you can see the partitions or drives on VHD. Drives K and L in my below screenshot are from the VHD which actually is on drive J, my USB hard disk. Notice greenish disk icons for VHDs.

image

Remember, we mounted VHD in Read-only mode. Now if we try to add, modify or copy any file to these drives we are presented with the below window.

image

Now let us dismount or detach VHD. To do this, again navigate to the disk management MMC, right click on the disk and select Detach VHD, screenshot below for reference.

Disk2vhd-11

This would pop up a window where we can also select to delete the VHD from disk by simply checking the checkbox.

image

Select the appropriate option for you and click OK. This will be of great help when we need to copy some files from VHDs of virtual machines which are switched off or VHDs from P2V conversion which are unable to boot etc.

Hope this was informative.

Click here for P2V conversion blog post

Click here to Save this Page as PDF

1 comment:

Share what you feel