VHDMount without VHDMount


To mount a VHD file onto your file system, you either ran some very complicated VB (or PowerShell) Script or you used VHDMount.exe that came with Virtual Server.  If you’re running Windows 7 (or Windows Server 2008 R2), you can now use Diskpart.

So, from an elevated command prompt, run Diskpart.

Select the VHD in question:

sel vdisk file="c:\users\daven\desktop\xp professional.vhd"

Then attach it to your system:

attach vdisk

image 

That’s it.  Pretty easy.

Dave


Share this post : Technet! del.icio.us it! digg it! live it! reddit! technorati!

Comments (22)

  1. Anonymous says:

    I can only agree with you Joe – I’ve been asking for the same thing for years…

  2. Anonymous says:

    In "disk management" look at "actions->more actions" – you can do the same thing with the GUI! – I am on Win7 build 7000, still – I suppose it is still there on newer builds too!

  3. Anonymous says:

    take a look at Portlock SMART Suite for windows.  No installation required. allows you to mount an ISO with a program called Portlock Drive Explorer. I had no problems accomplishing this on Win 7. Theres a free trial for download

  4. Joe says:

    Now if they would just include a built-in ISO mount utility with Windows 7.

  5. Aidan Finn says:

    Dave,

    Can you mount differencing disks with this?

    Yeah, I know, I should get 2008 R2 up and running.  Will do _soon_.

    Aidan.

  6. Nicolas Levi says:

    Thank you Soooooooo Much for this tip

    Gotta Love Diskpart!

  7. Dave says:

    Way cool – thanks for this Dave!

  8. Sean says:

    Nice one Dave, however it looks like it does not support RAW or EFS filesystems which I believe Vhdmount did.  Bummer

  9. Marco says:

    Hi,

    did you have heard about Gizmo drive?

    It does many of the things that you are discussing here.

    It’s a very handy tool and it’s free.

    http://arainia.com/software/gizmo/overview.php?nID=4

  10. marcin says:

    How to make .bat file to attach vhd every time I boot a system?

  11. ML49448 says:

    This post reminds me why I love the internet-thanks a million.

  12. Redguy says:

    Thanks a lot! Saved me lots of time 🙂

  13. bartman2589 says:

    Joe (& others) you may want to check out ImDisk for working with disk virtual drives,  not sure if it works with Windows 7 or not, but it allows you to mount ISO image files and other ‘raw’ image files (.bin, .ima, .img, .dsk & more) as virtual drives using
    the right click context menu, it handles raw images produced from entire physical drives or just images produced from individual partitions (FAT/FAT12/FAT32/NTFS possibly a few more not surethough).  You can get it here:

    http://www.ltr-data.se/opencode.html#ImDisk

  14. Ryan Cheesman says:

    You don’t need to do it this way at all!  It is super easy to do using diskmgmt.msc or through manage computer –> disk management.  Once the console is finished loading, click the Action menu, choose Attach VHD, browse to your vhd file and viola!

    You may need to initialize the disk after it mounts.

    See, super easy!

  15. Mark Solomon says:

    Thanks for the article and the comments–command line and diskmgmt.msc–Yea…

    And for the ISO comment. I use 7-zip. It now extracts ISOs, runs x86, x64, etc. And it has always compresse better than Winzip. Plus you can run the command line version on your servers without an install.

  16. Matias says:

    quisiera saber como desinstalar mi vhd en windows 7 lo elimine y ahora no lo puedo encontrar para sacarlo no me di cuenta me ayudarian gracias

  17. GC says:

    Man, this is awesome! thanks!

  18. walld says:

    For read-only mounts of dynamic VHDs on XP:

    http://www.youtube.com/watch?v=_2xhl_WBzRI

  19. NickoF says:

    That’s really helpful – thank you!

  20. Jonny Hotchkiss says:

    some good suggestions here…. no-one’s mentioned ‘vhd attach’ (yet!)

    re kb 973282

    ‘Although VHDs appear when you click the Safely Remove Hardware option, you must use the Disk Management Microsoft Management Console (MMC) snap-in to detach VHDs.’

    First thing is fix safely remove for VHD’s – http://goo.gl/yUoUJX

    (This is to remove vhd’s from ‘safely remove list’) – additionally (for better identification in devmgmt.msc) FriendlyName can be amended using same process

    VHD Attach is nice because it works. It works faster than diskpart.

    I’m running win 7 native virtualization – I have a DAW, a playground for tweaking away, and a power station for all my MM needs – no dev.station yet.

    All builds are self contained VHDs. Sleep still supported. backup is a simply filecopy!

    Re portable apps, I store these in a localbigstore.vhd (250gb).

    The challenge is loading this BEFORE the kernel!!!

    VHD Attach performs well (as I’ve said)…

    One thing I’d LOVE TO KNOW … VHD ATTACH options include adding a ‘detach drive’ context for drives.

    It’s great (you don’t have to hunt the vhd down, you just interact with the ‘shell objects’ in my comp…

    ALAS!! the detach drive context menu entry is for all drives… this is an obvious no no…

    solutions more than welcome, alas highly unlikely.

  21. Kris says:

    Can you attach the disk as Read only? I’m sure you can, I’ll go and have a look…

  22. jonny says:

    Kris, yes! sure you already know, simply append ‘readonly’ in the attach comand, eg ‘attach vdisk readonly’