Trail: Home >

Triple Boot via Boot Camp

Guide maintained by Pietro Gagliardi, formerly posted at OnMac.net.
 

This procedure allows you to triple boot Mac OS X, Windows XP and Linux. It has been successfully used to setup a MacBook, but is untested on the iMac/mini. Therefore if you try this you do so at your own risk.

Before you start

This procedure takes 3-4 hours (with broadband downloading), which is mostly Windows & Linux installation. Also note that if you want to undo this process without destroying and reformatting your JHFS+ partition, you'll need iPartition. This is not reversible (nondestructively) with Apple's tools.

Before you begin you will need the following:

Software

Please note that this procedure can potentally Destroy all data on you machine's hard disk drive, so make a backup first.

If you don't know how to make a clean back up of your system, you can visit the How To Backup your Mac page.

For detailed Ubuntu installation instructions, check out Triple_Boot_via_BootCamp_Ubuntu.

Background

If you want to just get on with installing, skip this section and go on to install. Otherwise keep reading.

Issues in brief

Setting up a machine for triple-booting is largely just partitioning the hard drive and installing each OS. The issues that cause problems are:

In turn:

So in summary:

Disk Partitions and their Limitations

The primary problem with installing operating systems on a Mac is the partitioning system. Intel Macs use the new GPT method to partition drives. (GPT is part of the new Extensible Firmware Interface (EFI) standard proposed by Intel as a replacement for the outdated PC BIOS). This is supported by Mac OS X (obviously) and Linux. However Windows can only be installed on a machine with a legacy (MBR) based partitioning system. In order to overcome this, Boot Camp uses both systems, and herein lies the difficulty in triple booting. Currently there is no partitioning software available apart from diskutil (included with Mac OS X 10.4.6) that can create dual GPT/MBR partition system drives. Current GPT based partitioners (e.g. GNU parted) wipe the MBR portion, whereas current MBR partitioners (e.g. fdisk, Partion Magic) can't edit GPT.

There are certain things you can do with fdisk that won't hurt GPT when booted using BIOS Emulation/Compatibility mode, because of the layout of the MBR and GPT relative to each other and the way the BIOS Emulation protects certain parts of the GPT/MBR tables:

However, any changes to the actual MBR partition table structure are impossible without ruining your GPT structure.

In other words we have to manually partition the drive using diskutil in order to get the necessary partition structure for triple booting. However it gets worse. MBR only supports 4 primary partitions and GPT does not support extended partitions. Combining these two limitations means that a dual partition system disk can have a maximum of 4 primary partitions. In addition, Apple reserves the first primary partition for the "EFI System Partition". That leaves us with only three partitions to play with, one for each OS. Hence, we cannot have a Linux swap partition, instead we must create a swapfile. Also, for some reason Boot Camp expects the Windows "C:" drive to be the last partition present on the drive. If it isn't, Windows setup will crash with a "cannot find hall.dll" error after the first reboot.

In addition, it may be best to stick with Apple's advice and format the Windows partition as FAT32. Due to limitations in Windows XP's disk manager, the FAT32 partition will normally be limited to a maximum of 32GB. However that said, some of these limitations can be overcome using the advanced partitioning methods listed in the next section.

Also, Intel based macs shipping with 10.4.7 or later pre-installed appear to be capable of partitioning a drive using MBR in a traditional manner and booting Mac OS X from it. This may dramatically reduce the complexity of triple booting setup (at least for newer hardware) but information in this area is currently very scarce, and is not referred to again. (Note that writing to boot sectors is usually separate from writing to the master boot record, and can be done at any time)

Trick to make a swap partition nevertheless : (added by Muchel Roche on 13/11/06) Start partitioning as depicted above, install Windows, and then launch Linux install. Now we have as partitions :

At the point of using the partitioning tool during the install, gparted (at least, but I guess most of the EFI aware partitioning programs that may be used by the different distros) is capable to shrink your windows (FAT32) partition in order to create a 5th partition in the end, which you can easily make 1 or 2 Gb wide, to hold your swap partition. It's not a problem in Linux to have five EFI partitions since it's "EFI aware", so it can use the swap. It doesn't bother Windows XP once installed because the bootloader (I use rEFIt) still knows where it is. All I had to do was to update the BIOS-alike partition scheme which rEFIt produces as partition scheme for Windows to run. And it seems not to be a problem for Windows which has no access to it and doesn't know it ! The only drawback of this technique is that in he eventuality that you'd have to reinstall windows (but no one can see why ;-) it may cause a problem because the Windows partition isn't the last in that case which may cause a problem between Boot Camp insisting for windows to be the last and windows only knowing four partitions. I haven't tested yet this configuration and cannot figure what exactly could go on. Anyway, the fix wouldn't be that annoying : simply boot under a Linux live CD, fire up gparted and kill the swap to free space so that your drive goes back to the four partitions scheme. Re-install windows, reboot on live-CD and recreate the swap partition. Hopefully linux should boot again with no trouble.

Another simple fix is to use lvm to separate the big linux partition into as many partitions as you need. This will be backward compatible with MBR and EFI/GPT. See debian etch install below

Advanced Methods for Partitions/Filesystems

If you want to use FAT32, but you need your partition to be larger than 32GB, you can use a utility called fat32format via a ''non-dos'' bootdisk or bootcd (think BartPE) to perform the actual formatting. Windows will recognize and interact with the drive with no problems.

With respect to filesystems, Mac OS X can recognize and mount both NTFS and FAT32. However it will not recognize them properly unless the the GPT partition type is set to "Microsoft Basic Data". The only way you can set the partition to this type is to format the disk via diskutil and specify "MS-DOS FAT32" as the filesystem type. Confusingly, this will allow Mac OS X to correctly recognize either a FAT32-formatted partition or an NTFS-formatted partition. There is no way to format a partition as Linux, etc., and then convert it to "Microsoft Basic Data" (short, perhaps, of manually editing the drive itself with a hex editor). GNU parted does not support this partition type, "ntfs" and "fat32" in parted will not be recognized by the Mac. Furthermore, parted clobbers the MBR record. This cannot be properly restored by rEFIt, even with the filesystem sync utility. Basically you have to get it exactly right the first time.

Once you have one or more partitions in "Microsoft Basic Data" type set up, you can then proceed with the install below. However if you are trying to create a setup like below you will have some trouble:

The problem with this is that Windows installer will recognize the 2nd partition as "Active" and make it your C drive. This is bad because OS X expects the Windows boot partition to be the last on the disk. You can switch the active partition via a regular MBR fdisk utility such as Free FDisk, which is included on various boot CDs such as the very useful EBCD. GPT doesn't know anything about the active partition, and doesn't need to. Once this is switched then Windows will swap the drive letters and the 4th partition will be "C".

Finally, there is as small hint about NTFS write support in terminal under "man mount_ntfs". It says that it is very experimental and does not support a number of important NTFS features. For information read in this forum. Mac OS X itself has unfortunately not been proven to have a working write support for NTFS yet. Though, you can use NTFS-3G for Mac OS X for that.

Booting your Mac

This article lists two alternative methods for booting the operating systems installed on your Mac. The recommended method is to use the graphical boot menu supplied by the rEFIt project. The advantage of this method is that it presents you with a single, customizable interface. However the disadvantages are that you need to bless it onto your hardware, and it needs to be reinstalled every time you upgrade Mac OS X.

As some people may be uncomfortable with blessing their equipment, an alternative method exists were you can chainload the LILO bootloader from the Windows XP (NTLDR) bootloader. The problem with this method is that LILO must be reinstalled every time you change your Linux kernel, and it requires you to use multiple boot menus in order to select your OS.

With respect to booting Linux, unfortunately it is not possible to use GRUB out-of-the-box with Boot Camp. GRUB tries to access legacy hardware that is not present in the Intel Macs. See here for a patch to GRUB to make it work in the Intel Macs.

Note: This section previously stated: "GRUB tries to install the stage 1.5 code into the section of the disk reserved for the primary GPT record. Apple's firmware prevents this from occurring." This is wrong. GRUB checks the MBR partition table itself, detects that there is no room to embed a stage1.5 and falls back to coding the sector location of stage2 into stage1.

Installing the Operating Systems

OS X

Boot Camp & partitioning

Windows XP

I think as of Boot Camp 1.1.2, the following is taken care of by the drivers CD. If not you will likely want to add some of the following utilities to make Windows more usable with your Mac hardware, notably:

You now have a dual boot system! But obviously, we aren't finished yet.

Linux

Via Debian etch

Further advice is at: Brian W. Carver's HOW-TO, but it is now out-of-date: notably, the network card is supported and X is set up correctly.

Lots of Debian-specific information is at: Debian Wiki on MacBook

Now you are actually done with installing; there is some hardware configuration (below).

Hardware: What works, what doesn't?

See Debian Wiki on MacBook for up-to-date info on hardware especially.

Currently, your network card and X are setup correctly, and monitor does with 915resolution; sound works as of Linux kernel 2.6.18-rc1.

I do not know about other accessories (iSight camera), and I don't know an easy way to setup the keyboard.

Boot

Booting your Mac via rEFIt

Now restart your mac. If everything has been done correctly, the rEFIt menu will be displayed with icons for all three operating systems. Select the OS of your choice using the arrow keys and return.

gptsync: if the GPT & MBR get out of sync (as they may when installing Linux), use gptsync to fix this: at the rEFIt screen, choose the command prompt, let it boot, then type gptsync at the prompt, and it will check if GPT & MBR are in sync, and offer to fix them if they are not.

Booting your Mac via NTLDR

You do not need to do this if you have installed rEFIt; this uses the Mac native loader (to select between Mac & Windows), plus the Windows NT NTLDR (to select between Windows & Linux), instead of rEFIt (which selects between all 3, via a nice GUI).

Now restart your Mac. If everything has been done correctly, when you hold down the OPTION/ALT key, you will be given an option to boot to OSX and Windows. Select Windows. NTLDR will now show up and present you with the option to either boot into Windows or Linux. Select Linux!

Further issues

Linux Drivers

Upgrading Boot Camp from 1.0 to 1.1

On the 16th August 2006, Apple released an updated version of Boot Camp which includes drivers for iSight, amongst other things.

(The point of this upgrade is just to install newer drivers, so you just need to create a new drivers disk; you don't need to do any repartitioning or reinstalling of OSes.)

However the Boot Camp Assistant will not run on triple boot setups due to the different disk layout. In order to upgrade, you need to use the following workaround:

Restoring your Mac to its original state

The following instructions worked for me on Mac OS X 10.4.8 with BootCamp 1.1.2.

Basically, there are two operations that need to be done:

  1. Remove the Linux and Windows partitions.
  2. Resize the Mac partition to the full size of the disk.

Removing the partitions can be done with "gpt":

  1. Read the "remove" and "show" sections of "man gpt".
  2. Reboot using the Mac OS X install disk.
  3. Run the disk utility and make sure all volumes on your harddisk are unmounted. I've had to repeat this step after each gpt command, which, for some reason, caused them to get mounted again.
  4. Run the terminal.
  5. Use "diskutil list" to find the device identifier of your harddisk (usually, it's "/dev/disk0").
  6. Use "gpt show" to find the indices of the volumes you want to remove (if you've completed the triple booting sequence successfully, it should be 3 and 4).
  7. Use "gpt remove -i <index> <device identifier>" to remove the Linux and Windows volumes. Replace "<device identifier>" and "<index>" with the values you found in the previous steps. Obviously you will need to run this command once (with the corresponding index) for each volume you want to remove. Note: Volumes are mounted automatically whe you remove a partition. Dismount them again.
  8. Close the terminal, run the disk utility, check that the only remaining volume is the one you wanted. Make sure it's mounted.
  9. Close disk utility and quit the installer. In the "Startup disk" dialog, select Mac OS X on your harddisk.
  10. After rebooting, you should be back in your regular Mac OS X, with the Linux and Windows volumes gone.

Resizing the Mac volume is surprisingly difficult. Although "diskutil resizeVolume" claims to be able to grow volumes as well as shrink them, in reality, it fails with a "Resizing encountered error No space left on device (28) on disk" error message. Luckily, Boot Camp Assistant has an option to restore your disk to its original single-volume state, and that option will make that volume span the entire disk. To convince it to do this, however, you first need to use it to split your Mac volume into a smaller volume and a Boot Camp (Windows) volume. The steps:

  1. Run Boot Camp Assistant. Note, this will only work '''after''' you've removed the Linux and Windows volumes, as Boot Camp Assistant expects a single-volume disk.
  2. Skip the "Burn a Macintosh Drivers CD" step and split your disk into two volumes as instructed by Boot Camp Assistant. The actual sizes of the volumes don't matter.
  3. Tell Boot Camp Assistant you do not want to install Windows now. It will then make you reboot.
  4. Run Boot Camp Assistant and choose the "Restore to a single Mac OS partition" option. It should show you that the new size of your Mac volume will be as large as the entire harddisk. Confirm the restore, and you're done.

Resizing Windows and Linux Partitions