製作可以運行Hyper-V Server的U盤

Windows 8 有了 Windows To Go 功能。其實也可以在U盤中安裝並運行Hyper-V Server. 方便攜帶,輕鬆在任何一臺服務器上運行Hyper-V Server.

 

準備工作:

1.       一個至少8G 大小的U盤。

2.       下載並安裝Windows Automated Installation Kit (WAIK) for Windows 7

3.     Microsoft Hyper-V Server 2012 鏡像文件。打開鏡像文件,把Insatll.wim 文件拷貝到本地文件夾。

 

具體步驟:

 

    1. 以管理員權限運行命令行,在C盤創建一個名爲hypervboot的文件夾,並且在次文件夾裏創建一個大小爲6Gvhd文件,命名爲hyperv.vhd. 掛載這個vhd文件,創建分區,盤符爲v.

mkdir c:\hvboot

diskpart

create vdisk file=c:\hvboot\hyperV.vhd maximum=6000 type=fixed

select vdisk file=c:\hvboot\hyperV.vhd

attach vdisk

create partition primary

assign letter=v

format quick fs=ntfs label=hyperV

exit

 

 

 

 

2.       然後用ImageX install.wim 文件的映像部署到掛載的V盤上。

 

cd /d "c:\program files\Windows AIK\tools\AMD64\"

imagex /apply <path to wim> 1 v:\

 

(<path to wim> install.wim 的本地路徑,我的是 c:\hypervboot\install.wim)

 

 

3.       然後停止掛載V盤,並且插入U盤,用Diskpart 格式化U盤並分區,盤符爲Z

 

 

diskpart

select vdisk file=c:\hvboot\hyperV.vhd

detach vdisk

 

list disk

select disk <USB stick number>

clean

create partition primary

select partition 1

active

format quick fs=ntfs

assign letter=z

exit

 

 

 

4.       hyperv.vhd 文件拷貝到U(Z)中。

5.       Bootsect 工具更新master boot code

              

               cd /d "c:\program files\Windows AIK\tools\PETools\amd32\"

               bootsect /nt60 z: /force /mbr

 

              

              

6.       DiskPart 工具掛載Z盤裏的hyperv.vhd文件。

 

diskpart

select vdisk file=z:\HyperV.vhd

attach vdisk

exit

 

 

7.       BCDBoot 工具 從掛載的V盤裏拷貝必要的啓動文件到U盤(Z盤)

 

bcdboot v:\windows /s z:

 

 

 

8.       禁止頁面文件。因爲在U盤中運行,空間所限,所以需要禁止頁面文件。可以用命令行修改註冊表。

 

               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

 

 

9.       停止裝載U盤(Z盤)

 

diskpart

select vdisk file=z:\hyperV.vhd

detach vdisk

exit

 

 

 

        現在可以運行Hyper-V Server 的U盤就已經製作好了。我們可以將U盤插入服務器然後選擇從U盤啓動。第一次啓動會有一些基本配置,設置密碼。因爲是Server Core版本,所以我們還可以啓用遠程管理,來在Windows 8 中的Hyper-V Manager 裏管理這臺Hyper-V服務器。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章