Freigeben über


Mounting VHDs with Windows 7

In Windows 7 / Windows Server 2008 R2 VHD support is now part of the platform.  This means that you do not need to enable Hyper-V to mount and manipulate virtual hard disks.  You can mount virtual hard disks directly on your Windows 7 / Windows Server 2008 R2 system in two ways.  The first is to use the Disk Management UI:

  1. Open the Start menu
  2. Right click on Computer and select Manage
  3. Expand Storage and click on Disk Management
  4. Click on the Action menu and select Attach VHD
  5. Enter the Location and name of you virtual hard disk (there is a browse button you can use)
  6. Click OK

And you are done - simple!  To unmount the virtual hard disk you just need to right click on Disk entry for the virtual hard disk and select Detach VHD.

The other option is to use diskpart.  To do this you will need to:

  1. Open up an administrative command prompt.
  2. Run diskpart
  3. Type in SELECT VDISK FILE=insert your VHD file path and name here
  4. Type in ATTACH VDISK

When you are done you can unmount the VHD using the DETACH VDISK command under diskpart.

Cheers,
Ben

Comments

  • Anonymous
    February 05, 2009
    Can you boot to the VHD? Or do you need to install Virtual PC to run the image?

  • Anonymous
    February 06, 2009
    You can boot from the VHD, though I haven't tried it myself but have heard it more than once in the videos.

  • Anonymous
    February 06, 2009
    Do you know how to boot from the VHD?

  • Anonymous
    February 06, 2009
    It'd be nice if you added support for mounting ISO files in the same way.

  • Anonymous
    February 06, 2009
    The comment has been removed

  • Anonymous
    February 07, 2009
    Check out a few posts on my blog on how to create VHD boot http://www.ravichaganti.com/blog/?p=333 http://www.ravichaganti.com/blog/?p=317

  • Anonymous
    February 09, 2009
    @Tom I agree that it takes more clicks to attach / detach a VHD using MMC. However, you can very easily add that right click / explorer functionality. Check out http://www.ravichaganti.com/blog/?p=349

  • Anonymous
    February 19, 2009
    Alan Dean - Yes, you can boot off them.  I am plannig to blog about that at some point in the future. Timothy Fries - Yes, I agree. Tom / Ravikanth - You can also still use the Hyper-V APIs to mount VHDs if you are running Windows Server. Cheers, Ben

  • Anonymous
    June 25, 2010
    It works on Windows 7 32-bit, but unfortunately, it does not work on Windows 7 x64. I tried it on two different computers with very fresh installations of Windows 7 Ultimate x64: an attempt to mount a VHD file via Disk Management console results in the error message: "A Virtual Disk Provider for the specified file was not found." Google returns the following article for this error: support.microsoft.com/.../2013544 However, it applies to Windows 2008 Server, not to Windows 7. I tried the registry fix it suggested anyway, but it made no difference. Does anyone know how to solve this problem? Thanks.

  • Anonymous
    July 14, 2010
    What if I want todo the reverse - map a host directory to a drive in the VM? I am sure I could do this in VM 2007 but cannot find how to do this in the new VM.

  • Anonymous
    July 20, 2010
    Andrei Belogortseff - I have it working on two x64 Windows 7 computers, so I do not know why it is not working for you. Adrian Tawse - You need to use disk sharing.  Some details are here: blogs.msdn.com/.../accessing-shared-drives-from-the-command-prompt-under-windows-virtual-pc.aspx Cheers, Ben

  • Anonymous
    October 24, 2014
    Thank you for the info on how to do this! Seems to be the only way to deal with transferring the contents of a Windows 7 backup to a Windows 8 machine.