Monday, June 29, 2009

Triple Boot MacBook

Having bought a shiny new MacBook a few months ago, I got a little bored of OS X and wanted to make most use of its Intel chipset - to let me boot into Windows, OS X and Linux all on the same box.

There are quite a few long-winded, complicated explanations out there that describe how to achieve this, but actually it's quite simple once you know what to avoid. The following procedure has been tested using OS X Leopard (I'm assuming it's already installed), Windows XP Professional SP2 and Ubuntu 9.04.

1. Install the rEFIt Bootloader

Bootcamp seems to have problems working with more than two parallel OS's. So inside OS X, download and install rEFIt from, which is an alternative bootloader providing support for the Extensible Firmware Interface that Macs use.

Reboot after installing to check that you get the new rEFIt bootup screen, and choose to boot into OS X again.

2. Partition your drive

You'll need at least three partitions (one for OS X, one for XP, and one for Ubuntu). Ideally, though, you might choose to have an additional swap partition for Linux, and perhaps a shared data partition which you can access from all three OS's. You'll also probably already have your first partition defined as an EFI system partition - it's best not to fiddle with that.

Limitations to bear in mind are that the Ubuntu GRUB bootloader must be installed on the third partition, and XP on the fourth (due to their dependence on PC BIOS and the MBR, both seemingly have to be within the first four partitions, and XP must be as "low down" as possible). XP also seems to be unable to see any more than the first four partitions (as it doesn't support the GUID partition scheme), so make sure that your shared data is within the first four.

I found my ideal partition map to be as follows:

  1. EFI - 200MB (untouched, as from the factory)
  2. OS X - 50GB (the original OS X partition, shrunk but otherwise not modified)
  3. Shared Data (plus GRUB bootloader for Ubuntu) - 20GB
  4. XP - 50GB
  5. Ubuntu - 25GB
  6. Linux Swap - 2.5GB

In OS X, enter the command:

diskutil list

...and you should see that your existing disk structure looks something like this:
#: type name size identifier
0: GUID_partition_scheme *149.1 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Macintosh HD 148.9 GB disk0s2

Given that you want to resize the large partition and make lots of other smaller ones, you should then issue the following command (without linebreaks, and assuming my desired partition map):

diskutil resizeVolume disk0s2 50G
"HFS+" "Data" 20G
"MS-DOS FAT32" "Windows" 50G
"HFS+" "Linux" 25G
"HFS+" "Linux Swap" 2.5G

In actual fact, the formats selected here don't matter all that much, because both Windows and Linux will reformat the relevant drives upon installation. Make sure, however, that for the Data partition you initially pick a format that Windows can't understand - this will ensure that the Windows partition ends up as drive C upon installation! You can then reformat Data later (as MS-DOS FAT 32, being the only format all three OSs can read and write) using Terminal or Disk Utility in OSX.

3. Install XP

Insert your XP boot CD, and restart the machine while holding down the Option (alt) key. Choose the option to boot from CD.

Install Windows as normal, selecting the fourth partition (which should be labelled C:). I also chose to reformat the drive using NTFS, as this provides better performance than FAT32.

As Windows needs to restart the machine a couple of times during this process, ensure that each time you select the "Windows" option which should appear in the rEFIt menu, to allow the installation to carry on.

Once this is complete, install the relevant Windows drivers for the Mac hardware using the "Boot Camp" installer for Windows (on the Mac OS X Install DVD).

4. Install Ubuntu

Insert a bootable Ubuntu CD, and again restart the machine while holding down the Option (alt) key. Choose the option to boot from CD.

Install Ubuntu as normal, selecting manual configuration of partitions when prompted. On the subsequent screen, you should select /dev/sda5 to be formatted with ext3 (my preference), and mounted as "/". Assuming my partition map, you should also select /dev/sda6 to be formatted as a swap partition.

Important: On the final screen of the installer, select 'Advanced...' and change the location of the GRUB bootloader to be /dev/sda3. This is important, as otherwise Ubuntu's bootloader will attempt to take over the whole disk, which can have some odd results working alongside rEFIt.

5. Celebrate

That's it! The only thing that doesn't work for me (bizarrely) is restarting from within Ubuntu... I have to make sure I only ever choose "Shut Down"!

No comments:

Post a Comment