July 11, 2010

Triple-Boot MacBook Pro

I am now the proud owner of a triple-boot MacBook Pro featuring OSX, Windows XP, and Ubuntu 10.4; One big happy family! I primarily followed the article here:


I already had OSX with Windows XP set up on boot camp. To get the full house, I only needed to add Ubuntu to the mix. I began by shrinking the OSX partition to make room for Ubuntu using OSX's disk utility. I then installed Ubuntu onto the new partition using a single partition (no separate swap partition) being sure to install the grub boot loader to the same partition (not into the MBR).

The key to getting all of the OSs to play nicely together is to use a utility called 'rEFIt' which acts as a boot loader as well as syncs the EFI and MBR for you. It is easily installed from OSX and is available here:


At that point, all seemed well accept for a nice new BSOD when booting into Windows with the error "UNMOUNTABLE_BOOT_VOLUME". Quite a few sites talked about this being the cause of Window's 'boot.ini' file pointing to the wrong partition. When I changed it to any other partition (the wrong partitions), it only lead to a dead boot fussing about "hal.sys". This did, however, give me some hints to the right direction.

I did some reading around and saw mention that Windows needs to be on the last partition (nobody really seems to know why). While my Windows partition was indeed the last physical partition, I noticed that it was showing up as '/dev/sda3' and Ubuntu's partition was showing up as '/dev/sda4'. I suspect that this is because the Ubuntu partition was created last, even though it was not physically last. The solution that I came up with was to swap these around on the partition table, and bingo!

To do this, I booted into my Ubuntu live CD and worked with the 'parted' utility. First, I listed the partitions and their locations by sectors. I wrote down the start and end sectors for the Windows and Ubuntu partitions (as well as their file system type and label). I then deleted both of their entries from the partition table and added them back, Ubuntu's partition first. The key is to use the exact same start and end sector locations, or the partitions will end up corrupted. This procedure left me with Ubuntu on '/dev/sda3' and Windows on '/dev/sda4', which more appropriately depicts their location on disk.

To finish off, I booted into Window's recovery mode using the Windows Installation CD and corrected the 'boot.ini' using the 'bootcfg' utility. No more BSOD.

During this process, the grub boot loader on the Ubuntu partition broke (the partition devices were wrong now). To fix it, I loaded up Ubuntu from the live CD and ran the 'grub-install' utility with a '/dev/sda3' argument. Success!

Now all is well, and I can choose any of the big 3 OSs as needed.