How to install and run Hyper-v Server 2012 R2 on USB


Requirements:

 Note: The following steps work for Hyper-v 2012 R2. You have to use SConfig tool to configure basic Hyper-v settings such as remote administration and networking. When you boot server using this USB stick containing .vhdx file, Setup begins. You can then select preferred option.

How to install Hyper-v Server 2012 R2 on USB

Step1: Install Windows WAIK on a Windows 8 PC

You will see DISM.exe in C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\amd64\DISM

Step2: Extract Windows Server 2012 R2 and copy install.wim file in C:\Win2012R2ISO location

Step3: Create VHDX file

Open elevated command prompt, issue the following command step by step

mkdir c:\Win2012R2

diskpart

create vdisk file=c:\Win2012R2\HYPV2012R2.vhdx maximum=81920 type=fixed

where 81920 is 80GB.

select vdisk file=c:\Win2012R2\ HYPV2012R2.vhdx

attach vdisk

create partition primary

assign letter=r

format quick fs=ntfs label=HYPV2012R2

exit

Step4: Apply install.wim file

Open elevated command prompt, issue the following command step by step

cd /d “c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\<architecture>\DISM” where architecture is amd64 or x86

dism.exe /apply-image /Imagefile: C:\Win2012R2ISO\install.wim /Index:1 /ApplyDir:R:\

Step5: Insert USB stick and create partition

Open elevated command prompt, issue the following command step by step

diskpart

list disk

select disk <USB stick number>

clean

create partition primary

select partition 1

active

format quick fs=ntfs

assign letter=v

exit

Step6: Remove PageFile from Bootable disk

Open elevated command prompt, issue the following command step by step

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

If you receive invalid key error. Simply type regedit and go this location and delete PagingFiles key.

reg unload HKLM\HyperVTemp

Step7: Copy VHDX to USB stick

Say USB stick is presented as V: drive of your PC. Copy the VHDX file from c:\Win2012R2\HYPV2012R2.vhdx to V: drive where the USB stick is attached. Open elevated command prompt, issue the following command step by step

diskpart

list disk

select vdisk file=V:\HYPV2012R2.vhdx

attach vdisk

exit

Step8: Make it bootable

Open elevated command prompt, issue the following command step by step

cd /d ” c:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\<architecture>\BCDBoot”

bootsect /nt60 v: /force /mbr

Use the BCDBoot tool to copy the necessary boot files so that you can boot your USB stick.

bcdboot r:\windows /s v:

Step9: Dettach r:\HYPV2012R2.vhdx

Open elevated command prompt, issue the following command step by step

diskpart

select vdisk file=r:\HYPV2012R2.vhdx

detach vdisk

exit

Step10: Test

Detach USB stick from PC and insert into server. Power on Server. Go to BIOS of the server. Change boot order to USB/ Build in Hypervisor. Save and Exit BIOS. Reboot the server.

Step11: Troubleshooting if required

  • Put the USB in to your server
  • Boot the server using a Hyper-v 2012 R2 DVD
  • Select your language, click Next, then select ‘Repair your computer’
  • Select ‘Command prompt’
    Run ‘bcdedit /enum’, it’s probably still pointing to your .vhdx file (check ‘device’ and ‘osdevice’)
  • Fix this by using bcdedit, I used;
    exe /set {default} device vhd=[C:]\HYPRV2012R2.vhd
    and
    bcdedit.exe /set {default} osdevice vhd=[C:]\HYPRV2012R2.vhd
  • Now remove the Windows dvd and boot from USB.

References http://technet.microsoft.com/en-us/library/ee731893%28WS.10%29.aspx

About Raihan Al-Beruni

My Name is Raihan Al-Beruni. I am working as an Infrastructure Architect in Data Center Technologies in Perth, Western Australia. I have been working on Microsoft technologies for more than 15 years. Other than Microsoft technologies I also work on Citrix validated solution and VMware data center virtualization technologies. I have a Masters degree in E-Commerce. I am certified in Microsoft, VMware, ITIL and EMC. My core focus is on cloud technologies. In my blog I share my knowledge and experience to enrich information technology community as a whole. I hope my contribution through this blog will help someone who wants more information on data center technologies.
This entry was posted in Virtualization and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s