New features in Windows 7 and Windows Server 2008 R2 allow Windows Admins to create, mount, and attach virtual hard disks (VHD). This feature will get a lot of use from Windows admins and it saves us from having to use 3rd party tools to do this. In fact, Microsoft is even offering test drives of their popular enterprise applications (such as Window 7 and Exchange 2010).
Microsoft Virtual Hard Disk (VHD) files have been increasing in popularity along with the popularity of the Microsoft Virtual PC and Server virtualization software solutions. However, with the release of Microsoft Hyper-V and (which uses VHD) files, the use of VHD files really skyrocketed. Windows Admins need to mount VHD files to access files in these virtual disk images. Admins also have the option to create their own VHD images.
Why do you need to mount VHD files?
Like me, most Windows Admins have mounted an ISO file and a ZIP file this month (or even today). You did it because perhaps you needed a driver file from an archive or to install an application.
Unlike ZIP files or ISO files, most Windows Admins use VHD files for their intended purpose – serving as the virtual hard drive for a virtual machine (VM). However, you could use a VHD file for whatever you like when it comes to file storage.
Where do you download VHD files from the Internet?
While the VMware VMDK format is still more popular than the Microsoft VHD format for distributing virtual appliances (see the VMware virtual appliance marketplace to download VMDK files), the VHD format is starting to get a foothold. This is due to Microsoft distributing evaluation / demo virtual machines from their website using the VHD format. Here are some links to site from Microsoft and others where you can download VHD files:
- Run IT on a Virtual Hard Disk – Test Drive Program – offers Windows Server 2008 R2, Windows 7 Enterprise, Exchange Server 2010 and a ton more VHDs available for free download (note that these are all evaluation versions that expire after 180 days)
- Windows 7 90-day eval – while you will likely find this inside the test drive program, I think that this is likely the most useful of all the VHD downloads
- SharePoint Add-ons in VHD Format
How do you create, attach, and mount VHD files in Windows 7?
The great new feature in Windows 7 and Windows Server 2008 R2 is that you can now mount (attach, as they call it) and create Microsoft VHD files. Thus, you do not need any third-party software to do this, as you did in the past.
Attaching and Creating VHD files is done inside the Windows Disk Management console. Most people access this by going into the Computer Management. You access this by right-clicking on My Computer, then click Manage. This brings up the Computer Management MMC console where you can do many different things (task scheduler, event viewer, shared folders, users and groups, performance, device manager, manage services, and, finally, disk management).
To attach or create a VHD, you click on the Action menu.
In Figure 1 you can see how Computer Management was used to access the VHD attaching and creating options.
Figure 1: Creating and Attaching a VHD file in Windows 7 Computer Management
However, the absolute fastest way to get to the VHD attaching and mounting menu is to run the Disk Management MMC directly by just going to the start menu, typing is diskmgmt.msc, and pressing enter (as you see in Figure 2, below).
Figure 2: Running diskmgmt.msc
Of course, you can always attach a VHD that you created in Microsoft Virtual PC or Virtual Server but you can also create your own VHDs inside Windows 7 or Win 2008 R2.
To do this, click in the Create option on the Action menu. You will need to choose as to whether you want to create a fixed or a dynamic VHD file, specify a path, and specify the size of the new virtual disk (as you see in Figure 3).
Figure 3: Creating a new Virtual Disk
When you create the new VHD for the first time, you will see that the Microsoft VHD HBA device driver is being loaded (in Figure 4).
Figure 4: Microsoft VHD HBA driver loaded
This will enable Disk Management to see the new drive but you still need to initialize it, create a new volume, and format it like any other drive. Right-click on the new disk and click to Initialize Disk.
Figure 5: Initializing the VHD Disk
You will be asked if you want to initialize the disk (click OK).
Figure 6: Initializing the Disk
Now, Right-click on the disk again and click New Simple Volume. This will bring up the New Simple Volume Wizard.
Figure 7: Running the new simple volume wizard
In this wizard, you will select the volume size, drive letter, format, and disk block size before you click Finish to complete the wizard.
Figure 8: New Simple Volume Wizard
When done, you will have a new disk volume that looks just like any other physical disk partition.
Figure 9: New VHD Volume created
In fact, I do not see any way to tell that the new volume is a VHD file except for when I right-click on the Disk and see the option to Detach VHD.
Figure 10: Detach VHD File
Attaching a VHD is much easier. Let us say that I detached the VHD file above. To attach it, just go to Action then Attach VHD.
You will be prompted to browse for the VHD file, specify if you want it mounted as read-only, and then you can mount it.
Figure 11: Attach a Virtual Hard Disk (VHD)
From here, you will be right back where you were, as shown in Figure 9.
In summary, thanks to Microsoft directing thousands of people interested in evaluating new Microsoft enterprise applications, the popularity of the VHD file format has grown and grown. Now, with Microsoft including the ability to create, attach, and detach (mount and unmount) VHD files in Windows 7 and Windows Server 2008 R2, I am sure the popularity of the VHD file format will grow and grow.