Handy Backdoor Tricks for Mounting Hyper-V VHDs
I’ve always been a fan of learning a new thing as it specifically solves a problem for me. One example was learning the netsh command so that I could easily turn off Windows Firewall, which it’s a good idea for troubleshooting reasons to remember this command: netsh advfirewall set allprofiles state off
Much like netsh, I’ve taken a somewhat renaissance look at mounting .VHD files within Windows (both Windows Server and Client editions). The VHD disk format, as well as it’s big brother VHDX, are the virtual disk format for Hyper-V. The good news is that the VHD format can easily be used inside Windows for use cases that don’t always have to be running Hyper-V. Here’s a quick roundup of 5 VHD use cases you may not that thought of:
1. Look at an Old Computer
Whether it is a server or client system; getting the old file system onto a VHD format can be a great way to hold onto the contents of a system or drive in a portable fashion. With removable media today now in the multi-terabyte range; virtually any computer can fit on inexpensive removable media.
2. Transport a De-duplicated Volume
While we can get large storage, that doesn’t mean large files are easy to move around. Windows Server 2012 introduced volume deduplication, did you know that once that volume (VHD) has been deduplicated – it’s still portable? That just saved a bunch of time on the copy to a USB drive for subsequent mount or adding to a remote Hyper-V virtual machine.
3. Mixed Realms of Virtualization Solved
If you have a mix of both VMware and Hyper-V virtual machines, one way to get data from one environment to the other may involve picking up a VHD and putting it on a VMware VM for mounting inside the guest operating system.
4. Accessing Archive VHDs? Consider Doing this Read-Only
The read-only option on mounting VHD files can really implement a safeguard. While this functionality is quite easy and powerful, it also runs the risk of introducing corruption of an archive. The read-only option is set below in Figure 1:
Figure 1 – Attaching a VHD in Windows Server 2012 Hyper-V
5. Mount VHDs through PowerShell
The Mount-VHD cmdlet may be a great way to leverage some scripts and portability for your system administration habits. This cmdlet is documented in the TechNet library as well. If you’ve not moved this task to PowerShell, you really should. Using diskpart to do this before was just painful. See what I mean in this TechNet blog posting.
The VHD and VHDX disk formats are truly a great portable file system, and they are wonderful to use for Hyper-V VMs, especially if you switch between Hyper-V running on Windows Server 2012, Windows Server 2008 R2 and Windows 8. What ways have you mounted VHD files? Share your experience below.