Deploying Microsoft Hyper-V Server 2008 R2 on USB Flash Drive
Updated: October 18, 2012
Applies To: Microsoft Hyper-V Server 2008 R2
|The scenario described in this document is only supported for original equipment manufacturers (OEM).|
Microsoft Hyper-V Server 2008 R2 and Microsoft Hyper-V Server 2012 support the ability to boot from a USB flash device (UFD). This document describes the policy requirements, hardware requirements, and steps to create and deploy a Hyper-V Server image on an embedded USB flash device (UFD). A Hyper-V Server UFD can provide virtualization capability for servers that ship with no local hard disks, and it offers the same functionality and flexibility as a Hyper-V Server installation on a physical hard-drive. The UFD must be properly formatted, prepared with a generalized Hyper-V Server image, and must have boot files copied onto it to provide an out-of-box virtualization experience for customers. The UFD can then be used to boot Hyper-V Server on any computer which has hardware-assisted virtualization capabilities and is capable of booting from USB.
OEM Policy for Deploying Microsoft Hyper-V Server 2008 R2 on UFD
Original equipment manufacturers (OEMs) may:
Deploy Microsoft Hyper-V Server 2008 R2 on a UFD that is an internal component of the computer, such as an internal hard drive, that will be identified as non-removable by the STORAGE_DEVICE_DESCRIPTOR storage structure.
OEMs may not:
Deploy Microsoft Hyper-V Server 2008 R2 on a UFD that is not an internal component of the computer such as a portable external USB flash drive.
For a detailed licensing description, refer to your product licensing agreement.
Design Hardware for Microsoft Hyper-V Server 2008 R2
This section is intended to give guidance for OEM partners as to the optimal hardware design for a boot from flash solution with Microsoft Hyper-V Server 2008 R2.
Embedded USB Flash Device
The following requirements and recommendations are intended as guidance for optimal hardware design for embedded UFDs.
USB 2.0 compatible
The device must be a standard mass storage device (Class 08h) that is Universal Serial Bus (USB) 2.0 compatible. Note that even though the device is USB 2.0 compatible, it’s write performance can vary significantly and will yield different results when used in this scenario.
The UFD must be a non-removable, internal component built into the server system as described in the "OEM Policy for Deploying Microsoft Hyper-V Server 2008 R2 on UFD" section of this document. The removable-media bit (RMB) in the STORAGE_DEVICE_DESCRIPTOR storage structure corresponding to the device must be set to zero (0) to indicate that it is non-removable media. For more information about setting the RMB, see STORAGE_DEVICE_DESCRIPTOR on MSDN.
16 gigabyte capacity, minimum 8 gigabyte
A minimum of 8 gigabytes (GB) should be used to deploy Hyper-V on a UFD, but 16 GBs is the recommended minimum size of the UFD. While the actual size of the virtual hard disk (VHD) image is significantly smaller than 16 GBs, the additional space is strongly recommended to account for future updates, service packs, and third-party management agents. The additional space will also improve wear-leveling over the lifetime of the server system.
In order to maximize space on the UFD, all language packs that are not required should be removed from the Windows Hyper-V image. Unnecessary language packs take up space and significantly increase the amount of space required during a service pack update. If adequate free space is not available, the update may be blocked.
Language packs can be removed using the OPK or AIK when customizing the master image or during runtime via the Lpksetup.exe tool.
- In order to maximize space on the UFD, all language packs that are not required should be removed from the Windows Hyper-V image. Unnecessary language packs take up space and significantly increase the amount of space required during a service pack update. If adequate free space is not available, the update may be blocked.
Appropriate hardware for expected workload
The flash device should be designed to withstand the operational requirements for server hardware. Specifically, we recommend the use of flash devices which will work correctly over the expected lifetime of 7 to 10 years of continued operation under OEM-profiled conditions. Creating a detailed baseline write profile can be helpful in selecting appropriate flash device and controller combinations. Analysis of write-rates should be performed after system specific drivers and OEM management agents software have been installed. Failure to properly evaluate the flash device for the intended workload may dramatically reduce the useful lifetime of the storage device and negatively impact overall system performance.
For more information about Windows Performance Analysis Tools, see the Windows Performance Analysis Developer Center.
Server running Microsoft Hyper-V Server 2008 R2
The following requirements and recommendations are intended as guidance for optimal hardware design for the server running Microsoft Hyper-V Server 2008 R2.
Microsoft Hyper-V Server 2008 R2 is not supported on x86 processors.
Boot from USB
The platform firmware must support booting from the selected internal USB 2.x port.
A processor with hardware-assisted virtualization is required, such as Intel Virtualization Technology (Intel-VT) or AMD Virtualization (AMD-V). You may also need to enable the virtualization technology in the BIOS. For a complete set of processor and BIOS requirements, please see the Windows Server 2008 R2 Logo requirement documents.
Execute disable bit
Hardware-enforced Data Execution Prevention (DEP) must be available and enabled. Specifically, you must enable the Intel XD bit (execute disable bit) or AMD NX bit (no execute bit).
Dedicated USB Enhanced Host Controller Interface (EHCI)
The USB protocol is designed to share the communication bus among various devices, which does not cause any problems under usual circumstances. However, when a boot device is exposed over USB, it is important to minimize the potential for interruptions to system stability. In order to boot Microsoft Hyper-V Server 2008 R2 from an embedded flash storage device, we recommend you have a dedicated controller. In cases where this is not possible, we strongly recommend that you dedicate a root hub port on the controller for the flash device, keeping all other USB devices away from that port. Do not expose the flash device over a nested hub, as this may result in unreliable system operation.
Note Other configurations may appear to boot and operate normally, but introduce additional risk and will not be supported by Microsoft. Specifically, do not expose the flash device over a nested hub, as this may result in unreliable system operation.
Deploy Hyper-V on a Virtual Hard Disk for Booting from a UFD
The following steps discuss how to deploy Microsoft Hyper-V Server 2008 R2 so that it can be booted from a UFD.
To complete this procedure, you need the following:
A technician computer running Windows 7 or Windows Server 2008 R2.
A technician computer is any computer with the Windows® OEM Preinstallation Kit (Windows OPK) or the Windows Automated Installation Kit (http://go.microsoft.com/fwlink/?LinkId=136976) (Windows AIK) installed on it. The technician computer can have an x86 processor, but any host computer used to run Hyper-V Server on UFD must have an x64 processor.
A Microsoft Hyper-V Server Windows image (.wim) file.
For information about creating a customized .wim file, see Deploy Windows Using ImageX in the Windows OPK User's Guide (opk.chm) or Capture Images on Microsoft TechNet. If no specific customization is required, you may directly use the Install.wim file available in the Sources folder of the Microsoft Hyper-V Server 2008 R2 DVD media.
Note Use a generalized Hyper-V Server image. A specialized image is customized to a specific computer, while a generalized image can be deployed across many computers. For more information about using the specialize and generalize configuration passes to customize and remove information from a Windows image file, see Windows Setup Configuration Passes.
A Windows 7 Windows PE disk.
The Windows PE disk must be customized with the ImageX tool. For more information, see Walkthrough: Boot Windows PE from CD-ROM.
A non-removable UFD.
The size of the UFD must be at least 16 GB, and the removable media bit (RMB) of the device must be set to 0 as described in the Design Hardware for Microsoft Hyper-V Server 2008 R2 section above.
Step 1: Create a VHD
On your technician computer, create a directory for your VHD, and then use the DiskPart tool to create, attach, partition, and format a new virtual hard disk. You can attach a VHD by using the attach vdisk command, which adds the .vhd file as a disk to the storage controller on the host computer. This virtual disk will appear as the R: drive at the end of this procedure. The detach command will stop this virtual disk from appearing on the host. For more information about the DiskPart tool, see the DiskPart Command Reference.
In this example, you create a 12 GB fixed-type VHD. This is the recommended size for a VHD being deployed on a 16 GB USB flash drive. Be sure to leave space available in the VHD for future updates; also, a minimum of 25% of the UFD storage space should by reserved for wear leveling.
Create and configure an empty .vhd file using the DiskPart tool. At a command prompt, type:
mkdir c:\hvvhd diskpart create vdisk file=c:\hvvhd\hyperV.vhd maximum=12288 type=fixed select vdisk file=c:\hvvhd\hyperV.vhd attach vdisk create partition primary assign letter=r format quick fs=ntfs label=hyperV exit
Step 2: Apply a Microsoft Hyper-V Server 2008 R2 image
Use the ImageX tool to apply the .wim file to the primary partition of the VHD. At a command prompt, type:
cd /d "c:\program files\<”Windows OPK”|“Windows AIK”>\tools\<architecture>\" imagex /apply <path to wim> 1 r:\
The VHD partition is now set to
r:\. This partition letter will be used in examples below.
Use the DiskPart tool to detach the virtual disk from you technician computer after applying the image. At a command prompt, type:
diskpart select vdisk file=c:\hvvhd\hyperV.vhd detach vdisk exit
Step 3: Prepare the UFD
Before you can place a Hyper-V VHD on a USB flash drive, you must format it as an NTFS drive.
On the technician computer running a Windows 7 or Windows Server 2008 R2 operating system, insert your USB flash drive.
Use the DiskPart tool to determine which disk number is assigned to the UFD. At a command prompt, type:
diskpart list disk
Use the DiskPart tool to format the device as NTFS spanning the entire device, and create a primary partition. For example:
select disk <UFD disk number> clean create partition primary select partition 1 active format quick fs=ntfs assign letter=z exit
Step 4: Copy files to the UFD
Copy the VHD to the USB flash drive, and update the boot code to be compatible with Windows Boot Manager (Bootmgr).
Copy the VHD file to the USB flash drive. At a command prompt, type:
copy <file path><UFD partition letter>
copy c:\hvvhd\hyperV.vhd z:
Use the Bootsect tool to update the master boot code on the UFD to be compatible with Bootmgr.
cd /d "c:\program files\<”Windows OPK”|“Windows AIK”>\tools\PETools\<architecture>\" bootsect /nt60 <UFD partition letter> /force /mbr
cd /d "c:\program files\<”Windows OPK”|“Windows AIK”>\tools\PETools\amd64" bootsect /nt60 z: /force /mbr
Step 5: Create a BCD store on the UFD
Attach the VHD to the technician computer to create a boot configuration data (BCD) store on the root of the UFD.
Insert the USB on the technician computer.
Use the DiskPart tool to attach the VHD on the USB flash drive. At a command prompt, type:
diskpart select vdisk file=z:\HyperV.vhd attach vdisk exit
Use the BCDboot tool, located in Windows 7 or Windows Server 2008 R2, to copy the boot-environment files from the virtual disk to the root of the UFD. The BCDboot tool will create the BCD store that makes it possible to boot from the virual hard disk. For more information about the BCDboot tool, see BCDboot Command-Line Options.
At the Windows PE command prompt, type:
bcdboot <VHD Partition Letter>\windows /s <UFD Partition Letter>
bcdboot r:\windows /s z:
Step 6: Disable paging
Paging may cause the flash device to wear out sooner. We recommend that paging be disabled prior to deploying the UFD.
Microsoft Hyper-V Server 2008 R2 should be configured with paging disabled during the imaging process, if it will be installed onto a flash storage device rather than a traditional hard disk drive (HDD). Disabling paging can greatly reduce wear to the flash device, and extend the useful lifetime of the system. By default, paging is enabled on Microsoft Hyper-V Server 2008 R2, so it must be explicitly disabled if it is deployed onto a flash device.
Load the registry hive of the attached VHD on the USB flash drive into a temporary hive on the host system. At a command prompt, type:
reg load HKLM\HyperVTemp r:\windows\system32\config\system
Clear the Paging Files value in the registry. At a command prompt, type:
reg add "HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "" /f
Delete the existing Page Files entry. At a command prompt, type:
reg delete "HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management" /v ExistingPageFiles /f
Unload the temporary registry hive. At a command prompt, type:
reg unload HKLM\HyperVTemp
Step 7: Detach the VHD
The UFD can now be detached from the technician computer and deployed to a host server.
Detach the VHD. At a command prompt, type:
diskpart select vdisk file=z:\hyperV.vhd detach vdisk exit
The UFD with Hyper-V Server installed on it can be inserted into any computer with hardware-assisted virtualization capabilities compatible with Hyper-V. You can boot the VHD to a computer already running other operating system installations as an alternative boot option, or as the only operating system on a computer.
|You may need to configure the BIOS on the destination computer to include UFD in the boot order.|
When the computer is restarted, the Boot Manager boots the Hyper-V Server image contained in the .vhd file. Setup begins.
Although Microsoft Hyper-V Server 2008 R2 is built with components of Windows Server 2008 R2, some changes have been made specifically to Microsoft Hyper-V Server 2008 R2 in order to support boot from USB.
Timeout for boot device increase
To ensure that the system can properly boot from a flash device, the default PollBootPartitionTimeout registry key value has been increased. This registry key is used to control how long the kernel waits for PnP to surface the boot disk before it stops with bugcheck code 0x7B. The default setting for Microsoft Hyper-V Server 2008 R2 has been set to 30000, in order to provide more time for flash devices to respond, so no additional action is required for OEM partners. In Windows Server 2008 R2, this key is not populated, and has a much smaller default value determined in the operating-system kernel.
Registry Key: HKLM\SYSTEM\CCS\Control\PnP\PollBootPartitionTimeout
Registry Value: 30000
USB drivers load during boot
To allow the system to load from an embedded USB flash device, the USB drivers are loaded during boot, rather than on demand. This is the default behavior in Microsoft Hyper-V Server 2008 R2, so no additional action is required for OEM partners.
Because Microsoft Hyper-V Server 2008 R2 is built with components of Windows Server 2008 R2, you may refer to the Hyper-V documentation for Windows Server 2008 R2 at Hyper-V Installed Help.