Update: The free Gizmo Central allows you to mount VHD files more conveniently.

Avatar
Latest posts by Michael Pietroforte (see all)

The more I play with Windows 7, the more I like it. There are so many tiny improvements that can turn out to be very helpful. One of these features is the ability to attach (mount) VHD (Virtual Hard Disk) files. You might think that you don't need this feature because you don't use one of Microsoft's virtualization solutions (Hyper-V, Virtual PC, Virtual Server). However, there is another reason why the ability to mount a VHD can be useful.

The Windows 7 backup tool, which allows you to create a system image, also uses the VHD format. This backup program was introduced in Windows Vista and has been improved significantly in Windows 7. I have always been wondering why I can't access single files in an entire computer backup. In my opinion, it doesn't make sense to have two kinds of backup jobs, one for my personal files and one for the system. If I already have a copy of all my files, why do I need another backup?

There are ways to mount a VHD image in Vista, though. You can use the VHDMount tool of Virtual Server 2005. This is a very complicated option. Besides, it seems it doesn't work with Vista backup images. I only managed to mount virtual machine VHD images with this method. The second option is to use Virtual PC. You can access Vista system backups this way. Of course, this is also a very cumbersome method, especially if you don't have a Virtual PC VM at hand.

mount-vhd-windows-7 In Windows 7, you can use the Disk Management applet of the Computer Management tool to attach, i.e. mount a VHD file. This also works with Vista's backup images. Disk Management can be accessed by right clicking on "Computer" in the Start Menu and selecting "Manage". In the Action Menu, you will find the "Attach VHD" option. This will mount the VHD file to a drive letter. Of course, it would be even cooler if this could be done from Windows Explorer. That would be a nice feature for Windows 7 SP1.

You can also mount a VHD file in scripts using diskpart: Create a text file with this content:

SELECT VDISK FILE="file path and name of the vhd file"
ATTACH VDISK

To attach the VHD image in a script, you have to use "diskpart -s text file name"

It is also possible to create VHD files with Disk Management. This can be useful if you want to prepare a virtual disk for a VM. After you created the VHD, you have to initialize the disk. For this, you have to right click on "Disk #" (see screenshot). Don't click on the graphical representation of the disk because its context menu doesn't have the initialize disk option. Next, you have to create a "New simple volume". This time you have to right click on the graphical presentation. After you have created the volume, you have to format it.

Subscribe to 4sysops newsletter!

initialize-disk-vhd new-simple-volume-vhd

23 Comments
  1. Avatar
    SLam 15 years ago

    I wonder if you can backup an entire drive to a VHD file, load it onto a VM such as VS 2005 or HyperV and bootup windows. Not the best P2V because drivers will be incompatible in the VM, but it would be interesting.

  2. Avatar

    Yeah, I’ve been wondering this too. I think I will play with the new VHD capabilities of Windows 7 in the coming days and report about it here.

  3. Avatar
    Alex Yeffal 15 years ago

    Hi, each time I restart the computer I need to attach again the VHD, is this normal? Or there is a way that the VHD just stays there with the ther drives?
    Thanks.

  4. Avatar

    Alex, you can use diskpart to mount the VHD in a login script.

  5. Avatar
    Alex Yeffal 15 years ago

    Thanks a lot.

  6. Avatar
    Jm 14 years ago

    I’m uing Windows 7 now and want to restore some files from my Windows Vista Business Backup VHD files. I can not Attach VHD through Disk Management, its giving an error that “The requested operation could not be completed due to a file system limitation”…..
    Can anyone guide me???

  7. Avatar
    Helen 14 years ago

    Hi JM(point no 7)

    I had the same error as you. I have this error because i was trying to create a new vdh on \\vmhost01\e$\myvm instead of pressing broswe selecting vmhost01 then e the myvm -E:\myvm.

    I am doing this from my vista machine running hyper-v manager

  8. Avatar
    Josip Medved 14 years ago

    There is also tool to add attach and detach operations to right-click menu. It can be found at
    http://www.jmedved.com/default.aspx?page=vhdattach

  9. Avatar
    Andrzej Rusztowicz 14 years ago

    You can also use the free 7-zip to open, view and copy contents of VHD volumes. I used it to open VHD stored on volume encrypted with TrueCrypt, because mounting it inside Windows 7 Disk Management caused a bluescreen.

  10. Avatar

    Andrzej, are sure that 7-zip supports VHD? I just tried it and it didn’t work. The documentation doesn’t mention VHD.

  11. Avatar
    Andrzej Rusztowicz 14 years ago

    I am sure I did it last week: http://img266.yfrog.com/i/truecryptvhd7zip.png/ but I did have some unrelated problems (turned out to be my VHD’s fault, not 7zip’s) and next time used Gizmo Drive instead: http://arainia.com/software/gizmo/overview.php?nID=4

    Interestingly, when I tried to use 7zip on a new machine, I failed to find this feature…

    Both programs worked with VHD inside TrueCrypt volume.

  12. Avatar

    Thanks for mentioning Gizmo Drive. This looks like an interesting tool. I might review it soon.

  13. Avatar
    colorzone 14 years ago

    WinMount provides an easiest way to mount VHD as a virtual disk. You can read or write to the vhd file without loading the virtual system.
    Here shows you how to do: http://www.winmount.com/mount_vhd.html

  14. Avatar
    Garry 14 years ago

    Okay, so now that I’ve attached a VHD, how do I detach it? In my case, I have a VHD that I created with the intention of sharing it between various Virtual PCs (WinXP, Linux, Solaris, OpenBSD, etc. – I only run one at a time – some I run with Microsoft Virutal PC, some with Sun’s Virtual Box, some I run with both). The only environment I can’t share it with is with my host Windows 7 environment. I thought, great, now I can attach my shared drive to Windows 7 and share files there too.

    Only thing is, now I can’t startup my Virtual PCs as this VHD is “in use”, and I don’t see how to make Windows 7 “detach” it. Help!

  15. Avatar
    Garry 14 years ago

    VHD Attach by Mr. Medved worked great to detach it.

  16. Avatar
    Dave 13 years ago

    Is this technique useful for backup? Could you image a drive, placing that image on a mapped drive, and mount when needed. I have a laptop that is going down slowly, and I was thinking to image the laptop before losing it entirely, then from a new laptop mount the image when I want to recover something. Is this something I can do?

  17. Avatar
    ariyan 13 years ago

    when i attached VHD file , access denied ,pops up!!!? what should i do ?

  18. Avatar
    gaurav 12 years ago

    if disk managment is not open then how can open

  19. Avatar
    Vincent 12 years ago

    Hello Michael, thanks for the good job. keep it up. I want to know if there’s a way to restore a complete pc back up for Vista. I have seen the mounting .vhd technique but i prefer a total restoration of back up. Unlike XP, you can do back up and completely restore the back up using the back up wizard from system tools. Can you help me on how to completely restore my windows vista back up to its original state. Thank you.

  20. Avatar
    James 12 years ago

    Morning,

    I used to be in IT, admined a colledge campus anf web servers for about 5 years.

    I recently came a cross a problem with a backup and VHD file and never used it before – thank you for the advice on mounting the VHD file it was/is a life saver on the data i got back.

    Rgds,
    James

  21. Avatar
    Coskun 12 years ago

    Can i create,mount and format and image file programatically?

  22. Avatar
    jackPot 8 years ago

    Simple VHD Manager is portable freeware which helps VHD users simplify some of these operations:
    – You can easily create VHD/VHDX files
    – You can attach and detach VHD/VHDX/ISO files via drag and drop
    – You can permanently attach a virtual hard disk in Windows 10 , Windows 8,1 , Windos 8, Windows 7
    – You can easily add and/or remove VHD/VHDX/ISO files to the boot menu

    http://www.sordum.org/8705/simple-vhd-manager-v1-1/

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account