Over the last few days I, have been struggling with installing Windows XP and Ubuntu on my Mac Mini, while of course retaining Mac OS X as the primary OS. Why triple boot? Well, because only Ubuntu can repair ext3 filesystems. Or because only Windows can run Mobipocket Creator. But most of all, because it is possible. Here I will describe the process and caveats I ran into.

Start up with you normal Mac OS X system. Before you start, make sure you have a backup, for example by using Time Machine. Hopefully when you follow these instructions, there is no need to use the backup, but then again, there is no guarantee and a backup is a must-have. When you have a backup of your current system, here's what to do:

Reserve some space on your hard drive for the two other operating systems. Open terminal and enter sudo diskutil resizeVolume disk0s2 265G, where disk0s2 is the location of your Mac OS X installation, and 265G is the new (smaller) size of this installation (in gigabytes). The remaining space will be assigned by diskutil as free space, and will later be used by Windows and Ubuntu. Of course, the 265G is just an example, use your own number at will.

Partition the hard drive. I wasn't able to do this using diskutil; it came up with an error about my hard drive not supporting it. Please report if you know how to do this with Mac OS X. In my case I used the Ubuntu Live CD to do this:

Start up Ubuntu from the Live CD.

Start the Partition Editor from the Administration menu.

Create an Ext3 partition (for Ubuntu) in the free space.

Create a FAT32 partition (for Windows) after the new Ext3 partition in the remaining free space.

It is wise to not use more than 32GB for Windows, which is the maximum for the FAT32 filesystem. If you want to be able to access your Windows drive from Mac OS X, you have to use FAT32 and not NTFS. It is also important to place the FAT32 partition for Windows at the end of the disk. If you do not do this, the Windows bootloader gets confused after you install Ubuntu.

Install Windows. Shut down the Ubuntu Live CD and start with your Windows XP boot CD. Install Windows on the FAT32 partition and reformat it as FAT when the installer asks to do so. When a question about rewriting the master boot record comes up, you can safely answer yes -- your Mac OS will not be influenced by this.

When the installation of Windows is finished, you can boot from Windows by holding the option key when starting up, or by installing the rEFIt tool. Your Windows drivers can be found on your Mac OS install DVD. Install the Boot Camp drivers and you'll be fine. The included driver for the Broadcom WiFi did not support my WPA2-PSK router. A suggested alternative for this driver can be found at the end of this document.

Install Ubuntu. Boot from the Ubuntu Live CD and start up the partitioner again. Now resize your FAT32 Windows partition to allow for a swap-partition for Ubuntu. In my case, I shrunk the FAT32 by 2GB and created a new swap partition for Ubuntu of that size. Position the swap partition after the FAT32 partition, so that the FAT32 partition is still there as the fourth partition on the disk. This is important!

Now start the installation from the Install Ubuntu icon on the Desktop. Choose the ext3-partition as the "/" (root) mountpoint, and the swap partition for swap space. If the installer crashes, just restart your Mac with Ubuntu, format the Ext3 partition again, restart again, and proceed with the installation. I experienced this crash, probably because the newly-formatted partitions weren't recognized right.

Proceed with the installer. When the installation is finished, shut down your Mac.

When you power your Mac on again, hold down the Option key and then choose to startup from Windows when the drive icons appear. You now see the GRUB bootloader, which allows you to choose between Ubuntu and Windows XP. If you want to start up Mac OS X, just shut down, power on again, and do not hold down the Option key. Mac OS X should start right away.

Due to a bug, when you restart your Mac from Ubuntu, the system hangs at the point the restart should take place. As a workaround, always choose to shut down when running Ubuntu. There was one other strange thing that I experienced though: Mac OS X does not recognize the Windows FAT32 partition.

I found out that this had to do with the Ubuntu GParted partitioner flagging it as 'Microsoft Reserved', or msftres. This is some kind of strange behaviour from GParted, as I found out from the discussion on this previous hint. To clear the msftres flag, start up Ubuntu and download the source code for parted.

Unpack and locate the file libparted » labels » gpt.c. Open that file in a text editor, and locate the following code:

Delete all that code (including the last }!) and compile your own version of parted. If you don't know how to do that, refer to the Read Me included with parted. Now, when your own personally-altered parted is compiled, start it as administrator and type print. This will give you a numbered list of all your partitions. Locate the FAT32 partition and type set # msftres off, where # is the number of your FAT32 partition. Now reboot, start Mac OS X, and your Windows partition should be visible.
Ubuntu drivers for Mac Mini (March 2009 model):

Broadcom WiFi: Download the driver from this page and follow the instructions in the readme.txt document to build and install the driver. To load the driver permanently, you have to do two more things that are not mentioned in the readme file:

blacklist the ssb driver by editing the /etc/modprobe.d/blacklist.conf file and add the line blacklist ssb

add the wl driver (your newly built Broadcom driver) to the file /etc/modules. There are already to drivers there (lp and rtc). Simply add a line containing wl.
Now your Broadcom WiFi card should work directly after booting Ubuntu.

Nvidia graphics adapter: Download from the Nvidia web site. Go to Download drivers » product type 'GeForce' » product series 'GeForce 9M series (notebooks)' » operating system 'Linux 64-bit'. The installation tool from Nvidia builds the driver automatically. You must stop the graphical (X-Windows) interface before running the Nvidia installation tool. Go to a text-only terminal by pressing Control-Alt-1. Login and type sudo /etc/init.d/gdm stop. Now go to the location where you downloaded the Nvida driver and start it with sudo sh NVIDIA-Linux-x86_(version).run.

Windows drivers for Mac Mini (March 2009 model): All Windows drivers are included when you install Boot Camp from the Mac OS X installation DVD. The driver for the Broadcom BCM 43xxx cannot connect to WPA-PSK2 routers. Use the driver from the Microsoft Update Catalog instead (this only works while running Windows). Search for Broadcom and select the Broadcom - Network - Broadcom 4322AG 802.11a/b/g/draft-n Wi-Fi Adapter. Download this driver and replace the original Broadcom driver with this one. You should now be able to use WPA2-PSK networks.

Happy triple booting! Please comment with tips, questions or anything! And thanks to skodabenz at macosxhints for all the information on the msftres-thing, and to OnMac.net for their Triple Boot page.

FAT32 can support volumes up to 2TB in size. The reason to format in FAT here is to allow native copying of files to the Windows-based OS partition; however, it is also possible to do this with NTFS (highly recommended for better performance and windows security) with MacFuse and NTFS-3G.

Not to nitpick but I feel like this writeup has been done a few times before in different ways. Like this one, which just doesn't specifically talk about booting with Linux:

well done and all that but isn't going to all this effort to install these operating systems just to run a couple of utilities on each a little overkill? I would have thought a VM would have been a better idea

The reason you couldn't partition with diskutil is because OSX doesn't like to overwrite the previous space of deleted files on the hard disk for recovery reasons. The data is scattered all over the hard disk partition. You need to use a defrag application like idefrag or use an application like carbon copy cloner/disk utility to clone the partition and restore it back to compress the data on that partition into a confined location; allowing you to resize the partition without running into existing data occupying the space you are trying to resize.