Questions about Triple Booting?

Discussion in 'Windows, Linux & Others on the Mac' started by teejusb, Apr 9, 2012.

  1. teejusb, Apr 9, 2012
    Last edited: Apr 9, 2012

    teejusb macrumors newbie

    Dec 18, 2010
    Currently I have Lion and Windows 7 (through bootcamp) installed on my late 2011 MBP. I created an 8gb Linux swap partition off of my OSX partition and I could no longer boot into windows. I fixed this by deleting the newly created partition an then resetting the partition to active using fdisk.

    Now to make sure I don't mess up again, how do I go about triple booting by adding Linux without formatting any of my current partitions. Searching around, some people said that you should create the partitions through my windows side and then install Linux normally. Will this work if I create two partitions off of windows? One for swap and one for normal?
  2. murphychris macrumors 6502a

    Mar 19, 2012
    As someone who has done this a lot, you are in for one serious rabbit hole of pain. You will almost certainly mess it up again. You will need to learn about MBR and GPT, and about how Apple hardware boots in EFI mode and CSM-BIOS mode. You're almost certainly better off CSM-BIOS booting Linux, just as with Windows. Or you're asking for even more pain dealing with drivers when booted via EFI. In my case, I get VBIOS corruption on 2008 and 2011 MBPs when EFI booting Linux, so I've resigned to using CSM-BIOS booting.

    The other complicating factor is that of boot loaders. CSM-BIOS booting depends on loading code in the first 440 bytes of the MBR and then chain loading the rest of the boot loader. Windows has its own boot loader. Linux has its own boot loader. They don't co-exist, although the GRUB boot loader will chain load the rest of the Windows boot loaders.

    Basically, you're asking a question about how to drive oxen to San Francisco. There are a lot of ways to do this. There isn't necessarily one correct way to do it. But there are lots of wrong ways to do it.

    I've found gdisk to be invaluable in editing GPTs. And it also will help create hybrid MBRs. For triple boot, you will have to use more partitions than there are available in the MBR, which can only have four. One, the first one, must be an 0xEE entry, leaving you three.

    My strategy is to partition such that Mac OS is first, Linux second, and Windows last. So if the GPT is something like

    1. EFI System
    2. Mac HD
    3. Recovery HD [Lion only]
    4. BIOS Boot [used by GRUB2 on GPT disks]
    5. Linux /boot
    6. Linux LVM
    7. Windows

    What I do is use gdisk to add only the 7th GPT partition into the 2nd MBR slot. I let it add GPT partitions 1 through 6 into the MBR first entry as type 0xEE "protective".

    1. 0xEE Protective
    2. HFPS/NTFS "Windows"

    And I mark the boot flag (active flag) on MBR partition 2.

    So basically every GPT partition entry that an MBR tool, including Windows, should never touch, I stuff into the protective MBR partition. I only expose the Windows partition in the MBR. So the Windows installer will definitely not touch any sectors reserved in MBR entry 0xEE, only the 2nd entry which are the sectors for Windows.
  3. murphychris macrumors 6502a

    Mar 19, 2012
    Oh and I only use gdisk for editing the GPT. Of course most linux installers rely on parted in one form or another, which results in some issues... namely it obliterates the hybrid MBR in favor of a protective MBR. And it sets the GUID on Linux partitions incorrectly. Both of these can be corrected after installing Linux.

    Mind you, after installing linux, the hybrid MBR won't be created unless you're using a distribution that depends on gptsync. I don't highly recommend just blindly trusting it. It's kinda dumb. It might work. It might not. It's a very simple tool. I think Ubuntu uses gptsync. Fedora does not and therefore it will not reboot Linux because the hybrid MBR isn't created, therefore the Mac EFI firmware won't do a CSM-BIOS boot. For CSM-BIOS to be activated on every Mac I've tried so far, there must be at least one additional MBR entry, and it must be set bootable.

    Next, the way to access it, is option key on startup. You'll get a Windows labeled disk icon. This is a hardwired label in the Mac's EFI firmware and can't be changed. Choose it. You'll get GRUB2's menu and from there boot Linux.

    Next, when you install Windows... well, it will obliterate the GRUB2 bootloader code in the first 440 bytes of the MBR. You'll be able to boot Windows, but not Linux. So actually, I find it easier to install Windows 2nd even though it's going last in your partition sequence. Then boot your Linux install media, and install Linux. Then fix the MBR as described.

    That way you'll end up with a GRUB menu that contains entries for Linux and Windows.

    I do not use rEFIt. I gave up on it. Rod Smith, creator of GPT fdisk (gdisk) has forked it as rEFInd, which you might find useful in dealing with these three partitions.

Share This Page