Dual Boot Mac OS and Linux

Mac OS and Linux

Since Mac OS is a UNIX system, Linux distributions typically work quite well. However, Macs use the EFI (Extensible Firmware Interface) bootloader rather than a BIOS (Basic Input Output System), which is familiar to Windows users. One way to dual-boot your Mac is to install rEFIt, which will provide a boot menu for selecting OS’s located on different partitions. By following the automatic installation procedure provided in the installer package, rEFIt has been successfully used to install the 64-bit version of RTXI directly from the Live CD onto a Macbook Pro, hardware model 5,5. rEFIt will automatically detect operating systems on any attached partitions, including bootable flash drives.

On the last dialog of the Live CD installer, be sure to click the “Advanced” button and choose to install the boot loader (GRUB) to your root Ubuntu partition, for example /dev/sda3. This will let you chainload from the rEFIt menu to GRUB. Do not install GRUB to the root or boot partition of your Mac HD! You may need to shut down (completely, not just reboot) several times for the rEFIt menu to be completely configured. If it asks you if you want to resync the partition tables, say Yes.

Additional modules you might need

You may need additional modules/drivers to get full functionality of your Mac’s hardware features like the core temperature sensor (!) and the Airport. For a Macbook Pro, excellent instructions can be found in the Ubuntu Community Documentation for various hardware models and Linux versions. For Intel iMacs, try here.

Partitioning Your Hard Drive

Your Mac’s hard drive can be partitioned using Boot Camp or by using the Disk Utility application. Boot Camp should be able to format your new partition correctly in ext3 for Linux. In Disk Utility, just create free space. Also, you can always use the Live CD to format the new partition, but it must be created first. Create the partitions for Linux and swap partitions first, before trying to install Linux. A Ubuntu partition should be at least 10 Gb (recommended 20 Gb). Linux also uses a special type of partition called “swap.” Swapping is the process by which a “page” of memory in RAM is copied to the swap space to free up that page of memory. The combined sizes of the physical memory (RAM) and the swap space is the amount of virtual memory available. The result is that when the system requires more memory than is physically available, the kernel swaps out less used pages and gives memory to the current application or process that needs the memory immediately. Most modern systems will have more than enough RAM for Linux and the swap space will be rarely used. You should not run other intensive applications at the same time as RTXI anyway, if you want the best possible real-time performance. A good rule of thumb is to make the swap partition the same size or up to double the size of the amount of physical RAM you have installed.

Sharing data between Mac OS and Linux

To access the data on the Linux partition from Mac OS, you might try the fuse-ext2 package, which will mount ext2 and ext3 file system devices and/or images with read and write support. This typically will automount the Linux partition. Here is example output of what you might see in Mac OS, where of course the Mac partition is /dev/disk0s2 mounted at the root point:

$ df
/dev/disk0s2 414737280 150904240 263321040 37% /
/dev/disk0s3 72248800 25931624 42647160 38% /Volumes/Untitled

Ubuntu can read but not write to journaled HFS volumes. To mount your Mac HD in Ubuntu (choosing the correct partition and having created a mount point somewhere):

sudo mount -t hfsplus /dev/sda2 /media/MacHD