Virtualization

5 excellent uses of Windows 8 Hyper-V

Use Windows 8 Hyper-V to migrate an OS from a physical machine

Another nifty use of Client Hyper-V is to run a virtual machine made from a copy of another physical machine's hard drive. This is handy if the system in question is suffering from hardware problems or otherwise needs to be retired from service, but the instance of the OS on it still needs to be running in some form.

That said, Client Hyper-V can't perform this kind of migration by itself. Microsoft engineers Mark Russinovich and Bryce Cogswell (of Sysinternals fame) created a tool called Disk2vhd to bridge the gap. When run on a given Windows system (Windows XP SP2 and later), Disk2vhd polls all the available physical drives in the system and lets you create an image from them. You can even convert a currently running system drive, since Disk2vhd uses Windows' own Volume Snapshot technology to accomplish this.

Two details are worth noting here. First, the virtual machine you create should match the hardware specifications of the original whenever possible. Otherwise, when you boot the VHD for the first time, the guest OS may detect major hardware changes and respond accordingly, including triggering the need to reactivate Windows.

Second, note that due to licensing, you can't transfer an OEM-licensed copy of Windows to a virtual machine from a physical machine for production use. You can, however, do this with systems that have a full retail Windows license or a copy of Windows courtesy of Software Assurance.

The Disk2vhd tool generates VHD images from a hard drive, even one with a running instance of Windows on it. Use Disk2vhd to migrate physical machines; just remember the limitations of any licensing agreements.

Use Windows 8 Hyper-V to boot from a VHD

Booting from a VHD is exactly what it sounds like: You can install a VHD as if it were a boot volume and boot the entire host system directly to it.

Strictly speaking, this isn't a Client Hyper-V feature, but a trick that's been possible in Windows since Windows 7. It's worth mentioning here, since working with VHDs in Client Hyper-V may give you a reason to pull this stunt as well. It comes in especially handy if you want to run the guest with as few performance issues as possible without actually installing the guest OS (although even they have their limitations). It's also handy because the whole thing can be undone just as easily, with no side effects and no dangerous mucking around with partition tables.

Setting up a VHD as a boot volume is a two-stage process. First, you need to attach the VHD through the Disk Management console's menu (Action | Attach VHD) so that it shows up as a drive in the console. Second, you need to add a system boot entry for the VHD via BCDEDIT or a similar tool. Dan Stolts of TechNet has created a handy batch file to automate the process and to make it harder to mess up your boot entries to begin with.

Again, as with an OS migration from a physical machine, any differences in the hardware setup for the VHD's VM and your physical computer will be detected by the VM.

You can use the Disk Management tool in Windows 8 (or Windows 7) to attach a VHD as if it were a native hard drive. This is the first step toward making it a bootable volume.

Subscribe to the Business Brief Newsletter

Comments