Category Archives: Hyper-V

Boot 2012r2 from USB

Windows Server 2012r2 introduced tiered storage spaces. Storage spaces works best when you have shelves of JBOD HDD and SSD, but there are also benefits for smaller deployments for servers with 6+ disk slots. There is however an issue that Windows cannot boot from a storage space, therefore you would need to dedicate at least one disk slot for a boot disk, there is a solution for this issue. Since Windows Server 2008r2, Windows has had the capability of boot (and run, as opposed to boot and install) from a UFD (USB Flash Drive). This then allows for example, a six disk slot server, to have two SSDs and four HDDs in a two way mirrored Tiered Storage Space, ideal for a lab Hyper-V server.

There are some downsides, a UFD in a USB2 port is not as fast as a SSD on a SAS/SATA port, however for the use case, an increased boot time might not be an issue. Also there is no redundancy in a single UFD, however there are no moving parts. If the UFD is suitably sized, the wear leveling of the UFD should provide a reasonable lifespan. Microsoft suggested a 16GB UFD for 2008r2, I would suggest a 64GB UFD.

Following on from the Microsoft information, I used a Kingston DataTraveler Ultimate 64 GB UFD.

The Microsoft instructions for 2008r2 use a .vhd file, but it is possible to use a .vhdx with only a few small changes.

Install the Windows 8.1 ADK on a suitable computer. As I don’t use Windows 8 or 8.1, I used a 2012r2 server.

Either mount a 2012r2 ISO, or extract the the install.wim, I have presumed that an ISO has been mounted to E:

From an elevated command prompt

diskpart 
list disk
select disk <USB disk number>
clean
create partition primary
active
format quick fs=ntfs 
assign letter=v

The letter isn’t important, just something that doesn’t conflict with existing drive letters

I am quite happy with multiple command windows open and switching between them, so open another elevated command prompt.

mkdir c:\HYPERV2012r2
diskpart
create vdisk file=c:\HYPERV2012r2\HYPERV2012r2.vhdx maximum=20480 type=fixed
select vdisk file=c:\HYPERV2012r2\HYPERV2012r2.vhdx
attach vdisk
create partition primary
format quick fs=ntfs label=HYPERV2012r2
assign letter=r

Again, the letter isn’t important, just something that doesn’t conflict.

To “build” the OS in the mounted .vhdx, open an elevated Deployment and Imaging Tools environment prompt. This will open in C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\

cd amd64\DISM
dism.exe /apply-image /Imagefile:E:\sources\install.wim /Index:1 /ApplyDir:R:\

When booting and running from USB with a core install, a page file should not be required, and for maximum life of the UFD, you should not use a page file on the UFD, the following disables the page file.

reg load HKLM\HyperVTemp r:\windows\system32\config\system
reg add "HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "" /f
reg delete "HKLM\HyperVTemp\ControlSet001\Control\Session Manager\Memory Management" /v ExistingPageFiles /f
reg unload HKLM\HyperVTemp

Now return to the diskpart window, and unmount the .vhdx

select vdisk file=c:\HYPERV2012r2\HYPERV2012r2.vhdx
detach vdisk

and copy the .vhdx to the UFD

copy c:\HYPERV2012r2\HYPERV2012r2.vhdx v:\

Now mount the .vhdx on the UFD

mkdir c:\HYPERV2012r2
select vdisk file=v:\HYPERV2012r2.vhdx
attach vdisk

Create a boot sector.

cd ..\BCDBoot
bootsect /nt60 v: /force /mbr

And create a BCD

bcdboot r:\windows /s v:

When the BCD has finished, you should be able to eject the UFD and boot from it. The first boot would be as if you have completed an install where you need to set the Administrator password.