Debian on XServe HOWTO


The Apple XServe G5 is a fine machine, but there are some eccentricities about it that makes installing Linux on it into a bit of an adventure.

For example, the XServe G5 has multiple drive bays on the front of the machine that look like they should be part of a RAID, but turn out not to be. This means that if you actually want to use them as a RAID, you have to use software RAID.

However, while normal Linux installers can generally set up software RAID for you, they can't on XServe G5s, because of an eccentricity in the Macintosh partition table format—it doesn't have the concept of “partition types”, and Linux installers aren't well-equipped to deal with this.

Before you start

The first thing you need to do is download a Debian PPC CD. I recommend using the Net-install CD image.

If you're using MacOS X, use “hdiutil burn debian-testing-powerpc-netinst.iso” to burn the image to CD.

While you're downloading the CD image, make sure that your XServe has a usable Internet connection. The Debian installer downloads packages from the Internet.

Also, decide how you want to use your disks: whether you want to use three disks as a RAID 5 set, or mirror, or whatever. This will, of course, vary according to what sort of hardware you have.

Linux's software RAID works by partitions rather than by physical disks, so you can, for example, have three mirrored boot partitions on three hard drives, while using RAID 5 to maximize the amount of storage for a “/data” filesystem.

Mountpoint RAID level Disk 1 Partition Disk 2 Partition Disk 3 Partition RAID partition Size Purpose
- (none) /dev/sda1 /dev/sdb1 /dev/sdc1 - 32K Partition table
- (none) /dev/sda2 /dev/sdb2 /dev/sdc2 - 1M YABoot Boot loader
/boot 1 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/md0 200M Holds the kernel for the machine to boot from
/ 1 /dev/sda4 /dev/sdb4 /dev/sdc4 /dev/md1 10G Holds the root file system
/home 5 /dev/sda5 /dev/sdb5 /dev/sdc5 /dev/md2 69.8G Holds users' home directories
One potential arrangement of the three disks in an XServe G5.

Setting up the RAID partitions

Making the initial partition set

First, start by booting from the Debian CD that you just created: Hold down “C” while powering up the CD and pushing the CD into the drive. When it asks you to select an image, use “install-power4”.

Follow the prompts as in a routine install until you get to partitioning the disks.

Now, if you've done this before, you'll probably want to go straight to “Define partitions manually”. First start by selecting a disk. If your disks are of various sizes, selecting the smallest one of the set is probably wise. After you select it, erase the partition table, and then create your new partitions. Don't forget to create a 1M NewWorld boot partition!

When you're creating the partitions, though, except for the NewWorld boot partition, select “Do not use” in the “Use as” section of the partition menu.

Now for the rest of this, I'm going to assume, for the purposes of my explanation, that you've set up the partition scheme in my example above. Your own partitioning scheme is likely to be different than mine (for example, you may well have a /usr partition, or a separate /var, or something like that).

A little note about Linux software RAID

Now normally, you'd set up special RAID partitions on the physical disks, and then have the installer collect them together as RAID partitions. Unfortunately, the installer doesn't give you the option of doing this. Even if it did, it's not capable of recognizing the RAID partitions that you might set up, because Macintosh partitions are typeless (except for that NewWorld boot partition, which it knows about because it's formatted as an HFS filesystem instead of a Linux filesystem).

In the partition editor, make sure you've set all the partitions you've selected to “do not use this partition”. Leave the partitions, just remove the mount points. Then choose “Finish partitioning and write changes to disk”.

Naturally, since there's nothing to install onto, the installer will stall and complain about the lack of a root filesystem. At this point, hit Alt-F2 to go to the second console, and hit Enter to activate the shell.

Now copy the partition tables from the first disk to the other two disks:

dd if=/dev/discs/disc0/part1 of=/dev/discs/disc1/part1 
dd if=/dev/discs/disc0/part1 of=/dev/discs/disc2/part1 

Now go back to the first console and select “Continue”. That'll force it to reread the partition tables again.

Okay, now go back to the second console. Now it's time to actually create the RAID partitions.

To create my layout, let's start with the RAID 1 partitions:

mdadm —create /dev/md/0 -l 1 -n 3 /dev/discs/disc?/part3
mdadm —create /dev/md/1 -l 1 -n 3 /dev/discs/disc?/part4

Now let's make the big RAID 5 partition:

mdadm —create /dev/md/2 -l 5 -n 3 /dev/discs/disc?/part5

So that should give us about 140G of /home, 10G of / and 200M of /boot.

Alright, now you have to switch back to virtual console 1 to tell the installer to reread the partitions again, so that it notices your newly-created RAID partitions. Say “Finish partitioning and write these changes to disk” again, and then when it complains again, select “Continue” again. Then the partitioner will restart, showing you the new RAID partitions.


At some point, the partitions might be confused. The easiest thing to do in this case is to use the partition editor to edit the partitions on the first disk, copy the partition table to the other two disks, and then reboot.

Now you can tell the installer to format the RAID partitions and mount them in the appropriate spots. “RAID Partition 0” should be on /boot, “RAID Partition 1” should be on /, and “RAID Partition 2” should be on /home.

Once you have this set up, just let the install run as normal. By and by, it'll ask you if you want to install yaboot onto /dev/sda2, /dev/sdb2 or /dev/sdc2. Choose /dev/sda2.

Then it'll say “Installing boot loader”, with a progress bar, which will die halfway through with an error. The error is actually “Cannot determine OpenFirmware path for /boot”, but there's nothing in any of the other virtual consoles to say that.

So what you do is this:

umount /target/boot
mdadm —stop /dev/md/0
mount -t ext2 /dev/discs/disc0/part3 /target/boot

There might be some complaints from mount about the filesystem not starting at the start of the partition, but it'll mount what it finds anyway.

And let it try again. This time, it'll work properly. Soon you'll be looking at the “Press Enter to reboot into your new Debian system” screen. If you reboot at this point, then /boot won't mount properly.

So what you need to do is switch to the second console and do this:

mkdir /tmp/mnt
mount -t hfs /dev/discs/disc0/part2 /tmp/mnt

Now if you look in /tmp/mnt, you'll find three files: ofboot.b, yaboot, and yaboot.conf.

First, edit yaboot.conf. Change the “device=” and “partition=” lines in it to say:


That's OpenFirmware for “the first hard drive you detect in the system”. The “partition=3” line tells it where to find the kernel.

After that, edit the file “ofboot.b”. Look for the line that says:

: bootyaboot " Loading second stage bootstrap..." .printf 100 ms load-base release-load-area " /ht@0,f2000000/pci@7/k2-sata-root@c/k2-sata@0/disk@0:2,\yaboot” $boot;

And change it to say:

: bootyaboot " Loading second stage bootstrap..." .printf 100 ms load-base release-load-area " hd:2,\yaboot" $boot ;

Once you've done this, change to / and umount /tmp/mnt.

This boot loader needs to be copied onto the other hard drives now, so do that:

dd if=/dev/sda2 of=/dev/sdb2
dd if=/dev/sda2 of=/dev/sdc2

Once you've done this, go back to the first console and hit Enter to reboot and finish your Debian installation, and then continue as normal. Congratulations, now you have working software RAID on your XServe G5 Debian system!