Introduction

Apple LogoIntel Macs use EFI (Extensible Firmware Interface) instead of the typical BIOS (Basic Input / Output System) that most PCs use. EFI has a standardized specification that, unfortunately, Apple, in their infinite wisdom, decided that they do not need to abide by, and slightly modified their implementation. This makes developing Linux software that interfaces with this system difficult. In fact, there is, as of yet, no reliable method of booting Linux directly through EFI although work is being done by the mactel-linux group, elilo, and Grub2 to allow for this functionality. Part of this system is the use of a partitioning system called GPT (GUID Partition Table) which is used in place of the MBR (Master Boot Record) that would coincide with the use of a BIOS. NOTE: GUID means Globally Unique Identifier, which is basically a unique number that is used to identify something, a partition in this case. There is not much more that is needed to understand about that. Apple also places an “EFI partition” at the very beginning of the disc. This is used as a location to place executables for the EFI system to perform firmware updates.

The Workaround (or Do I need Bootcamp?)

The EFI system was also a major obstacle to getting windows to work on a Mac. As a result, Apple released the needed firmware changes to emulate a “legacy” BIOS and MBR along with a partitioning tool / Windows drivers CD package named Bootcamp. The firmware update allowed what Apple calls a “legacy” operating system to see a BIOS and MBR just like would be expected on a normal PC. There are some limitations to this system and this is what I will attempt to explain here. (Note that the Bootcamp application is not required, just the updated firmware is, which new Macs ship with already).

Emulated MBR Limitations

The MBR can contain bootstrap code (a bootloader such as Grub). For legacy reasons, a MBR only supports 4 partitions, but at some point in time, everyone decided they wanted more than 4 partitions on a disk, and came up with a workaround using an “Extended Boot Record” on one of the four primary partitions that could define multiple other “extended” partitions (also called logical partitions) within one “primary” partition. This all almost goes on unnoticed now to the normal user through the various partitioning tools available, and you can create a large number of partitions on a typical MBR-format hard drive. However, the emulated MBR on a Mac does not know about extended boot records, and thus extended and logical partitions are not possible (at least nobody has figured out how to do it yet). Because an operating system that is not capable of reading the GPT will only see the partitions defined in the MBR, such operating systems are not capable of seeing more than 4 partitions! To most users, this means Windows is the most limited.

What is in the Mac’s MBR

Now, how does the emulated MBR determine which of the partitions on a GPT disk to enter in its table? While it would have been nice to be able to pick and choose what partitions are defined in the emulated MBR, such a method was likely not practical, and what did make sense (and was likely very easy to implement) was to just use the first four partitions defined in the “real” GPT. So, this means that “legacy” operating systems that rely on reading infomation from the MBR can only boot from one of the first four partitions! This includes Windows and most Linux installations. LILO and GRUB are BIOS-based, therefore, they rely on BIOS functions and the MBR partition table to locate partitions and load the Linux kernel. Furthermore, the MBR can get out of sync with that actual GPT, so we have to be aware of that problem too. Ok, so we have the EFI partition, OSX, Windows, and Linux. What about a swap partition or maybe a dedicated home partition?

What You Can Do

Load the Linux Kernel” are the key words here. The Linux kernel includes code to enable the system to read the GPT and access the partitions defined there. This means that once the Linux kernel is loaded, all the partitions on the disk are available to the operating system, not just those in the MBR. All partitions other than the partition containing the linux kernel (usually your root partition [/] or the [/boot] partition if you have it separate) can be used for your Linux install such as [/home], [/var], even [/] (if you keep /boot separate).

Working With This Mess

rEFIt

There are several tools available to users that makes using this compatibility scheme easier. The one most important piece of software I can recommend is rEFIt. rEFIT creates a nice graphical menu to choose your bootable OS with each time the Mac is started, and it is includes EFI Shell access and gptsync (a tool to sync the MBR with the GPT).

Partitioning

Do not use fdisk or cfdisk. These partitioning tools do not support GPT and will modify the MBR, but not the GPT. This will cause issues. parted and gparted now supports GPT (there is also partedmagic). This is a much better option for partitioning. Another option is to use diskutil in OSX. This is the command that Bootcamp interfaces with to resize your OSX partition.

External Disks

Unfortunately, it is even more difficult to boot a legacy OS from an external drive. There is not definitive information about booting a legacy OS from a USB/Firewire disk, but several people have tried, and some have claimed to get it working.

Where to put OSX

Nobody said that OSX has to be one of those first four partitions! Move it wherever you want.

Just Use MBR Only

You can run OSX off a normal MBR-format hard drive, just won’t install to a MBR drive. There is a way to workaround this though. Several people just avoid GPT altogether. NOTE, this will prevent firmware updates since they require GPT and an EFI partition, but you can also keep an install on an GPT external drive. ;)

Special Note for Users with Multiple Hard Drives (Mac Pro)

For some reason multiple hard drives are handled very strangely on the Mac. For the most part, as soon as you choose the drive to boot from, that disk automatically becomes the primary disk. So, even if you have Linux installed on your second hard drive, once you use it as the boot device, it is used as the primary hard drive. This means you need to do some special configuration with Grub to point to the correct partitions for booting. Unfortunately, it doesn’t seem to be consistent. If you are willing to try or experiment, please visit the Ubuntu Apple Intel Forums where there is already a bit of information about the subject. This oddity also seems to apply to external hard drives among the other issues with that (see “External Disks” Section above).

Other Resources:

rEFIt’s “Myths and Facts About Intel Macs” is a great source of information about the Apple EFI system and GPT as well as its “Information Repository

You might also find my Mac Multiboot Guide helpful for setting up a dual-boot or triple-boot (or other multiboot) system.

If you want to take a stab at booting via EFI there are several threads on the subject, as well as the beginnings of some tools to do so.

Wikipedia: EFI, GPT, MBR, BIOS, Bootcamp, Apple-Intel

Tags: , , , , , , , , , , , , , , , ,
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>