Bx029297

Q: Issues with hybrid mbr and bootcamp partition

HI, i'm trying to install windows 7 via bootcamp on Mac Os x and created 2 additional partitions.

created the bootcamp partition with bootcamp assistant.

Then while bootcamp was partitioning hit the eject key and to eject the windows installation DVD and quit installation

Went to Disk Utility and created 2 more partitions LINUX SWAP and Ubuntu.


so i understand that the gpt side was created but not the mbr


this is the output of sudo gpt -vv -r show /dev/disk0 :


gpt show: disk0: mediasize=320072933376; sectorsize=512; blocks=625142448

gpt show: disk0: PMBR at sector 0

gpt show: disk0: Pri GPT at sector 1

gpt show: disk0: Sec GPT at sector 625142447

      start       size  index  contents

          0          1         PMBR

          1          1         Pri GPT header

          2         32         Pri GPT table

         34          6        

         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

     409640  136718744      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC

  137128384    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

  138397920   11718744      4  GPT part - 48465300-0000-11AA-AA11-00306543ECAC

  150116664     262144        

  150378808  136221984      5  GPT part - 48465300-0000-11AA-AA11-00306543ECAC

  286600792   45156776        

  331757568  293384192      6  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

  625141760        655        

  625142415         32         Sec GPT table

  625142447          1         Sec GPT header

 

how to i create the hybrid mbr before installing windows 7?

Posted on Jul 6, 2014 5:54 AM

Close

Q: Issues with hybrid mbr and bootcamp partition

  • All replies
  • Helpful answers

Page 1 Next
  • by Loner T,

    Loner T Loner T Jul 6, 2014 8:26 AM in response to Bx029297
    Level 7 (24,596 points)
    Safari
    Jul 6, 2014 8:26 AM in response to Bx029297

    Please see Christopher's response in the original thread.

    In the MBR, your first partition will be from 1 through 331757567. The second partition starts at 331757568 .

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Jul 6, 2014 8:47 AM in response to Bx029297
    Level 3 (555 points)
    Jul 6, 2014 8:47 AM in response to Bx029297

    - gdisk

    - recovery menu, with r command

    - create new hybrid mbr, with h command

     

    a. Only specify the number for the Windows GPT partition when asked what to add, so in your case this is 6.

    b. Answer yes to placing the GPT first in the MBR.

    c. Accept the default MBR hex code (just hit return).

    d. Set the boot flag.

     

    Thing is, you really need to install Linux first because the partitioning tool (parted) most often used with Linux distros, is going to alter the GPT because the type codes for partitions 4 and 5 aren't correct right now. So when those get changed, it's going to write out a new GPT, and that will obliterate the hybrid MBR. So I'd install Linux first. Then make the hybrid MBR. Then install Windows.

  • by Bx029297,

    Bx029297 Bx029297 Jul 6, 2014 9:17 AM in response to Christopher Murphy
    Level 1 (0 points)
    Jul 6, 2014 9:17 AM in response to Christopher Murphy

    ok so this is what i have got (note that i only used gdisk after having created my partitions beforehand bootcamp for windows and the 2 others:

     

    sudo gdisk /dev/disk0

     

    GPT fdisk (gdisk) version 0.8.10

     

     

    Warning: Devices opened with shared lock will not have their

    partition table automatically reloaded!

    Partition table scan:

      MBR: protective

      BSD: not present

      APM: not present

      GPT: present

     

     

    Found valid GPT with protective MBR; using GPT.

     

     

    Command (? for help): r

     

    Recovery/transformation command (? for help): h

     

     

    WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,

    just hit the Enter key at the below prompt and your MBR partition table will

    be untouched.

     

     

    Type from one to three GPT partition numbers, separated by spaces, to be

    added to the hybrid MBR, in sequence: 6

    Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y

     

     

    Creating entry for GPT partition #6 (MBR partition #2)

    Enter an MBR hex code (default 07):

    Set the bootable flag? (Y/N): y

     

     

    Unused partition space(s) found. Use one to protect more partitions? (Y/N): n

     

     

    Recovery/transformation command (? for help): o

     

     

    Disk size is 625142448 sectors (298.1 GiB)

    MBR disk identifier: 0x2B60D724

    MBR partitions:

     

     

    Number  Boot  Start Sector   End Sector   Status      Code

       1                     1    333711359   primary     0xEE

       2      *      333711360    625141759   primary     0x07

     

     

    Recovery/transformation command (? for help): p

    Disk /dev/disk0: 625142448 sectors, 298.1 GiB

    Logical sector size: 512 bytes

    Disk identifier (GUID): 93FE0CA4-FF07-4061-8544-41998D935CBB

    Partition table holds up to 128 entries

    First usable sector is 34, last usable sector is 625142414

    Partitions will be aligned on 8-sector boundaries

    Total free space is 524949 sectors (256.3 MiB)

     

     

    Number  Start (sector)    End (sector)  Size       Code  Name

       1              40          409639   200.0 MiB         EF00  EFI System Partition

       2          409640       137128383   65.2 GiB      AF00  Apple_HFS_Untitled_2

       3       137128384       138397919   619.9 MiB  AB00  Recovery HD

       4       138397920       150116663   5.6 GiB      AF00  LINUX SWAP

       5       150378808       333449215   87.3 GiB     AF00  UBUNTU

       6       333711360       625141759   139.0 GiB   0700  BOOTCAMP

     

     

    so i think this is what i should get however i'm just wondering whether the codes (table above) for each names are right:

     

    shouldn't it be 8300 for LINUX Filesystem (UBUNTU) and 8200 for LINUX SWAP or it just doesn't matter?

  • by Bx029297,

    Bx029297 Bx029297 Jul 6, 2014 10:32 AM in response to Christopher Murphy
    Level 1 (0 points)
    Jul 6, 2014 10:32 AM in response to Christopher Murphy

    Although gdisk does show:

     

    GPT fdisk (gdisk) version 0.8.10

     

     

    Warning: Devices opened with shared lock will not have their

    partition table automatically reloaded!

    Partition table scan:

      MBR: hybrid

      BSD: not present

      APM: not present

      GPT: present

     

     

    Found valid GPT with hybrid MBR; using GPT.

     

     

    Command (? for help): p

    Disk /dev/disk0: 625142448 sectors, 298.1 GiB

    Logical sector size: 512 bytes

    Disk identifier (GUID): 93FE0CA4-FF07-4061-8544-41998D935CBB

    Partition table holds up to 128 entries

    First usable sector is 34, last usable sector is 625142414

    Partitions will be aligned on 8-sector boundaries

    Total free space is 524949 sectors (256.3 MiB)

     

     

     

     

    Number  Start (sector)    End (sector)  Size       Code  Name

       1              40          409639   200.0 MiB   EF00  EFI System Partition

       2          409640       137128383   65.2 GiB    AF00  Macintosh HD

       3       137128384       138397919   619.9 MiB   AB00  Recovery HD

       4       138397920       150116663   5.6 GiB     8200  LINUX SWAP

       5       150378808       333449215   87.3 GiB    8300  UBUNTU

       6       333711360       625141759   139.0 GiB   0700  Windows 7

     

    Disk size is 625142448 sectors (298.1 GiB)

    MBR disk identifier: 0x2B60D724

    MBR partitions:

     

     

    Number  Boot  Start Sector   End Sector   Status      Code

       1                     1    333711359   primary     0xEE

       2      *      333711360    625141759   primary     0x07

     

    i still need to start from scratch again, not use bootcamp at all and only gdisk in order to create all my partitions right?

    and obviously follow the same process to create the hybrid MBR?

     

    I start to understand it more and more i think Christopher..

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Jul 6, 2014 10:34 AM in response to Bx029297
    Level 3 (555 points)
    Jul 6, 2014 10:34 AM in response to Bx029297

    shouldn't it be 8300 for LINUX Filesystem (UBUNTU) and 8200 for LINUX SWAP or it just doesn't matter?

     

    If you've already installed Linux, then we've found a bug, because the partition type GUIDs for the two Linux partitions weren't set correctly. Linux ignores type codes, so it's of no consequence to Linux, but any partition type code of AF00 invites OS X to inspect the partition contents, which it won't recognize, and it'll persistently suggest you initialize the partition. So yes the partition type codes should be 8200 and 8300 respectively. I would do this before creating the hybrid MBR, even though in this case the sequence probably doesn't matter.

  • by Loner T,

    Loner T Loner T Jul 6, 2014 10:38 AM in response to Bx029297
    Level 7 (24,596 points)
    Safari
    Jul 6, 2014 10:38 AM in response to Bx029297

    The Linux installation should update the Swap and Ubuntu partitions correctly. As Christopher says

     

    So I'd install Linux first. Then make the hybrid MBR. Then install Windows.


    (Delayed updates from the discussions. )

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Jul 6, 2014 10:38 AM in response to Bx029297
    Level 3 (555 points)
    Jul 6, 2014 10:38 AM in response to Bx029297

    No you don't need to start over. Unlike other tools gdisk shows the whole truth about both partition maps. Short of a bug it's completely reliable. What you have is exactly what you need. So assuming Ubuntu is already installed, your next step is Windows installation. What ought to happen is you'll get something like this in the Windows installer. It will show the MBR #1 partition (which is the GPT, EFI System partition, OS X and Linux partitions combined) as having no free space. It will have selected the 2nd partition which is entirely free. You can just click the next button and it'll format it NTFS and start installation.

     

    Screen Shot 2014-07-05 at 3.14.59 PM.png

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Jul 6, 2014 10:40 AM in response to Christopher Murphy
    Level 3 (555 points)
    Jul 6, 2014 10:40 AM in response to Christopher Murphy

    Oh a small word of warning though. I'm assuming GPT partition 6 for Windows hasn't been formatted.

     

    OS X Boot Camp Assistant likes to format the Boot Camp volume it creates as FAT32. So that needs to be reformatted NTFS in the Windows installer by clicking on Drive options (advanced), selecting the correct partition, and clicking the Format button. Then clicking Next. I haven't tested this recently but it's vaguely possible that the installer will happily install to FAT32 without reformatting it, if it's already FAT32 and you just click Next, and you don't want that. You definitely want to install on NTFS so if you're uncertain, go to Drive options (advanced) and format partition 2.

  • by Loner T,

    Loner T Loner T Jul 6, 2014 10:45 AM in response to Christopher Murphy
    Level 7 (24,596 points)
    Safari
    Jul 6, 2014 10:45 AM in response to Christopher Murphy

    The W7 installer refuses FAT and requires NTFS, but XP will happily install, based on my last test.

  • by Bx029297,

    Bx029297 Bx029297 Jul 6, 2014 10:59 AM in response to Christopher Murphy
    Level 1 (0 points)
    Jul 6, 2014 10:59 AM in response to Christopher Murphy

    Christopher i haven't installed LINUX yet, i'm just a little bit confused with what you said though

    i quote "


    should i first use bootcamp assistant to create my bootcamp partition then create my linux swap and ubuntu partitions then use gdisk to create the hybrid mbr?


    No. Because Boot Camp Assistant will only make GPT and MBR partition #4 for Windows, and that's not what you want. You want Linux in between OS X and Windows last, and Boot Camp Assistant cannot do that for you. "


    but when i just asked you if i had to start over again and not use bootcamp at all you said that i don't need to.


    So my question is can i go ahead and install first linux then windows (which is already formatted as MS DOS (FAT 32) provided that i have already created the hybrid MBR as you can see above


    or


    need it is crucial that i do not use bootcamp to create a bootcamp partition but gdisk instead to create every partitions,

    then install linux

    create hybrid MBR

    and finally install windows 7?


    LONER T, is there a way to convert it beforehand to NTFS?


    ... slowly but surely



  • by Loner T,

    Loner T Loner T Jul 6, 2014 11:59 AM in response to Bx029297
    Level 7 (24,596 points)
    Safari
    Jul 6, 2014 11:59 AM in response to Bx029297

    Bx029297 wrote:


    LONER T, is there a way to convert it beforehand to NTFS?


    My recommendation is to let the Windows Installer convert it.

     

    I will let Christopher comment on this, but the sequence should be

     

    1. Install OS X.

    2. Install Linux.

    3. Ensure the GPT is appropriate with type codes/partition type GUIDs.

    4. Create a Hybrid MBR with GPT #6 as MBR #2. This should be FAT.

    5. Install Windows and choose MBR #2 partition which will be converted from FAT to NTFS. MBR#2 and GPT#6 should be type 07/partition type GUID EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

  • by Christopher Murphy,Solvedanswer

    Christopher Murphy Christopher Murphy Jul 6, 2014 1:45 PM in response to Bx029297
    Level 3 (555 points)
    Jul 6, 2014 1:45 PM in response to Bx029297

    So my question is can i go ahead and install first linux then windows (which is already formatted as MS DOS (FAT 32) provided that i have already created the hybrid MBR as you can see above.

     

    1.  I would change the type code for partition 4 to 8200, and partition 5 to 0700 before installing Linux. Use 0700 because due to poor planning, the parted developers borrowed the Microsoft basic data partition type GUID for Linux partitions on GPT disks. Only very recent installers understand type code 8300.

    2. Install Linux, this will remove the hybrid MBR you've already created.

    3. In gdisk recreate the hybrid MBR.

    4. Install Windows.

     

    need it is crucial that i do not use bootcamp to create a bootcamp partition but gdisk instead to create every partitions,

     

    Assuming you already have Windows install media prepared and it boots the Windows installer, you don't need Boot Camp Assistant for anything.

     

    LONER T, is there a way to convert it beforehand to NTFS?

     

    No, just reformat it NTFS in the Windows installer.

  • by Christopher Murphy,

    Christopher Murphy Christopher Murphy Jul 6, 2014 1:51 PM in response to Loner T
    Level 3 (555 points)
    Jul 6, 2014 1:51 PM in response to Loner T

    Yes, although swapping steps 2 and 3 if Disk Utility was used to create all of the partitions in advance.

     

    The other way to do it is only resize OS X and create one pile of free space for Linux and Windows; let the Linux installer do its own partitioning from free space while leaving some free space for the future Windows installation. Then in Linux or OS X's gdisk, you'd a.) Fix up any partition type codes as needed; b.) create a new partition for Windows with all remaining free space; then c.) create the hybrid MBR; then d.) Install Windows which ought to see only partition 2 (i.e. MBR partition 2, a.k.a. GPT partition 6 in this case) as a target partition for installation.

     

    Obviously part of the confusion is that there are multiple ways to do things...

  • by Bx029297,

    Bx029297 Bx029297 Jul 7, 2014 9:35 AM in response to Christopher Murphy
    Level 1 (0 points)
    Jul 7, 2014 9:35 AM in response to Christopher Murphy

    Successful operation

     

    Christopher Murphy and Loner T i would like to thank you very much for your advice

    , i couldn't have done this without you.

     

    I now managed to triple boot Mac Osx Lion, Ubuntu and Windows 7 on a single drive using your hybrid MBR method

     

    i also apologize for my ignorance and taking so much of your time but this was definitely not easy to achieve.

     

     

Page 1 Next