Install Dapper on SATA RAID arrays

Warnings

 * 1) FakeRAID is not supported by Ubuntu. Trying to install Ubuntu on such a partition could easily result in the loss of all your data.
 * 2) This HowTo has been tested for Ubuntu Dapper 6.06

Credit
This HowTo is inspired by and based on the Ubuntu FakeRaidHowto

Purpose
Ubuntu (and Debian) doesn't have support for the SATA RAID (also called FakeRAID since some of the functionality is provided by software) controllers being shipped on recent motherboards (The only distros to support these currently are Gentoo and Fedora Core 5). The software to handle FakeRAID arrays in Linux isdmraid. Dmraid is currently not integrated into the Debian installer or the Ubuntu Live-CD installer. Therefore, one cannot directly install Ubuntu onto such RAID arrays. Previously, one had to install Ubuntu on to a separate partition and then debootstrap Ubuntu. However the Dapper Live-CD can be used to easily install Ubuntu Dapper onto such RAID arrays.

Prerequisites

 * 1) Ubuntu Live-CD (Dapper and more recent releases)
 * 2) Connection to the Internet (Required to download dmraid)

Enable the RAID array
First choose which hard disks to use in the RAID array from the BIOS. Then from the BIOS RAID setup utility configure your RAID array. I used RAID 0 on two 120 GB Seagate SATA hard disks on an nVidia nForce 2 mobo.

Boot from the Ubuntu Live-CD.

Once the Live-CD has booted, start up Synaptic from System->Administration->Synaptic Package Manager

In Synaptic, enable the Universe repository from Settings->Repositories. Click Reload to update the package list. Once the package list has been reloaded, click on the Search button and search for the dmraid package. Mark the package for installation and apply changes.

Partition the RAID array
Once dmraid is installed, start up the partitioner. Click System->Administration->Gnome Partition Editor. This will bring up gParted.

In the drop-down list on the top right hand side, look for an entry similar to this : /dev/mapper/nvidia_gahhaaab. People with VIA chipsets would probably have something like /dev/mapper/viahfciifae or similar.

There will be no partitions on that device (unless you've installed Windows on a partition on the RAID array). Select the unallocated area and create partitions to your liking. I personally prefer to have separate /boot and/home partitions, apart from the root partition /. Apply the changes.

gParted will probably throw up errors saying it can't create the partitions. Once it finishes, you'll see the partitions have been created, but are unformatted. Close gParted, and from a terminal (Applications->Accessories->Terminal), run sudo dmraid -ay This refreshes the partition table. As you may have guessed, everytime you apply any change in gParted, you have to close gParted and refresh the partition table using the above command.

Format the partitions
Restart gParted, select each of the partitions and format them. Or you may want to format the partitions from the terminal itself : sudo mkfs.ext3 /dev/mapper/nvidia_gahhaaab1 for ext3 sudo mkfs.reiserfs /dev/mapper/nvidia_gahhaaab1 for ReiserFS and so on. (Hint: type in mkfs. and press the Tab key twice to see a list of the available formatting tools for the various filesystems)

Mount the partitions
Mount the partitions onto the filesystem (I'm assuming your root partition / is on/dev/mapper/nvidia_gahhaaab1) mkdir /target mount /dev/mapper/nvidia_gahhaaab1 /target Mount the /boot and other partitions that you have created under /target and then mount the dev, proc and sysfs filesystems mkdir /target/dev mount --bind /dev /target/dev mkdir /target/proc mount -t proc proc /target/proc mkdir /target/sys mount -t sysfs sys /target/sys

Install the base system
This installs the base system (you can change dapper to install any other branch) sudo apt-get install debootstrap debootstrap dapper /target Copy files essential for network access cp /etc/apt/sources.list /target/etc/apt cp /etc/resolv.conf /target/etc cp /etc/hosts /target/etc Chroot into the target system and install necessary packages sudo chroot /target apt-cdrom add # save a ton of downloads apt-get update apt-get install ubuntu-base linux-386 ubuntu-desktop dmraid grub When the kernel is being installed, answer no when asked whether you want to stop. When prompted to make symbolic link, say yes. If you want, you can install specific kernels like linux-k7 or linux-686 instead of linux-386. You can find a list of choices at http://packages.ubuntulinux.org/dapper/source/linux-meta. If you prefer LILO, you can install that instead of GRUB.

Setting up bootloader
Setup GRUB using the GRUB shell mkdir /boot/grub cp /lib/grub/i386-pc/stage1 /boot/grub/ cp /lib/grub/i386-pc/stage2 /boot/grub/ grub This will drop you into the GRUB shell. Now to install GRUB device (hd0) /dev/mapper/nvidia_gahhaaab root (hd0,0) setup (hd0) quit In the root command, (hd0,0) defines the partition containing /boot. So if the partition is /dev/mapper/nvidia_gahhaaab2, then GRUB identifies it as (hd0,1) and so on.

Configuring the bootloader
To configure GRUB update-grub Open up /boot/grub/menu.lst in your favourite editor and check the following : Normally savedefault is a good thing, but somehow GRUB can't handle savedefault in this case.
 * 1) The root mentioned in the GRUB entries points to the real root partition.
 * 2) The groot variable points to the partition containing /boot. Remember GRUB starts numbering from 0, and you have to use GRUB's syntax for partitions.
 * 3) Ensure that savedefault is not included in any of the GRUB entries.

Pre-configure you system
Before you reboot into your new system, you need to complete these steps cp /etc/hosts /target/etc/hosts cp /etc/network/interfaces /target/etc/network/interfaces
 * 1) Enter base-config new to configure the base system
 * 2) Exit the chroot by pressing Ctrl-D
 * 3) Edit /target/etc/fstab to put in the details of the partitions
 * 4) Copy essential files to the target system

Reboot into Ubuntu
Reboot the system and boot from the RAID array into your spanking new Ubuntu installation.