Intel Mac Triple Boot – Windows, Linux and Mac Howto – Installing

 

This document will detail how to triple boot your Intel Mac with Mac OSX, Linux (Fedora Core 10) and Windows (WinXP) and how to clone it to another Intel Mac.

 The reason why I’m writing this is that there is a lack of complete documentation and explanation on how this is done.

By the why I am not an Apple Fan but a poor System Administrator who got stuck with the task of getting triple booting working on an Intel Mac. I imagine why everyone is having so much problem is because the Intel iMac using a hybrid MBR GPT Layout.

 I don’t see why people would want to put Linux or Windows on an Intel Apple Mac, that’s why you pay a premium to run Apple on a equivalent Intel hardware running Windows or Linux.

Pre-requisite

-          Intel Mac Hardware (There is no PowerPC version of Windows)

-          Mac OSX 10.5.x (Newer is usually better but not always the case)

-          Mac OSX 10.5.x Installation Discs

-          Windows Installation Disc (WinXP with at least SP2 incorporated)

-          Linux Installation Disc (Fedora Core 10 Installation DVD, can be any distribution but it needs to be able to support the Apple Mac Hardware)

-          Download rEFIt from (refit.sourceforge.net)

-          Linux LiveCD (Optional if you want to clone your installation, I choose the Fedora Core 10 LiveCD because it supported the Apple Mac Hardware)

-          Firewire Cable (Optional if you want to clone your installation)

-          USB removable Media (Optional if you want to clone your installation)

Installing / Configuring a Triple Boot Mac

            Please make backups of any important data on your Apple Mac before proceeding as you have to do several things which could harm the data on your Apple Mac such as resizing the partition layout on the Apple Mac.

            At the moment the Apple Mac has a pseudo MBR / GPT Layout to support newer system like the Mac OSX but yet maintain compatibility with legacy MBR systems like Windows XP. Most MBR type layout only supports a max of 4 Primary partitions and some systems needs to be installed on one of these Primary Partitions.

 

 

In saying this, the Apple Mac OSX uses 2 of the 4 primary partitions available. One for the EFI layout and another one for the Mac OSX system itself. You can verify this by logging on your Mac OSX system and use the diskutil command via a terminal ie

demomac:~ root# diskutil list

/dev/disk0

   #:                       TYPE NAME                    SIZE         IDENTIFIER

   0:      GUID_partition_scheme           *232.9 Gi      disk0

   1:                        EFI                                      200.0 Mi     disk0s1

   2:      Apple_HFS Macintosh HD            69.9 Gi       disk0s2

 

Before we proceed you need to decide a layout of the filesystem on the Intel Mac, my suggested layout is as follows.

disk0               The Whole Disk     -> GUID_partition_scheme

disk0s1            Primary Partition 1 -> EFI (Compulsory)

disk0s2            Primary Partition 2 -> Apple HFS Macintosh HD (Compulsory)

disk0s3            Primary Partition 3 -> Linux Filesystem (Ext3 or any other linux Filesystem)

disk0s4            Primary Partition 4 -> Windows Filesystem (For Windows NTFS or FAT)

disk0s5            Logical/Extended Partition 5  -> Linux Swap

disk0s6            Logical/Extended Partition 6   ->Data Partition (Fat, All OS can write to this)

 

1.       Make sure the Target Apple Mac has Mac OSX installed with the latest patch, as it stands its Apple Mac OSX 10.5.6 and has the latest apple firmware bios for your model of Intel Apple Mac (Run Apple Software Update)

2.      At the moment there, physically on the Apple Mac, there is just the EFI and Apple HFS Partition which houses Mac OSX which we will need to resize the disk partition so there is spare space to allocate to the other operating systems. So Physically insert the Mac OSX installation disk into your Intel Apple Mac, reboot and hold C to boot the DVD.

3.      Run the terminal from the utility when you booted from the DVD, the reason why we booted from the installation DVD is we booting to a third party system so we can actually resize the partitions on your existing Intel Mac Hard Disk.

 

 

4.      Refer to what we discuss earlier in regards to the partition allocation but we are going to make 70G for Mac OSX (disk0s2), 50G for Linux (disk0s3), 60G for Windows (Disk0s4), 2G for Linux Swap (disk0s5) and 50G for Data sure (disk0s6).

 

In that terminal type

 

diskutil resizeVolume disk0s2 70G “MS-DOS FAT32” “Linux” 50G “MS-DOS FAT32” “Windows” 60G “MS-DOS FAT32” “SWAP” 2G “MS-DOS FAT32” Data 50G

 

Point to note which I found annoying with diskutil, that no matter what you specify for the last partition in size to be allocate, the remainder of your disk space is always allocated to it. Ie instead of 50G it would allocate 100G if it was free.

 

It should take a couple of minutes. If somehow you screwed it up you have to delete the partitions. You can use the graphical disk utility, but if you screwed it up such that the disk utility keeps crashing. There is only one way of fixing this, by using gpt or the diskutil command from the terminal and delete the offending partitions.

 

5.      Now reboot the system into the Mac, we are going to install rEFiT onto the Macs either install the DMG or get the custom install and unzip it into the root ie / of your Macintosh HD.  To enable refit you have to run a terminal and type the following

cd /etc/refit

./enable-always.sh

(You need the a user with admin privileges such as root)

What rEFIt does is that it installs something similar like a boot loader which integrates into the EFI firmware which gives you graphical detection and selection of OS installed during boot time dynamically. It also gives you some handy tools to deal with the hybrid GPT MBR layout to get your systems going. To see what I mean just reboot the Mac.

 

Reboot the Mac and on the rEFIt menu, choose Start the Partition Tool. This is the tool which will generate / sync MBR table from the GPT table. You need to sync the tables any time where you physically modify any partition information. Answer “Y” for Yes to update the MBR table. If they are sync you will have problems ie some OS will not be able to boot etc.

 

Notice that the MBR table only has a max of 4 partitions whereas the GPT table has more than 4. So remember install the legacy MBR base OS on the primary partitions.

6.      Now since the partition are prepared and the GPT / MBR table are synced, we can now install Windows XP (Has to be at least Service Pack 2 incorporated into the CD, if you don’t have SP2 you may have problems if you have Large Hard disk as you will have LBA problems). Eject the Mac DVD and insert the Windows XP CD, reboot and hold C to boot the CD. Install WinXP on the correct designated partition. On the reboot, on the refit menu you will be able to choose a Mac System or a Windows System. Don’t worry if you pick Windows as it will fail to boot but this will be rectified down the line.

The other way to verify if the Windows is installed is by holding down the “option” key during the reboot which should pop up a selection of Mac OSX or Windows system but it will still fail on selection of Windows but again don’t worry about it.

7.      Now for the Linux installation, you need to have a recent Linux Distro which has a recent kernel ie at least 2.6.27.x or later but it really depends on hardware components in your Intel Apple Mac System. But I’m using Red Hat Fedora Core 10 which seems to support all the current Intel Apple Mac System hardware.

Install Fedora Core 10, use a custom installation and install the root area commonly known as / to /dev/sda3 (Apple partition refers this as disk0s3) and select /dev/sda5 as swap.

It is important to note, do not use the installation tools to redo the partitions as it doesn’t play nice with the Mac. So don’t physically create and destroy partitions with the installation tools.

When it ask for a Boot Loader ie such as grub or lilo, do not install it in the Master Boot Record (MBR), install it into the active partition you planned to install linux on ie in this case /dev/sda3. Reason for this is Windows usually writes to the MBR and uses this to boot up (WinXP) but people will argue you can offset this by specifying ie using the rootnoverify and chainloader +1 with grub. The reason why I say this, if you install it in the MBR, rEFit will detect the three system but once you select Windows it will boot the boot loader from the MBR ie lilo or grub. Which defeats the purpose of having a Windows selection to only boot into lilo or grub menu as the idea was to boot straight into Windows.

The installed Boot loaders in the MBR will take precedence over the Boot loaders installed on the actual partitions itself.

8.      On the reboot of your installation of Linux, on the rEFit menu you will see all three flavor of system Mac OSX (Functional), Linux (Functional) and Windows (Non-Functional). While on the refit menu you should sync the GPT to the MBR table has the filesystem ID has changed when you did the Linux installation.

 

9.      Now to get the Windows Functioning, insert the Windows XP installation CD and reinstall from scratch to the designated Windows partition (ie /dev/sda4 or disk0s4) which on the reboot again on the rEFiT menu, sync the GPT and MBR table and the selection of Windows should work. Install the Windows Apple Intel drivers from the installation disc of Mac OSX. This should also install / restore the MBR required for Windows to boot.

 

If you installed the boot grub manager for linux ie lilo or grub onto the MBR instead of a partition you will notice your linux will no longer work as Windows has overwritten the MBR and you have to re-instate the boot loader.

 

There are other ways of getting Windows to work without reinstalling it ie such as repairing it.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

FAQ for common problems in regards to Triple Boot

 

Question: How to reinstate/reinstall the boot loader for Linux?

It depends on the boot loader type usually its grub or lilo but as far as I am concerned lilo is deprecated and superseded by grub thus I will detail it for grub only.

Most Linux distro has a rescue mode which basically gives you a terminal which you can repair or fix things in your installation. Ie with Fedora Core 10 you just boot it into rescue mode or use Fedora Core 10 live CD in the Apple Intel Mac

Run a terminal and type the following (this is for layout suggested I proposed so substitute according)

grub

This will run grub utility

root (hd0,2)

This tells the system where the grub configuration files (ie where the Linux installation is which is on /dev/sda3 or disk0s3 ) are on hard disk 1, partition 3 (Yes everything is of by one in terms of grub)

setup (hd0,2)

Tells grub to reinstall boot loader into /dev/sda3 and not the MBR. If you wanted to install grub into the master boot record , you would type setup (hd0) instead.

 

Question: I tried to boot with a Linux CD / DVD but it stalls on my Intel Apple Mac

I’ve noticed that as well, it not consistent with my Lab of Macs either some boot straight up with no problems where as some take several attempts which finally works.

Hold command+option+p+r on the bootup to clear the NVRAM/PRAM then try booting of the CD / DVD.

You can hold the option key during the boot up to give a list of boot options, or hold down c during the boot to try to boot CD/DVD

It will work eventually as I found out but I wished there was some consistency so keep trying.

 

Question: When I try to boot Windows XP from rEFiT, it says there is no boot system

Windows XP uses the MBR and sounds like it has been damaged. So you have to reinstate the MBR for Windows XP. Insert Windows XP and boot it into the recovery prompt and type “fixmbr”.

 

Question: When I select Windows from rEFit it boot Linux

rEFIt automatically detects installed Operating Systems on the fly. In saying this WinXP uses the MBR and you have overwritten it with a Linux Boot Loader. You need to reinstall / reinstate the Windows Boot Loader. (Please refer to the answer to Question “When I try to boot Windows XP, it says there is no boot system”)

 

Question: I accidently destroyed the EFI table, now I can’t reinstall the Mac

If you happened to destroy the EFI table (ie disk0s1) and now you can’t reinstall the Mac ie it has an exclamation mark on it with utilities like gpt, diskutil, parted or fdisk. You have to format the disk with a GUID_partition_scheme.

Boot from the Mac OSX installation DVD, run disk utility and format the disk with GUID_partition_scheme.

 

Question: I’ve screwed my partitions on my Intel Apple Mac and every time I load disk utility it just quits.

Disk Utility can’t understand the partition layout (I think it’s the frontend, it can’t understand complex layouts). You have to manually rectify this by booting Mac OSX installation DVD, run a terminal and using the command line tools like gpt or diskutil to remove / destroy the offending partitions.

 

 

 

 

 

 

Question: I can’t install Windows XP Service Pack 3 on my WinXP saying its out of space.

Apart from the obvious there is a missing registry key telling where it can store its temp file. Click start and select run and type regedit.

Navigate to HKEY_LOCAL_MACHINE -> Software -> Microsoft -> Windows -> CurrentVersion -> Setup

Right Click and select New String Value, set the Name to “BootDir” and set the value to “C:\” then install SP3.