Windows: Writing a new MBR an a USB Drive to boot Windows PE

Hi,

booting operating systems, such as linux live systems or Windows PE based installations (Windows Vista,7,8),  from a USB Drive or Stick is a nice featured.

Unfortunately each writes it own boot code to the MBR (Master boot record). The boot code of Windows PE 2 and later  loads \BOOTMGR, linux is usually loaded with \syslinux.

Well known linux installers like TUXBOOT, the Universal-USB-Installer or UNetBootin do updating the MBR by installing the syslinux bootloader.

To get the  Windows PE MBR back without formating the stick, do the following steps.

  • Look up for a Windows 7 DVD and insert it in your DVD drive. In my example D:
  • Copy the \boot folder of the DVD to a local temporary directory:
    robocopy  /S D:\boot %TEMP%
  • open a command prompt in Administrator mode
  • Change to the directory:
    cd /d %TEMP%\boot

Connect your USB device. On my PC  Drive letter E: is assigned. To restore a Windows PE2 (or later) based MBR execute

bootsect.exe /nt60 e:


Target volumes will be updated with BOOTMGR compatible bootcode.

E: (\\?\Volume{7120ac9a-191c-11e3-b648-003067a44706})

    Successfully updated FAT32 filesystem bootcode.

Bootcode was successfully updated on all targeted volumes.

Now the Drive is prepared. If you want to install an Windows from this drive it is also neccessary that the partition with the installations sources  is set to active. See this example. The USB Drive is disk 1 with 7650MB.


DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
* Disk 0    Online          698 GB      0 B
  Disk 1    Online         7650 MB      0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary           7646 MB  3180 KB

DISKPART> select partition 1

There is no disk selected to set the partition.
Select a disk and try again.

DISKPART> select disk 2

Disk 2 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary           7646 MB  3180 KB

DISKPART> select partition 1

Partition 1 is now the selected partition.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary           7646 MB  3180 KB

DISKPART> active

DiskPart marked the current partition as active.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
* Partition 1    Primary           7646 MB  3180 KB

Now copy the whole content of the Windows 7 DVD to the root of the USB Drive, adjust your BIOS to boot from it  and  the windows installation environment should coming up.

Michael

Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.