Wednesday, November 24, 2010

How to Triple Boot Your Hackintosh with Windows and Linux

By Whitson Gordon

How to Triple Boot Your Hackintosh with Windows and Linux

How to Triple Boot Your Hackintosh with Windows and LinuxWe've walked through how to triple-boot your Mac with Windows and Linux, but if you're using a shiny new Hackintosh, the process is a bit more complicated. Here's how to get all three operating systems up an running on your new PC.

While the Chameleon bootloader (the default boot screen for your Hackintosh) is a great friend to Hackintosh builders, Windows and Linux try to muck everything up by attempting to take over your computer with their own bootloaders, resetting the active partition, and throwing your partition tables out of sync. There are two ways to triple boot your Hackintosh. The first is very straightforward and allows you a lot of flexibility, while the second is much more complicated but offers other advantages depending on how many hard drives you have. This guide assumes you've already installed Mac OS X as described in our most recent Hackintosh guide, and, if you're using the second method, that you still have the iBoot disc handy. You'll also obviously need the Windows 7 and Linux installation discs as well. If you've got everything ready, follow the instructions below to get Windows 7 and Linux living harmoniously on the same PC.

The Easy Method: Use Multiple Hard Drives

How to Triple Boot Your Hackintosh with Windows and Linux
By far the easiest way to triple boot your Hackintosh is to install your other operating systems to separate hard drives. Chameleon can see operating systems on any hard drive in your computer, and one of the advantages of building a desktop is that you have tons of extra drive bays to fill up. Chances are you probably have some extra drives lying around anyways, so this wouldn't be too out of the way. This method doesn't even warrant a how-to—you just install your extra drives in your system, then install Windows and Linux on each one using the default settings. You can even stick them Linux and Windows on the same drive, if you want—it's only when all three get together that you start to have problems. Photo by Justin Ruckman.

If, for some reason, you want to keep them all on the same drive, roll up your sleeves and read on.

The Complicated Method: One Drive to Boot Them All

Putting all three OSes on one drive isn't difficult, but you do need to perform all the steps correctly and in the right order, or you'll be left with a confused mess on your machine. The only big advantage of this method is if you don't have any extra hard drives lying around, or if you have a large enough SSD and want to take advantage of its speed in all three OSes.

Step One: Partition Your Drive

How to Triple Boot Your Hackintosh with Windows and Linux

Right now, you should have a drive with just one partition containing Snow Leopard (plus your 200MB EFI partition, which won't be visible in Disk Utility). Start up Disk Utility and click on the drive containing OS X in the left sidebar. Head over to the Partition tab, and click on your Mac OS X partition. Hit the plus sign at the bottom of the window twice, so you have a total of three partitions. Head to the upper right-hand corner of the window and name the second partition WINDOWS and the third one LINUX, formatting them both as FAT32 for now. If you need swap space for Linux, you can add a fourth partition, but nowadays this seems pretty unnecessary, so three partitions should be just fine. Hit the Apply button and let it work its magic.

When you're done, insert your Windows 7 installation disc and restart your computer.

Step Two: Install Windows 7

How to Triple Boot Your Hackintosh with Windows and Linux

Boot from the Windows 7 disc and head into the Windows installation. Make sure you do a Custom install, and when you're given a list of hard drives, click on the partition named WINDOWS and hit "Drive Options (Advanced)". Click Format to format the drive as NTFS, and then hit Next to start the installation. Your computer will reboot a few times, but you won't have to mess with it at all, so go away and come back when it prompts you to name your computer.

As always, Windows is the biggest problem child in this debacle. When you reboot, you won't be able to boot into OS X, but that's fine—we'll deal with all that in a moment. First, we're going to get this Linux installation out of the way.

Step Three: Install Linux

For the purposes of this guide, we're going to install Ubuntu 10.04, but you can use another version of Ubuntu if you want, or another distro altogether (like the super awesome Arch Linux). Just make sure you install Linux to the correct partition and make extra sure that you install Grub to the same partition to which you installed Linux, as described below.

How to Triple Boot Your Hackintosh with Windows and Linux

Boot up from your Ubuntu CD and head into the installation. The first few steps are pretty self-explanatory, it's when you get to the partition window that you want to pay attention. Hit "Specify Partitions Manually" and click Next. Double click your Linux partition's entry in the table (at this point, it should be the only FAT32 formatted partition on your drive). Under "Use As", choose your desired filesystem (If you aren't sure, use Ext4, which seems to be the new standard). Check the "Format the Partition" box and choose / as the Mount Point. Hit OK. Before moving on, note the name of your Linux partition—the name will be something like /dev/sda4—and hit the Forward button to continue.

How to Triple Boot Your Hackintosh with Windows and Linux

In the last window, where it says "Ready to Install", hit the Advanced button. Under "Device for boot loader installation", it should say something like /dev/sda. Change this to /dev/sda4, or whatever the name of your Linux partition is. Ordinarily, Grub will install itself to the Master Boot Record of the drive, because it wants to be your primary bootloader. In this case, we're already using Chameleon, so we're just going to stick this on Linux's partition, since we won't be using it to get into Windows or OS X. When you're ready, hit the Install button and let Ubuntu do its thing. When you're done, restart your computer.

How to Triple Boot Your Hackintosh with Windows and Linux

Step Four: Fix the Windows Bootloader You Just Broke

You'd think keeping Grub away from Windows would leave Windows' bootloader untouched, but these operating systems just don't like to play nicely together. Unfortunately, when you first installed Mac OS X, you set your hard drive to use a GUID partition table (GPT), which is not fully compatible with Windows (Windows and Grub really prefer an MBR partition table). Now that you've installed Mac OS X, Windows, and Linux side-by-side, your drive is a GPT/MBR hybrid, and your partition tables are "out of sync". To make the GPT and MBR tables play nicely with one another on the same drive, you need to sync them with a program called gptsync in Linux.

How to Triple Boot Your Hackintosh with Windows and Linux

So, grab your iBoot CD and use it to boot into your new Linux partition (since Chameleon is strangely missing—we'll get to that in a second). Download gptsync from your distro's repositories (though Ubuntu users may want to use the .deb files available here instead of the older versions still in the repositories). Once it's installed, pull up a Terminal window and type:

 gptsync /dev/sda 

where /dev/sda is the drive containing all your partitions. If you aren't sure which one is the one you're using, type in fdisk -l to see a list. Note that you aren't using it on just one of the partitions (e.g. /dev/sda1), you're using it on the entire drive. Once you're done, your computer should successfully boot into Windows whenever you reboot.

Step Five: Set The OS X Partition as Active

When Windows installs, it makes itself the active partition on your computer, which means when you restart, your computer will just boot you into Windows as if OS X and Linux weren't even there. We want the active partition to be our OS X partition, since it contains Chameleon, which lets us choose between the OSes when we start off. To pry Windows' greedy hands off your hard drive, you'll have to boot up from the iBoot CD into OS X and open up Terminal.

Type diskutil list and hit enter to see a list of your drives and their partitions. Note the identifier of your OS X partition (which will be labeled as Apple_HFS Snow Leopard). This should be something like disk0s2. Type sudo -s and enter your password to gain root permissions.

How to Triple Boot Your Hackintosh with Windows and Linux

Next, type in fdisk -u /dev/rdisk0 and hit enter, where rdisk0 corresponds to the first number in your OS X partition's identifier (for example, if its identifier were disk1s2 instead of disk0s2, you would type /dev/rdisk1 instead of rdisk0). Hit y to continue.

Then, type in fdisk -e /dev/rdisk0, where once again, rdisk0 corresponds to the correct partition. Type in p and hit enter, then type f 2, where 2 corresponds to the second number in your partition's identifier (e.g. disk0s2). Hit enter. Enter w at the next prompt, then y to complete the process. Close the Terminal and reboot your computer.


If everything goes well, you should be greeted once again by the familiar Chameleon bootloader, which will now list Mac OS X, Windows, and Linux as available boot options. Double check and make sure each of them boots correctly. If they do, you're finished! Enjoy your new triple-booting PC. If not, you may have done something wrong in the above steps. You can try googling any error codes you get and fixing it that way, or re-syncing the partition tables and trying again, but because of the complications in Windows and the GUID partition table, it might be simplest to just start from scratch. Back up your data in your OS X partition, reformat the entire drive, and start over. It's a pain, but like we said before—these three OSes really, really don't like to get along with one another when you try to put them all on the same drive.

If the pain of starting from scratch is too much to bear, reconsider the multiple-drive option—it won't give you the speed boosts of an SSD (unless you buy three), and it might cost a bit more if you don't already have drives lying around, but on the occasion that you need to reinstall one of the OSes or reformat part of your drive, it will be completely hassle-free, unlike the above method which has me pulling my hair out after just one day.

Lastly, as always, these may not be the only ways to triple boot your Hackintosh, but it's the method that, after a few tries, I've found works pretty well. So, if you have your own preferred method (or tips for others trying this one), share them with us in the comments.

Number of comments
  • Share this:

No comments:

Post a Comment

CrunchyTech

Blog Archive