Compartir a través de


Walkthrough: Boot Windows PE from a UEFI-based Hard Disk

Applies To: Windows 7, Windows Server 2008 R2

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

This walkthrough describes how to boot Windows® PE directly from a hard disk instead of into a RAM disk. This enables you to start a computer for the purposes of performing deployment and recovery.

These instructions are for a UEFI-based computer with an AMD64 architecture. For instructions for a BIOS-based computer, see Walkthrough: Boot Windows PE from a BIOS-based Hard Disk.

Prerequisites

To complete this walkthrough, you need the following:

How to boot a computer in UEFI mode

Different UEFI firmware implementations support different installation methods. Some EFI platforms support both UEFI and BIOS firmware. On some of those systems, it might be unclear if the default DVD boot option is an EFI or BIOS boot option. On these systems, using the EFI shell command might be required. If you do not specifically start Windows Setup by using the EFI boot entry, the default firmware boot entry for BIOS may be used. If Windows Setup starts in BIOS mode on a combined EFI/BIOS system, the ESP and MSR partitions are not created. After Windows Setup completes, use the Diskpart command to verify that the ESP and MSR partitions were created.

Sample boot instructions

  1. Insert the installation DVD or USB flash drive, and boot the computer.

  2. When the firmware starts to initialize, press the key that opens the UEFI firmware boot device menu, such as Esc.

  3. Select an EFI drive, examples: EFI DVD/CD Drive, EFI USB Drive, or EFI Network Drive. You may be immediately prompted to press a key to boot from the drive to continue.

    The firmware uses the UEFI-specific boot information to boot into either Windows or Windows PE for UEFI.

If the computer does not have a Boot from EFI Drive option

  1. Use the EFI internal shell, as follows:

    1. Start the EFI internal shell from the EFI boot menu and select the drive with the Windows product DVD or Windows PE. The following example assumes that the drive is Fs0:

      Shell> Fs0:
      
    2. Start the EFI boot application. For an x64 system, you might run the following command:

      fs0:> \EFI\BOOT\BOOTX64.EFI
      

      For an Itanium system, you might run the following command:

      Fs0:\EFI\BOOT\BOOTIA64.EFI
      
    3. After the application starts, you might be immediately prompted to press a key to boot from the drive to continue. Press a key to continue booting from the installation media.

    4. After the installation is complete, you can check whether Windows used the EFI boot environment by running Diskpart and verifying that the drive is formatted using the GPT file structure and that the ESP and MSR partitions are present.

Step 1: Create bootable Windows PE RAM media

Select one of topics listed below and follow the instructions for building bootable Windows PE RAM media. Ensure that you include the ImageX tool with your image. After you create your bootable media, continue to the next step.

Step 2: Prepare the hard drive

In this step, you boot the new computer with your Windows PE media and format the hard drive.

  1. On the new computer, insert your Windows PE media and restart the computer.

    Windows PE starts and launches a Command Prompt window.

  2. At a command prompt, format the hard drive by using the DiskPart tool. Windows PE requires an active partition with a size equal to or greater than the size of your Windows PE image.

    The following example shows these commands:

    select disk 0
    clean
    convert GPT
    rem === 1. Create the EFI system partition ===
    create partition EFI size=200
    format quick fs=fat32 label=EFI
    assign letter=S
    rem === 2. Create the Microsoft reserved partition ===
    create partition MSR size=128
    rem === 3. Create the Windows PE partition ===
    rem (The partition size is set to 400 MB, though a smaller partition size may be used.)
    create partition primary size=400
    format quick fs=ntfs label=WinPE
    assign letter=C
    rem === 4. Create a Windows or data partition ===
    rem (This partition fills the rest of the disk.)
    create partition primary
    format quick fs=ntfs label=Windows
    assign letter=W
    list vol 
    exit
    

Step 3: Copy Windows PE files to the hard disk

In this step, you copy Windows PE resource files to the hard drive from your bootable media. This example assumes the hard drive is blank.

  1. If you rebooted the computer, use diskpart to verify and reassign drive letters you assigned in Step 2: Prepare the hard drive.

  2. At a command prompt, copy the \EFI folder from your bootable media to the EFI folder of the EFI system partition on your hard drive, as in the following example:

    xcopy D:\EFI\* S:\EFI\* /cherkyfs
    

    where D is the letter of your bootable Windows PE media, and S is the EFI System Partition.

  3. Copy the \Sources folder from your bootable media to the sources folder of the Windows PE partition on your hard drive, as in the following example:

    xcopy D:\sources\* C:\sources\* /cherkyfs
    
  4. Copy the \Boot\boot.sdi file from your bootable media to the \Sources folder of the Windows PE partition on your hard drive, as in the following example:

    copy D:\boot\boot.sdi C:\sources\
    
  5. Copy all of the files with an .efi extension from the \windows\boot\EFI folder of the Windows PE RAM disk to the \EFI\Microsoft\Boot folder of the EFI system partition on your hard drive, as in the following example:

    copy D:\windows\boot\EFI\*.efi S:\EFI\Microsoft\Boot\*
    
  6. Delete the boot configuration data (BCD) file that you copied from your bootable media. Note that you will create a new one in the next step, as in the following example,

    del S:\EFI\Microsoft\Boot\BCD /f
    

Step 4: Configure the System Store

In this step, you will create and configure a new system store by using the BCDEdit tool. The system store is a file named BCD that holds information required to load Windows or other boot applications. BCD replaces Boot.ini.

BCDEdit is a command-line tool that is designed to manage system stores. BCDEdit is available in Windows PE and Windows® 7.

  1. Create a new system store, as in the following example:

    bcdedit -createstore S:\EFI\Microsoft\Boot\BCD
    
  2. Create new entries in the system store for bootmgr, globalsettings, dbgsettings, ramdiskoptions, and Windows PE.

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {bootmgr} /d "Boot Manager"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {globalsettings} /d "globalsettings"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {dbgsettings} /d "debugsettings"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create {ramdiskoptions} /d "ramdiskoptions"
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -create /d "Windows PE" -application osloader
    

Note

The last command returns a GUID value for Windows PE store.

  1. Set the default entry that the boot manager selects when the timeout expires. Substitute <GUID> with the GUID value for the Windows PE store in the following example:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD /default <GUID from Windows PE store>
    
  2. Run the following commands to configure bootmgr:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} device partition=s:
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} path \EFI\Microsoft\Boot\bootmgfw.efi
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} locale en-us
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {bootmgr} timeout 10
    
  3. Run the following commands to configure the boot loader:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} device ramdisk=[C:]\sources\boot.wim,{ramdiskoptions}
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} path \windows\system32\winload.efi
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} osdevice ramdisk=[C:]\sources\boot.wim,{ramdiskoptions} 
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} systemroot \windows
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} winpe yes
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} nx optin
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {Default} detecthal yes
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -displayorder {Default} -addfirst
    
  4. Run the following commands to configure dbgsettings:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} debugtype Serial
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} debugport 1
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {dbgsettings} baudrate 115200
    
  5. Run the following commands to configure ramdiskoptions:

    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {ramdiskoptions} ramdisksdidevice partition=C: 
    bcdedit -store S:\EFI\Microsoft\Boot\BCD -set {ramdiskoptions} ramdisksdipath \sources\boot.sdi
    

Your computer is now ready to boot Windows PE directly from the hard disk.

See Also

Concepts

Walkthrough: Boot Windows PE from a BIOS-based Hard Disk