Microsoft's Hyper-V lives comfortably on a USB Flash Drive.
It’s no surprise that Linux-based hypervisors are offered on USB Flash Drives (UFDs), since Citrix’ XenServer and VMware’s ESX/ESXi have ridden the UFD revolution for some time now. It might surprise you, however, to know that Microsoft’s Hyper-V also has the ability to live out its life on a UFD as well. In the battle for virtualization market share, agility and flexibility are paramount considerations. Microsoft knows this. You don’t think that innovation is restricted to open source or Linux-based products only do you?
While most of the applicability of this article is oriented toward a do-it-yourself Hyper-V on UFD, Microsoft supplies similar documentation for OEM companies that supply servers that are pre-installed with Hyper-V using internal UFDs which cannot be removed.
Prerequisites and Requirements
There’s quite a long list of requirements to accomplish installing and using Hyper-V on a UFD. The list is also a bit off-putting in that some of the requirements are too restrictive for the tastes of most Linux aficionados. However, if you’re looking for a Microsoft-based virtualization solution, that supports various Linux distributions as virtual machines, Hyper-V is worth a look. This UFD-based hypervisor is based on Hyper-V R2.
First, you’ll need a quality UFD that is USB 2.0 compatible, which isn’t difficult to locate these days. The recommended capacity for the UFD is 16GB although the actual hypervisor image is about 7GB. An 8GB UFD is the absolute minimum size. Frankly, at capacities exceeding 8GB, you might use (Solid State Drives) SSDs as an alternative for UFDs.
Second, your host machine, onto which you’ll install the UFD, must meet the following requirements for proper operation of Hyper-V R2: Multi-core 64-bit CPUs, CPUs (Intel or AMD) with the virtualization extensions enabled, Data Execution Prevention must be available and enabled, must be able to boot from USB.
Next, you’ll need a Windows 7 or Windows Server 2008 R2 including the Windows OEM Preinstallation Kit (OPK) to be used as your technician computer as Microsoft refers to it. It might be very difficult to obtain the OPK unless you’re a registered OEM partner.
Additionally, you need a Hyper-V Server R2 Windows Image File (.wim) that’s located under the Sources directory on the Windows Server 2008 R2 DVD as Install.wim. For creating a customized image file, refer to the OPK help file. Note that it might be possible to use components from the Windows Automated Installation Kit and the Server Appliance Kit for these same tasks.
And you’ll need a Windows 7 Windows PE Disk which must be customized with the ImageX tool. Refer again to the OPK help file for instructions (Walkthrough: Boot Windows PE from a CDROM).
Finally, you’ll need the UFD connected internally to your motherboard and the removable media bit (RMB) must be set to 0. If you comply with all those requirements, congratulations, you too can install Hyper-V on a UFD. If you can’t comply, you’ll have to wait for an OEM to make one available to you with the purchase of a motherboard or system.
Technician Computer Tasks
The following steps take place on your technician computer which is, as described above, assumed to be a Windows 7 (32 or 64-bit) or Windows Server 2008 R2 system with the additional tools installed. The first step is to create the Hyper-V virtual hard disk file and format it. Perform these steps from the command line (Start->Run->CMD->OK).
- Create the directory for the Hyper-V virtual hard disk file, C:\> md C:\HVVHD.
- Use DiskPart to create the disk file, C:\> DISKPART.
- Create a 12GB disk file, DISKPART> CREATE VDISK FILE=C:\HVVHD\HYPER-V.VHD MAXIMUM=12288 TYPE=FIXED.
- Select the new disk file, DISKPART> SELECT VDISK FILE=C:\HVVHD\HYPER-V.VHD.
- Attach the disk, DISKPART> ATTACH VDISK.
- Partition the disk, DISKPART> CREATE PARTITION PRIMARY
- Assign a Drive letter for the host system, DISKPART> ASSIGN LETTER=R (Or any unused letter).
- Format the virtual hard disk, DISKPART> FORMAT QUICK FS=NTFS LABEL=HYPERV
- Exit DiskPart, DISKPART> EXIT
The Hyper-V Server 2008 R2 Image
This procedure uses the ImageX tool, which is part of the OPK. Perform these steps at a command prompt (Start->Run->CMD->OK).
- CD /D “C:\PROGRAM FILES\WINDOWS OPK\TOOLS\<architecture>\”
Where architecture is x86, AMD64 or IA64.
- IMAGEX /APPLY D:\SOURCES\install.wim 1 R:\
The generic install.wim file is under the sources folder on the Windows Server 2008 R2 DVD and is approximately 2.5GB in size.
- Use DiskPart to detach the virtual hard disk, C:\> DISKPART.
- Select the virtual hard disk, DISKPART> SELECT VDISK FILE=C:\HVVHD\HYPER-V.VHD.
- Detach the disk image, DISKPART> DETACH VDISK.
- Exit DiskPart, DISKPART> EXIT.
Next time, in Part Three of this series, you’ll format the UFD, copy the virtual hard disk file you created to the UFD, create the boot configuration data on the UFD and finish up the whole procedure. By the time you’re done with Part Three, you’ll have a fully bootable Hyper-V system that’s ready to serve up Windows and Linux virtual machines.
Kenneth Hess is a Linux evangelist and freelance technical writer on a variety of open source topics including Linux, SQL, databases, and web services. Ken can be reached via his website at http://www.kenhess.com
. Practical Virtualization Solutions by Kenneth Hess and Amy Newman is available now.