Jump to content

[Guide:] Dualbooting OS X and Linux form one HDD


  • Please log in to reply
1 reply to this topic

#1
cryptic unix

cryptic unix

    InsanelyMac Protégé

  • Members
  • Pip
  • 16 posts
Hi,

when setting up a new PC I wanted to dualboot OS X (Snow Leopard) and Linux (CentOS 6.2) from the very same HDD. As this venture took me quite some efforts, I wanted to share my experiences.

First of all you must know about two different partition schemes of HDDs. With Linux (and Windows) you normally use an MBR-layout (mater boot record) to partition your HDD (you can look up more details on wikipedia if you're not aware of this concept). But on the other hand Macs (and therefore OS X) normally uses GPT (GUID Partition Table). Generally both systems are not compatible with each other.

Now OS X is causing some trouble if you want to set up a dualboot system on one HDD. Therefore the commonly given advice is to install OS X on one HDD and use as second HDD for other operating systems. This is applicable if you use a desktop computer but no solution for Note-/Netbooks. OS X can only be installed on a GPT formated disk (but there is a trick to install onto an MBR disk as well, not explained here as you have to alter the OS X installation DVD for this trick). So you have to set up your HDD as GPT. I myself installed OS X first and used the disk utility to partition my HDD. The installation went fine and I was able to boot OS X using Chameleon.
In a second step I installed Linux. The nice thing is that Linux can handel GPT disks as well, so installation of Linux to a GPT disk is not a problem. But the trouble starts when you want to boot both operating systems. If you want to boot an OS you need a boot loader. For a Hackintosh Chameleon or Chimera can do the job. For Linux one normally uses Grub. Lets have a look a them:

Chameleon: is normally installed to the master boot record of a HDD or the equivalent of a GPT disk. And it automatically detects other operating systems, installed to other disks or partitions.
Grub: can be installed into the master boot record or into a partition. Grub can boot other operation systems as well but it must be aware of the existence of the other OS X and therefore needs an additional entry in its configuration file called menu.lst.

With multiple operating systems I normally install Grub into the boot-partitions of the respective Linux system. So I set up the following layout of the HDD:

GPT formated disk, setup during OS X installation:

1. partition: EFI-Partition (automatically generated by OS X)
2. partition: OS X system
3. partition: boot-partition for Linux (Grub installed into this partition)
4. partition: LVM formated partition for Linux (used as swap and root)

After installation of the two systems (OS X and Linux) Chameleon is starting but it only detects OS X, no Linux entry available. So my plan was to to boot using Chameleon, which should then find Grub in the boot partition and then use Grub to boot Linux (Chameleon -> Grub -> Linux). But as Grub wasn't found this was not possible (even after playing with boot flag settings). So I decided to use a hack: a GPT-MBR-hybrid.

This GPT-MBR-hybrid enalbes you to use both systems on the very same HDD. But only 4 partitions will be available in the MBR scheme (that's one the reasons I did only set up 4 partitions), extended partitions are not available with this system. To build this hybride you can use a programm called gptsync. I downloaded it form the internet and used a bootable Knoppix DVD (a Linux system running form a DVD) to boot the PC and to run gptsync via Knoppix.
After having the GPT-MBR-hybrid, the bootflag has to be adjusted and set to the Linux boot partition, containing Grub (can be done using Knoppix and fdisk on this DVD). Only the bootloader will be loaded, that is located on the partition the boot flag is pointing to. So this layout will start Grub when booting the computer. Grub is now able to to start the Linux system, but OS is not visible in the Grub menu by now. To make it available you have to add an entry within the menu.lst, which can be found in /boot/grub/menu.lst. The entry looks like this:

title OS X
   rootnoverify (hd0,1)
   chainloader +1

After this everything is working fine. When the PC is started Grub is shown and lets you choose between Linux and OS X. When you select OS X in Grub Chameleon is started and this is starting OS X. Still there are no entries for Linux visible in Chameleon. So booting OS X looks like this: Grub -> Chameleon -> OS X

Hope this helps.

One final note. Not every version of Grub can handle GPT partitioned disks. So with a different version of Grub (or perhaps Grub2) the steps might be different from what is described here.

#2
p.H

p.H

    InsanelyMac Legend

  • FAQ Team
  • 743 posts
  • Gender:Male
  • Interests:Hackintosh & NBA & COD4 promod
thanks for sharing
Maybe it will do me a favor in future





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy