Virtual PC Guy's Blog

-- Ben Armstrong, Virtualization Program Manager

Talking about core virtualization at Microsoft (Hyper-V, Virtual PC and Virtual Server).

Welcome to MSDN Blogs Sign in | Join | Help

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

Published Thursday, February 05, 2009 10:27 PM by Virtual PC Guy

Comments

# re: Mounting VHDs with Windows 7

Can you boot to the VHD? Or do you need to install Virtual PC to run the image?

Friday, February 06, 2009 7:17 AM by Alan Dean

# re: Mounting VHDs with Windows 7

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

Friday, February 06, 2009 10:04 AM by manan

# re: Mounting VHDs with Windows 7

Do you know how to boot from the VHD?

Friday, February 06, 2009 11:31 AM by Alan Dean

# re: Mounting VHDs with Windows 7

It'd be nice if you added support for mounting ISO files in the same way.

Friday, February 06, 2009 12:41 PM by Timothy Fries

# re: Mounting VHDs with Windows 7

It's great that VHD mounting is built-in.  It's unfortunate that it requires more clicks than the old registry hack from Virtual Server 2005.  We really ought to have right-click support in Explorer.

As with the rest of the Disk Management UI that'll never see a refresh, I fear we will be stuck with this limitation for the next twenty years.  Although Microsoft is spending more effort on fit-and-finish these days, this sadly does not extend to management tools that ordinary users won't ever see.  (I mean, geez, how many clicks does it take to change a drive letter?)

Friday, February 06, 2009 2:07 PM by Tom

# re: booting from a VHD

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

Sunday, February 08, 2009 6:55 AM by Ravikanth

# re: Mounting VHDs with Windows 7

@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

Monday, February 09, 2009 8:40 AM by Ravikanth

# re: Mounting VHDs with Windows 7

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

Friday, February 20, 2009 3:44 AM by Virtual PC Guy
New Comments to this post are disabled
 
Page view tracker