Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

joraff

macrumors newbie
Original poster
Jul 26, 2010
2
0
Here at work we're experimenting with a different method to deploy Windows to our mac workstations. Part of this is to try and boot the macs into the windows pre boot environment (winpe). So far, we can boot the few models that we have from a CD that we burned through SCCM (from an iso), and also from a USB key that has been formatted from windows (has an MBR-only partition table).

Since srs5694 and murphychris seem to be active in this forum and very knowledgable in hybrid MBRs, I'm hoping they can chime in.

So far this is the progress I've made:

"No bootable device -- insert boot disk and press any key" with the following output from gdisk:

Code:
GPT fdisk (gdisk) version 0.8.4

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): p
Disk /dev/disk0: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 4AE2EB88-3C2F-4BA9-B6B0-F76C96CD9380
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 263637 sectors (128.7 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       842441279   401.5 GiB   AF00  Macintosh HD
   3       842704896       976773119   63.9 GiB    0700  Untitled

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x2912C428
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       409639   primary     0xEE
   2                409640    842441279   primary     0xAF
   3             842704896    976773119   primary     0x0B

And fdisk:

Code:
fdisk: 1> p
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
Offset: 0	Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -     409639] <Unknown ID>
 2: AF 1023 254  63 - 1023 254  63 [    409640 -  842031640] HFS+        
 3: 0B 1023 254  63 - 1023 254  63 [ 842704896 -  134068224] Win95 FAT-32
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused


So, I thought that maybe my MBR was wrong and I tried it a different way (more along the lines of rob's article found here):

Code:
GPT fdisk (gdisk) version 0.8.4

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): o

Disk size is 976773168 sectors (465.8 GiB)
MBR disk identifier: 0x2912C428
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1    842704895   primary     0xEE
   2      *      842704896    976773119   primary     0x0B
   4             976773120    976773167   primary     0x0A





fdisk: 1> p
Disk: /dev/disk0	geometry: 60801/255/63 [976773168 sectors]
Offset: 0	Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -  842704895] <Unknown ID>
*2: 0B 1023 254  63 - 1023 254  63 [ 842704896 -  134068224] Win95 FAT-32
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 0A 1023 254  63 - 1023 254  63 [ 976773120 -         48] OS/2 Bootmgr

and an now getting just a blinking cursor. That's better, I think. Maybe now it just needs the bootloader code. I dd'd the first 440 bytes from my USB flash drive that does boot, but stopped at that. I don't know where to restore that MBR code section for a hybrid MBR.

So, I went on trying some microsoft tools to fix the MBR. From a windows 7 DVD, `bootrec /FixBoot` didn't fix the problem. However, `bootrec /FixMbr` made the windows partition show up in the Mac's EFI (I had to use bless before), but resulted in "Disk Error Press any key to restart". Trying `bootrec /fixboot` again still did not do anything.

So, back into fdisk and gdisk to see what fixmbr did: no difference.

Finally, as a last ditch effort I tried a modified version of gptsync (found here), and it recommended adding another 0xEE in the 4th MBR slot (which I thought would break OS X from booting).

Now, I'm back at "No bootable device -- insert boot disk and press any key".

Interestingly, if I have the WinPE CD or USB flash drive inserted, it automatically fails over to one of those.

What piece to this puzzle am I missing to make this work?
 
Your forgetting the VBR (Volume Boot Record). The MBR transfers control to the first sector of the active partition (a sector is 512 bytes).

BIOS > MBR > VBR > bootmgr > winload.exe > ntfs.sys/ntoskrnl.exe > ect.

I'll post back with instructions.
 
Here are the steps needed to copy WinPE over. Also, if you want I can show you how to manually edit the sectors using a Hex editor to install/edit the MBR/VBR.

Create a Bootable WinPE partition on a Mac.
(This tutorial assumes you have no other Windows partitions on the disk your working with)
.
  1. Run the Boot Camp Assistant and make a Boot Camp partition
    .
  2. Boot into WinPE from your USB or Optical drive
    .
  3. Press "Shift+F10" (Opens a command prompt)
    .
  4. Type "diskpart"
    .
  5. Type "list disk"
    .
  6. Type "select disk N" (N == the disk with the Boot Camp partition)
    .
  7. Type "list partition"
    .
  8. Type "select partition N" (N == Boot Camp partition)
    .
  9. Type "format recommended quick" (Erases and place's a NTFS file system on partition, & writes a Windows VBR)
    .
  10. Type "active" (Make's the selected partition active in the MBR)
    .
  11. Type "list volume"
    .
  12. Note the drive letter of the USB/Optical drive and the volume you wanted to copy WinPE to
    .
  13. Type "exit"
    .
  14. Type "xcopy X:\*.* Y:\ /E /V /W /H /-Y /J" (X == USB/Optical Drive, Y == Destination volume)
    .
  15. Type "wpeutil shutdown" (Quits WinPE and shuts down)


DO NOT delete, create or resize ANY partitions in Diskpart while working with a Hybrid MBR disk.
Also be careful not to format or modify your HFS+ partition.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.