Xubuntu 7.1 (Gutsy Gibbon) with Software RAID

With an expanding music collection I wanted to avoid the chore of backing up to multiple DVDs by building a RAID server so that at least a hard drive failure would not compromise the collection. This has not been as simple as I had hoped.

Mistake 1: I bought a motherboard specifically because it supported RAID5, but then decided I could not afford 3 disks and ended up using RAID 1. And anyway Linux can use software RAID rather than the Windows driver-based version supported by the motherboard.

I tried a number of approaches before this particular combination worked for me. I am sure there are other more elegant ways of achieving the same end, but hopefully my experience will save somebody else some time.

Starting point

This is a completely new system which has never been formatted. The key components for the installation are

Installation Options

The main trick was to persuade the installer to give the options to set up the RAID array during installation. To get the options

  1. boot from the alternate installation disk
  2. at the main menu hold down F6 (options) until you get the choice of Normal and Expert mode
  3. choose Expert mode
    • it can be worth a “dry run” in normal mode to get used to the principal installation options, but I could not see how to install a RAID system that way
  4. start the installation
  5. the console-based system is pretty tedious and I accepted the defaults for every step except …
  6. when offered the choice to load additional modules choose the MD multi disk option
    • I am writing this from cryptic notes taken during the process so I am not sure of the exact names, but the key one is the multidisk option
    • The configuration I chose does not use LVM but I did selectLVM at this stage. I am not sure if it was ever used.
  7. when the partitioner starts choose manual
    1. My configuration was to create a single big partition on both disks, for the RAID and a small swap partition on both disks which are left “un-RAID-ed”. This is not completely fault tolerant, but should be pretty easy to recover
    2. select the disk to partition
    3. create the main partition and set the Use As option to “Physical Volume for RAID” and set to be bootable
    4. create the swap partition and set Use As option to “swap”
  8. (the following is what I noted down, but may be because I did not read the screen properly)
    1. after specifying the partitions on both disks choose the option to write the changes to disk
    2. a warning message was displayed that there was no active partition
    3. choose continue
    4. the partition manager page is displayed again but with a new option at the top to build the Software RAID
  9. Software RAID installation is done through the MD administration module you added to the installation earlier.  The options I chose were
    1. RAID 1
    2. as /dev/md0
    3. 2 drives
    4. no spares
    5. sda1 and sdb1
  10. When complete the MD administration returns you to the partitioner but there is now a new device to partition, a “RAID device.” Partition this as usual
    1. file system ext3
    2. mount at /
    3. (the bootable option is not available)
  11. Write the changes to disk in Partitioner and this time there is no warning
  12. The installation process continues as usual
  13. When the GRUB installation page came up I chose the default option, i.e. install in the master boot  file of hd0.
    • This means the the RAID array will probably not boot if /dev/sda fails
    • If /dev/sda does fail the plan is to rewire /dev/sdb as /dev/sda (i.e. switch the connectors) and make it bootable with a rescue disk.
    • The RAID array would have to be rebuilt manually after adding a replacement /dev/sdb
  14. The Xubuntu system now boots as normal with md0 as the active partition

The installation now appears to be operating properly and I have begun setting it up as a our local server.  Running cat /proc/mdstat suggests that RAID1 is working fine, and df shows a root partition on /dev/md0 which is the right size, but otherwise it is completely transparent.
Background Reading
As I have explained, the procedure above was the result of several abortive attempts to install a RAID filesystem and get it to boot.  During these experiments through to my eventual success I used the following pages and posts that provided help, reassurance and inspiration, even if I was not always able to follow their advice.  Thanks to all those who took the trouble to share what worked for them.