I need to set up a new Hyper-V Server 2012 R2 for testing. However, I don't want to use my existing hard drives to install Hyper-V Server 2012 R2. So, I decided to install it to a USB flash drive.
Goal
Install the Hyper-V Server 2012 R2 to a USB flash drive
Prerequisites
- 1 USB 2.0 or later flash drive with at least 16GB size.
- Operating System: prefer Windows 8 or later (If you are using Windows Server 2012 or Windows Server 2012 R2 to be a technician computer, you need to download and install the "Deployment Tools" of "Windows Assessment and Deployment Kit".
Steps
I'm using Windows Server 2012 to be a technician computer to install Hyper-V Server 2012 R2 to a USB.
Preparing the USB flash drive
1. On a technician computer, log in as Administrator.
2. Insert a USB flash drive to a technician computer.
3. Launch "Command Prompt" as Administrator.
4. Perform "diskpart".
5. Perform "list disk" to show all disks and USB flash drives in this computer.
There are many disks or USB flash drives in this computer.
6. Perform "select disk 8" to select the USB flash drive.
Remark: In my environment, I inserted a 32GB USB flash drive to this computer so I selected "disk 8". In your environment, make sure you select the right USB flash drive.
7. Perform "clean" to clear all things in the USB flash drive.
8. Perform "create partition primary" to create a partition in the USB flash drive.
9. Perform "select partition 1" to select the partition.
10. Perform "active" to make the selected partition as active.
11. Perform "format quick fs=ntfs" to format the partition as NTFS format.
12. Perform "assign letter=z" to assign the drive letter Z for this partition.
Deploying the Hyper-V image to a virtual hard disk
13. Perform "create vdisk file=z:\Hyper-V.vhdx maximum 12288 type=fixed" to create a virtual hard disk with fixed size 12 GB as vhdx file format. By default, the disk image of Hyper-V Server 2012 R2 is about 5 GB.
14. Perform "select vdisk file=z:\Hyper-V.vhdx" to select the virtual disk.
15. Perform "attach vdisk" to attach the virtual disk.
16. Perform "create partition primary" to create a partition in the virtual disk.
17. Perform "assign letter=r" to assign the drive letter R for this partition.
18. Perform "format quick fs=ntfs label=Hyper-V" to format the partition as NTFS format.
19. Perform "exit".
20. Mount the Hyper-V 2012 R2 image or insert the DVD of Hyper-V 2012 R2 image to the DVD-ROM.
21. Back to "Command Prompt", perform "dism /Apply-Image /ImageFile:<Hyper-V install.wim path> /Index:1 /ApplyDir:R:\" to apply the Hyper-V 2012 R2 image to the partition of the virtual disk.
22. Perform "diskpart".
23. Perform "select vdisk file=z:\Hyper-V.vhdx".
24. Perform "detach vdisk".
25. Perform "exit".
Updating the boor code to be compatible with Windows Boot Manager
26. Perform "bootsect /nt60 z: /force /mbr" to update the master boot code on the USB flash drive.
Remark: Because I'm using Windows Server 2012 to be a technician computer, I need to install "Deployment Tools" of "Windows Assessment and Deployment Kit" and then perform "bootsect" from the above path. If you use Windows 8 or Windows 8.1, you might not install the "Deployment Tools" before performing the command.
Creating a boot configuration data on the USB flash drive
27. Perform "diskpart".
28. Perform "select vdisk file=z:\Hyper-V.vhdx".
29. Perform "attach vdisk".
30. Perform "exit".
31. Perform "bcdboot r:\windows /s z:" to create the boot configuration data.
Disable paging (optional)
Because I'm using the USB flash drive, Microsoft suggested disabling paging can greatly reduce wear to the flash device, and extend the useful lifetime of the system. If you use a traditional hard disk drive, you don't need to do the following steps.
I chose to use "Registry Editor" to complete this task.
32. Launch "Registry Editor".
33. Select "HKEY_LOCAL_MACHINE".
34. On the menu, select "Load Hive" to load the registry of Hyper-V Server 2012 R2.
35. Open the "R:\Windows\System32\config\system".
36. Next to "Key Name", type "Hyper-V".
37. Click "OK".
38. Navigate to "HKEY_LOCAL_MACHINE\Hyper-V\ControlSet001\Control\Session Manager\Memory Management".
39. On right pane, double-click "PagingFiles".
40. Clear all values.
41. Click "OK".
42. Right-click "ExistingPageFiles", select "Delete".
43. Navigate to "HKEY_LOCAL_MACHINE\Hyper-V".
44. On the menu, select "Unload Hive".
45. Close "Registry Editor".
46. Back to "Command Prompt", perform "diskpart".
47. Perform "Select vdisk file=z:\Hyper-V.vhdx".
48. Perform "detach vdisk".
49. Perform "exit".
50. Close "Command Prompt".
Reference:
This posting is provided “AS IS” with no warranties, and confers no rights!
Very nice write-up. Easy to follow, and I can confirm that this works as expected.
ReplyDeleteI am trying to do this on an HP server with HP sd card. It does not seem to write the boot files in teh last step.. any suggestions?
ReplyDeleteMicrosoft doesn't mention that Hyper-V server can be installed to a SD card. I'm not sure this case is work.
DeletePlease read the following web site for your information.
http://h20566.www2.hp.com/portal/site/hpsc/template.PAGE/public/kb/docDisplay?javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken&javax.portlet.prp_ba847bafb2a2d782fcbb0710b053ce01=wsrp-navigationalState%3DdocId%253Demr_na-c04095900-1%257CdocLocale%253D%257CcalledBy%253D&javax.portlet.tpst=ba847bafb2a2d782fcbb0710b053ce01&ac.admitted=1403853989013.876444892.199480143
I followed the steps, I have the same issue with Freeman. The files indicated in step 31 doesnt show on command "dir z: /a"
DeleteFor OEM environment, you can follow the HP Intelligent Provisioning User Guide for installing Hyper-V server 2012 R2 to SD card.
Deletehttp://h20565.www2.hp.com/portal/site/hpsc/template.BINARYPORTLET/public/kb/docDisplay/resource.process/?spf_p.tpst=kbDocDisplay_ws_BI&spf_p.rid_kbDocDisplay=docDisplayResURL&javax.portlet.begCacheTok=com.vignette.cachetoken&spf_p.rst_kbDocDisplay=wsrp-resourceState%3DdocId%253Demr_na-c03182305-13%257CdocLocale%253D&javax.portlet.endCacheTok=com.vignette.cachetoken
I'm also having issues with step 31. I believe it is writing efi boot files instead of mbr boot files, as it creates a folder named "EFI". Is there something in the steps that I missed?
ReplyDeleteHi,
DeleteAre you using Windows 8.1 client to prepare USB disk?
If yes, you may need to perform "bcdboot r:\Windows /s z: /f BIOS" to create the mbr boot.
Thanks, I did eventually figure that out!
DeleteI receive a winload.exe error.
ReplyDeleteCan you help me?
Hi,
DeleteCould you please provide more detail for your case?
excellent~
ReplyDeleteHi,
ReplyDeleteThanks for a great article.
Unfortunately for some reason I get the Inaccessible_Boot_Device BSOD error when trying to boot from the USB. Any help would be appreciated?
Thanks
Konrad
Hi,
DeleteCould you provide more details of the BSOD please?
Or, please try to use BlueScreenView to read the mini dump of BSOD to analyze the problem.
I disabled the auto reboot option and enabled the small memory dump file in the registry settings but no dump file was written. It stays at "0% complete" like there's no drive to dump the info onto.
ReplyDeleteI copied the VHD to my local SATA drive running Windows 8.1 and added the Hyper-V VHD to the boot menu and it worked without any problems.
I use Kingston DataTraveler Ultimate G3 32GB USB 3.0 which is recommended by MS http://technet.microsoft.com/en-gb/library/jj733589.aspx.
Sorry for late reply.
DeleteHow about your hardware configuration?
I just tried it on my old Dell Inspiron 1525 and it worked so I'm guessing that's it's something to do with my hardware configuration on my HP Z230 and my iMac.
DeleteSorry for late reply.
DeletePlease update me if you get any update on your case.
This comment has been removed by a blog administrator.
ReplyDeleteIs there going to be enough space on a 16GB USB to patch the server in the future?
ReplyDeleteAlso would this work with a normal Windows Server 2012 w/ Hyper-V role?
1. 16GB may not be enough to patch the Hyper-V Server on USB.
Delete2. There is no official document to support Windows Server 2012 w/ Hyper-V role for this deployment.
Dear Terry
ReplyDeleteJust wanted to let you know that this tutorial is one of the best I've ever seen. I used this to play around with Hyper-V Core on my HP Microserver Gen8, which has an internal USB-Slot (usually used for ESXi deployments). What can I say, this tutorial worked perfectly, except that I had to use for Step 31:
bcdboot r:\Windows /s z: /f BIOS
Additionally, apparently Technical Preview 2 for Server 2016 does NOT WORK on USB-Sticks - probably they failed to set the USB-thingies at boot right, since you get the inaccessible boot media error after putting the OS on the Stick and booting for the first time.
The Technical Preview 3 however is working again!
Thank you for sharing.
DeleteI am also getting winload.exe error.
ReplyDeleteMicroserver Gen8, Hyper-V Server 2012 R2, Sandisk SD
Any help appreciated!
Are you using MBR or UEFI to prepare it?
DeleteIf MBR, please try to perform
bcdboot r:\Windows /s z: /f BIOS
and according to HP Intelligent Provisioning User Guide, it listed the supported SD card for os installation. Please read
http://www.hp.com/ctg/Manual/c03182305
Hi, first things first: thank you so much ! This is the best tutorial or walk-trough in the whole internets.
ReplyDeleteSecondly, I like MVA very much, so sad that they changed the point system to "worthless". i am not active on TechRewards.
The trick in 31. /f BIOS did it for me, btw, and maybe i will go a second time through this whole process and make in step 13 the size a little bigger then 12GB, I read somewhere that for the big updates you could need 40GB, but I suppose that I will try my luck with 32GB. Maybe I will wait till Hyper-V 2016 will not be in Preview anymore.
Anyways, I would like to thank you again.
Have a nice one, Mathew.
Thank you for your comment.
DeleteWould this be possible to run on a desktop? We would like to test on a HP Z640, but are receiving winload.exe error. I would have liked to test on a server, but did not have one available. I have setup on SanDisk Ultra Fit flash drive.
ReplyDeleteHi,
DeleteSorry for my late reply.
I haven't installed on HP Z640. I installed a USB drive for a desktop. Which boot option do you select? Do you change to legacy boot for USB boot in your environment?
No worries.
ReplyDeleteI have both UEFI and Legacy enabled on the HP Z640. The flash drive was setup as UEFI.
Thank you for your assistance and the guide.
Thank you for your update.
DeleteI have experimented more with the BIOS settings and still was unable to boot.
Delete- With UEFI enabled and Legacy disabled, the USB is ignored.
- With UEFI disabled and Legacy enabled, I continue to get teh winlogin.exe error (I made sure to add "/f BIOS" when attempting to boot without UEFI enabled).
Thank you again
Sorry for my late reply.
DeleteDo you have more information and error code for your case? Do you try to use USB 2.0 USB flash and insert to USB 2.0 port for boot testing?