Sunday 5 August 2012

Apple macbook pre 2010 with shared partition, OSX, Windows 7 & Debian based Linux

The problem

So recently I tried to upgrade my Snow leopard multibooting macbook up to Mountain Lion, only to run in to a problem, lion will only install on a drive with a GPT partition map, so I had to reformat the drive (it had an MBR partition map)

Now, I then decided it would be a good idea to have a shared drive partition that all the OSs could use and to that end I thought of FAT32 (exFAT32 to be precise), that should work fine yes?

Well yes and no, yes all the OSs I wanted to use can understand the partition format but unless the partition is in the faux MBR partition map rEFIt creates then windows just won't touch it at all :-(

Also although linux's boot-loader grub2, can understand GPT partition maps it is dangerous to let it try to install on a EFI 1.0 firmware mac as it can potentially break the EFI firmware (apparently this is only a bug with apple EFI 1.0, it is all ok in 2.0) and guess what pre 2010 macs all have EFI 1.0 firmware and there is no update for it to 2.0.

All in all if the EFI had been 2.0 then things would have been so much easier, windows 7 64bit can do EFI boot and understand GPT (but only if it is installed via EFI, Why Microsoft Why?!) and grub2 works fine with EFI 2.0.

The solution

So after much trial and error I came up with a solution

1 > wipe the drive and set up as GPT partition
2 > use the mac drive tool to make partitions, one for the shared drive, one for the windows drive and one for the linux drive, in that order. it is important that the order be followed exactly as only the first 3 partitions will be visible in the faux MBR, thats why they must be done first and put at the start of the drive. Then create a partition for OSX and then at the very end of the drive a 10 GB swap partition for linux (you may want to make this bigger or smaller dependent on your needs/dive capacity)

now you should have a drive laid out like so
partition number Type Label
1 exFAT EFI (note this is done for you and you can't see it in the mac drive partitioner at this point)
2 exFAT SHARE
3 exFAT WINDOWS
4 exFAT LINUX
5 mac OS extended (journaled) OSX
6 exFAT SWAP

3 > now install OSX to the 'OSX' partition and boot into OSX and finish its setup
4 > install rEFIt, its easy to do now as its just a next next next finish type GUI installer now (not like it used to be with command line instructions and file copying/linking)
5 > reboot with a the linux install cd in the drive (in my case BackTrack 5), use the alt key to make it boot the cd (rEFIt sometimes picks up the disk if spins up quick enough)
6 > use gparted to change the formatting (but not layout !) of the partitions like so
partition number Type Label
1 exFAT EFI
2 exFAT SHARE
3 NTFS WINDOWS
4 ext4 LINUX
5 mac OS extended (journaled) OSX
6 swap-space SWAP

7 > run the partiton tool from the rEFIt boot menu to synch the faux MBR up
8 > reboot and install windows to the ntfs partition (note you may have to let windows reformat its partition to ntfs even though it already is ntfs, this only happens some times)
9 > reboot and install linux ensuring it AND grub end up on the ext4 partiton, also tell the install to make use of the swap-space partition at this point
10 > reboot, at this point OSX should load fine via the rEFIt menu as may WINDOWS but more likely than not LINUX will not boot (ie rEFIt boot-loader will hang at the penguin screen)
11 > reboot off the linux install disk and use gparted to change the boot flags to look like this
partition number Type Label flags
1 exFAT EFI boot
2 exFAT SHARE
3 NTFS WINDOWS boot
4 ext4 LINUX boot
5 mac OS extended (journaled) OSX
6 swap-space SWAP

12 > reboot, now all your OSs should boot fine from the rEFIt boot-loader menu
13 > boot into your linux OS and install the exFAT driver (this will be specific to your linux distro type, for Debian it is fuse_exfat)

Your done, sit back and enjoy the power of having all 3 major operating systems at your beck and call.

Oh one last thing never let windows format any of the partitions on that drive now or it will break everything, non-EFI installed windows kind of understands GPT but makes a major mess of it !