2013年8月6日 星期二

實作(1-2)項 UEFI/GPT 型硬碟磁碟分割的 windows 8

實作(1-2)項 UEFI/GPT 型硬碟磁碟分割的 windows 8

1. 製作windows 8 開機usb 或 安裝光碟,(必需可以支援 uefi 開機)

2.如果要安裝硬碟為,uefi /gpt 硬碟必需使用uefi 開機模式(usb 或 光碟),因為屆時會使用 bcdboot 指令安裝系統分區。才會正確安裝開機檔。

3.參考微軟指令。製作二個指令集:

   diskpart  -s  GPT_CreatePartitions.txt

   GPT_ApplyImage.bat    \sources\install.wim

4.以下是 GPT_CreatePartitions.txt 的內容說明:

   rem == CreatePartitions-UEFI.txt ==
rem == These commands are used with DiskPart to
rem    create five partitions
rem    for a UEFI/GPT-based computer.
rem    Adjust the partition sizes to fill the drive
rem    as necessary. ==

select disk 0
clean
convert gpt

rem == 1. Windows RE tools partition (Recovery)=====
create partition primary size=300
format quick fs=ntfs label="WindowsRE"
assign letter="T"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001

rem == 2. System partition (ESP)  ===================
create partition efi size=100
rem    ** NOTE: For Advanced Format 4Kn drives,
rem       change this value to size = 260 ** 
format quick fs=fat32 label="ESP"
assign letter="S"

rem == 3. Microsoft Reserved (MSR) partition =======
create partition msr size=128

rem == 4. Windows partition ========================
rem ==    a. Create the Windows partition ==========
create partition primary size=200000
rem ==    c. Prepare the Windows partition ========= 
format quick fs=ntfs label="WindowsOS"
assign letter="W"

rem == 5. Data partition ========================
rem ==    a. Create the DATA partition ==========
create partition primary
rem ==    b. Create space for the recovery image ===
shrink minimum=20000
rem       ** NOTE: Update this size to match the size
rem                of the recovery image           **
rem ==    c. Prepare the Windows partition ========= 
format quick fs=ntfs label="DATA"
assign letter="V"

rem === 6. Recovery image partition ================
create partition primary
format quick fs=ntfs label="RecoveryImage"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
list volume
exit


5.以下是GPT_ApplyImage.bat 的設明:

rem These commands copy the selected image file to
rem predefined hard disk partitions on a UEFI-based computer.

rem Usage:   ApplyImage WimFileName 
rem Example: ApplyImage E:\Images\ThinImage.wim

rem === Copy the image to the recovery image partition =======================
md R:\sources
copy %1 R:\sources\install.wim

rem === Apply the image to the Windows partition =============================
dism /Apply-Image /ImageFile:R:\sources\install.wim /Index:1 /ApplyDir:W:\

rem === Copy the Windows RE Tools to the Windows RE Tools partition ==========
md T:\Recovery\WindowsRE
copy W:\windows\system32\recovery\winre.wim T:\Recovery\WindowsRE\winre.wim

rem === Copy boot files from the Windows partition to the System partition ===
bcdboot W:\Windows /s S:

rem === In the System partition, set the location of the Windows partition ===
rem W:\Windows\System32\reagentc /setosimage /path R:\sources /target W:\Windows /index 1

rem === In the System partition, set the location of the WinRE tools =========
W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows


6. 順利uefi 進入win8 安裝模式 (boot.wim)後

按 shift+F10 進入命令列,執行上述指,重開機,選 windows 開機,完工。