MacOS – Triple Boot Lion+Win7+Linux

macosunixwindows

I have a challenge for you.

I've been doing lots of research, and I've found quite a few questions here left unanswered. I know this is possible, I'm interested in hearing from people who have actually done it and learn from their direct experience.

Currently, I'm running Snow Leopard, dual booting 10.6.8 and Win7 x64 on a MacBook Pro with a single internal HD using Boot Camp. For software development, I need to run linux on the metal (not through VMware or the like) so that I can use Linux KVM. I know I need to repartition and upgrade to 10.7 in the process, but I'm struggling with the best/easiest process to do so.

I have one of the very first aluminum uni-body macs from late 2008.

Hardware Overview:

  • Model Name: MacBook Pro
  • Model Identifier: MacBookPro5,1
  • Processor Name: Intel Core 2 Duo
  • Processor Speed: 2.8 GHz
  • Number Of Processors: 1
  • Total Number Of Cores: 2
  • L2 Cache: 6 MB
  • Memory: 4 GB
  • Bus Speed: 1.07 GHz
  • Boot ROM Version: MBP51.007E.B05
  • SMC Version (system): 1.33f8

CPU Features:

$ sysctl -a | grep machdep.cpu.features
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 CX16 TPR PDCM SSE4.1

Roadblocks:

  • My internal superdrive is old and shot, no read or write
  • 4gb of ram is not enough and I frequently run out with the programs I run like Xcode, Eclipse, Visual Studio 2010, etc
  • My primary hd is damn near completely out of space
  • I've tried booting both Fedora 16 and CentOS 5 live cd's from an external firewire BD-R to no avail.

Silver lining:

  • With the external BD-R I have successfully booted a SL install DVD, so I know it's bootable at least with that one DVD
  • I have iDefrag and have successfully used it to re-organize the data toward the front of the disk so that I could shrink the primary HFS+ volume.
  • I have an external 3TB drive that's completely HFS+ that I can use to dump files on from OSX. There is important data on this disk and it cannot be lost.
  • I also have an external 256GB usb hd that's currently formatted NTFS with some windows stuff on it but could be easily formatted for whatever purpose.
  • I love me some hot terminal action 😉

I found this guide which is a bit outdated, but I think the fundamentals should still apply.

After reading this guide, my plan was to get 2 4GB sticks of ram, a new SSD, install that as the primary drive and load Lion onto it. Exactly how, TBD, you tell me the easiest way. I would then move the current internal HD to an opti-bay expansion like this one (but maybe not exactly this one) and have two internal disks.

With the new hardware in place, the SSD would be one partition, guid partition table (EFI), osx 10.7 only. Then, if I understand things correctly, I could partition the second HD with MBR and install Linux on one half and Win7 on the other half. Presumably, I would need to use rEFIt to see all three in the menu. This guide also talks about Windows having to be the final partition on the disk, I don't know if that still applies if it's the second drive?

Any extra space I could mount from external disks after getting the environments booted, but it's my understanding that you have to boot from internal drives. So far any attempt I've made to boot from external linux usb sticks and live cds have all failed, but it could be to me not blessing or formatting things properly. I honestly think I did things correctly, but I'm not perfect and I could have done something wrong or missed a step. I've tried Apple's own Disk Utility, PenDrive and unetbootin. I've also burned Fedora 16 and CentOS 5 live cds and had no success booting either. Both of them dump me into my existing Windows (oh the irony) when I boot with C or use option and select the cd.

Now, if this is even possible, and you've done this, I have a ton of questions for you. Primarily, how would you suggest a plan of action / order of things I should do so I have a checklist I can run through to get the installations going. However, I'd also like to know more information about any snags you ran into, drivers needed, kernel modules, x11 configs, distro hacks, or anything else you've run into with linux on your macbook. I've read some horror stories about high-pitched speaker squeal and things like that. Everything from precisely what distribution you used to what window manager, no detail is too small.

UPDATE:

Over the weekend I got my internal SuperDrive to read, not write. Don't ask me how or why please. I'm not quite sure what I did, I just jacked around with different CD-R DVD-R media. I'm guessing it's still on it's last leg, but it is having an easier time with this new media.

Best Answer

I have found this guide to installing ArchLinux with Triple Boot on a MacBook Aluminum that was the level of detail I needed, so I will be proceeding with that. It appears to cover everything from the special things needed during install to getting the light sensors and other internal do-dads working post-install with respective drivers.

The main points to overcoming the challenge:

  1. Install all the bits before the upgrade to the existing HD by booting from the internal CD
  2. When installing linux install Grub to the PARTITION, not the device, but since that's fruity you've got to set a few flags on the files to make sure the blocks don't move around on you afterward
  3. After things are installed, remove the superdrive and put in the new HD and install Lion to the second drive using a USB disk install procedure then boot into Lion off that. Refit has problems with booting other OS's off the second device, but off the first device it should work fine.
  4. Post Lion install, optionally re-claim / re-cycle SL disk space. I plan on leaving it alone while I can, but probably two or three months from now wiping it out once I'm confident my Lion workspace is completely functional

Only real potential trouble I can see with this is that if anything goes sideways I've no longer got the internal super drive to boot from which seems to be a necessity for the third-party OS installs. As I said, OSX dvds will boot just fine from the external firewire BD-R. Perhaps having a usb-enclosure for the superdrive would work? I'm just guessing since USB tends to be much more broadly supported than fw. Worst case scenario I open it up again and rip out the functional drive and re-insert the SuperDrive for the repairs, then remove it again, but I can see this potentially causing headaches with device ids and such, particularly in linux where things will reference /dev/sd* If anybody can confirm they have booted a third-party os install from an external USB stick or USB superdrive enclosure I would feel much better.

EDIT:

New partition scheme for those interested:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *320.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Mac                     200.0 GB   disk0s2
   3:                  Apple_HFS Linux                   10.0 GB    disk0s3
   4:       Microsoft Basic Data Windows                 109.6 GB   disk0s4

Note the Apple_HFS next to linux, I specifically formatted this HFS before the windows install so that Windows would not pick it up as C during the installation procedure. During the Linux install procedure I'm going to format with ext3 or ext4.

Order of installs is OSX, Win, Linux. OSX boots from EFI, Windows boots from MBR, and Linux is chain loaded from EFI (refit) to boot from the partition.

EDIT2:

The latest ArchLinux bootable ISO could not boot properly with the default parameters. It would hang infinitely waiting for UDEV UEVENTS. The newer ISO's apparently ship with an open source nVidia driver that blows up on at least a couple of MacBooks. I turned the module off at boot by pressing Tab instead of hitting enter and appending nouveau.modeset=0 to the vmlinuz load parameters. This allowed me to get to a root shell.

EDIT3:

I ran into some trouble getting refit to see Linux after the installation. The installer would only install grub to the device, so I had to manually install my boot loader. It was a bit tricky, and not really well documented in any of the linked guides so I'll attempt to capture exactly what happened.

Installation went through fine, but when I selected Grub, it would only allow me to install it to the device. Knowing that I did not want that, I hit cancel and tried installing it manually. Grub install failed at first. The trouble with that was since I only formatted the partition ext3 and did not adjust the partition table, the Linux partition was not flagged as bootable. So, I had to tweak and re sync.

  1. From the install cd, drop to an alt console with FN+alt+f2 and run parted
  2. From the GNU Parted console, flag the partition bootable by doing toggle 3 boot for me it was 3 since it was /dev/sda3
  3. This jacks your partition table, so, exit to get back to bash and shutdown -h now then, with a fresh set of electrons, boot into refit console and run gptsync
  4. With GPT and MBR now in sync, reboot yet again into the install cd
  5. mount /dev/sda3 /mnt to get back into your hard drive
  6. grub-install --root-directory=/mnt --recheck --no-floppy /dev/sda3 to install grub to the partition
  7. Go double check /mnt/boot/grub/menu.lst to see if everything is ok. For me I ended up having to add the /boot prefixes on the file paths

To try to summarize, neither formatting ext3 nor installing the boot loader to the partition was enough, I needed to touch the partition table to get refit to see it was out of sync and adjust things. I am now successfully triple booting SL, Arch, Win7. I have yet to install the second hard drive.