Update: The free Gizmo Central allows you to mount VHD files more conveniently.
- OpenVPN IPv6 and IPv4 configuration - Mon, Mar 1 2021
- 4sysops author and member competition 2020 - Fri, Jan 1 2021
- Assign an IPv6 address to an EC2 instance (dual stack) - Tue, Dec 15 2020
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.
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"
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.