Linux on Mac with multiple drives – by Larry Edwards

Larry has been following my original post about running Linux on a Mac Pro with multiple drives, and had some dramas himself. He kindly posted his findings in a comment on that thread, so I’m re-posting them here as they might be helpful for someone else.

Here’s a short how-to on installing Linux (running under BIOS emulation) on a Mac Pro with multiple disks. I’ve done this with both RHEL6 and Kubuntu 10.10. RHEL6 requires a third party tool, Kubuntu does not.

One thing to note is that fan control under Linux is less sophisticated than under OS X. Under OS X, my Mac Pro is usually almost silent, whereas with both Linux versions, the fans are always quite noticeable, although not as loud as my old Dell PC.

My setup:

2010 2.66 GHz 12 Core Mac Pro
4 disks, the disks in the first two drive bays make up a RAID mirror
Mac OS X 10.6.6 installed on the RAID mirror

Goal: install Linux, in particular RHEL6, on the disk in the 3rd drive bay of my Mac Pro

WARNING: mistakes or errors in the following can cause you to lose all your data. Follow the procedure at your own risk, and backup any and all disks that contain data that matters to you. This worked for me, it may not work for you.

Preliminary Preparation for RHEL6 (you’ll need Xcode installed)
————————————————

1) Download the rEFIt 0.14 source code:

http://sourceforge.net/projects/refit/files/rEFIt/0.14/refit-src-0.14.tar.gz/download

2) Move the downloaded tar file to some place reasonable and double-click to extract the archive contents. This should create a refit-src-0.14 directory.

3) Open a terminal and go to the refit-src-0.14/gptsync sub-directory.

4) Compile the source code: make -f Makefile.unix

If you have the 10.4 SDK installed, this will fail and you’ll have to edit Makefile.unix, commenting out lines that refer to:

/Developer/SDKs/MacOSX10.4u.sdk.

5) This should create two executables:

gptsync
showpart

6) Now in the terminal, sudo tcsh (or sudo bash) to get admin privileges, and move the executables to somewhere useful, e.g., /usr/sbin.

Procedure for installing RHEL6
———————–

1) Run the “Boot Camp Assistant” app. At the “Create or Remove a Windows Partition” dialog select the disk you will use for Linux, press “Continue” (“Erase and Create a Single Partition for Windows” should be the only possible action) and enter an administrator username/password. When you get to the “Start Windows Installation” dialog, press the “Quit & Install Later” button and exit the program.

Using Boot Camp Assistant is probably not really necessary, everything it does should be possible with “diskutil” and “gpt” command line tools. I use it because it quickly puts the disk in a known correct state.

2) Run the “Disk Utility” app. Select the disk you just initialized with Boot Camp Assistant and select and delete the large Windows MS-DOS (FAT) partition.

At this point you have two options, one: 1) use the Disk Utility app (or diskutil command line tool) to create the desired partition layout for Linux, or 2) create the partition layout within the Linux installer. I assume the latter in the following.

3) Reboot, booting off the RHEL6 installation disk (I used a DVD).

4) Proceed with the installation and when it comes time to partition the disk, choose “Create Custom Layout”. In the free space on your intended Linux disk, create the desired partition layout. I’ve had success with a Linux+swap partition layout (i.e., “/” and swap), a boot+Linux+swap layout, and LVM.

5) When the RHEL6 installation is finished, reboot into Mac OS X.

6) Open a terminal and sudo tcsh or sudo bash to get admin privileges. To determine which device is associated with your Linux disk, run:

diskutil list

Note: the device associated with a specific disk changes across reboots in Mac OS X!

From the commandline run:

gptsync /dev/diskN

where /dev/diskN is the device associated your Linux disk. If you created a Linux+swap partition layout you should see output similar to:

Current GPT partition table:
# Start LBA End LBA Type
1 40 409639 EFI System (FAT)
2 411648 3848329215 Basic Data
3 3848329216 3907028991 Linux Swap

Current MBR partition table:
# A Start LBA End LBA Type
1 1 3907029167 ee EFI Protective

Status: MBR table must be updated.

Proposed new MBR partition table:
# A Start LBA End LBA Type
1 1 409639 ee EFI Protective
2 * 411648 3848329215 83 Linux
3 3848329216 3907028991 82 Linux swap / Solaris

May I update the MBR as printed above? [y/N]

Type ‘y’ and hit return.

That’s it. Your Linux disk should now be an option appearing as “Windows” when you hold down the option key on boot.

NOTE: I occasionally experience a hang after selecting the RHEL6 disk and initiating the boot. There is a short amount of disk activity, and then nothing. The grey screen with the disk icons remains up. I’ve never seen this with Kubuntu, just RHEL6. RHEL6 uses an older GRUB version, so possibly a GRUB bug, although I see a similar problem mentioned in forums on dual booting Windows on Macs (e.g., http://www.insanelymac.com/forum/index.php?showtopic=201737)

Procedure for installing Kubuntu/Ubuntu 10.10
————————————-

For Kubuntu/Ubuntu installation, you don’t need the rEFIt gptsync. The following describes a Kubuntu 10.10 install, I assume Ubuntu 10.10 is essentially identical.

1) Initialize the Linux disk as with RHEL6, but after you delete the Windows partition created by the Boot Camp Assistant app, in the Disk Utility app, create the desired Linux partition layout in the free space. I’ve only tried a Linux+swap layout, but others should work. I usually select the ExFat format for the partitions because that seems to allow more flexibility in sizing than, say, MS-DOS FAT (the format shouldn’t be critical since it will be changed below). Alternatively, use the diskutil command line tool to create the partition layout.

2) Reboot using the Kubuntu 10.10 install disk and proceed with the installation.

3) At the “Allocate drive space” dialog, select “Specify partitions manually (advanced)”

4) In the “Prepare partitions” dialog, look for the Linux drive. It should contain a small ~200MB EFI partition followed by the Linux and swap partitions you created.

5) Select the partition you want to use as the main Linux partition. A small “Edit Partition” dialog should pop up. Select “Ext4″ from the “Use as:” menu, press the “Format the partition” check-box, and the mount point should be /.

6) Select the partition you want to use as swap. In the “Edit partition” dialog, select “swap area” as the “Use as:” choice.

7) Back at the Prepare partitions” dialog, select the “Device for boot loader installation”. You can choose the disk device, for Master Boot Record (MBR) installation or the Linux partition device for Volume Boot Record (VBR) installation (both seem to work, I usually use the MBR). For example, if your Linux disk is /dev/sdb and your Linux partition is /dev/sdb2, choose the /dev/sdb for MBR installation, /dev/sdb2 for VBR. Then press the “Install Now” button.

8) Continue with the installation till done, and reboot.

That’s it. Your Linux disk should now be an option appearing as “Windows” when you hold down the option key on boot.

0 Responses to “Linux on Mac with multiple drives – by Larry Edwards”


  • No Comments

Leave a Reply