This how-to is made to help you configure your software raid and boot your root from it.

I’m doing this on slackware 10 with updated udev and mdadm, kernel 2.6.11-rc4

first you need to make sure that your raid support is IN your kernel, not as modules.
here is my config:
/usr/src/linux# grep -i raid .config
# Multi-device support (RAID and LVM)
# CONFIG_MD_RAID10 is not set
# CONFIG_MD_RAID5 is not set
# CONFIG_MD_RAID6 is not set

I have a small /dev/hda1 partition that I used to install the system and configure the latest kernel.

here is how my two drives are partitioned:
~# fdisk -l /dev/hda

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 255 2048256 83 Linux
/dev/hda2 256 498 1951897+ 82 Linux swap
/dev/hda3 499 3537 24410767+ fd Linux raid autodetect
/dev/hda4 3538 19457 127877400 fd Linux raid autodetect

/dev/hdc is the same.

so, I have /dev/hda1 as a boot partition
/dev/hdc1 as a temp root partition
/dev/hd[ac]2 for swap
/dev/hd[ac]3 for /
/dev/hd[ac]4 for /home

when you create your partitions use FD not 83 for partition type if you want your raid to be detected at boot later…

now just execute the following:
mdadm –create /dev/md0 –chunk=32 –level=1 –raid-devices 2 /dev/hd[ac]3

this will create a raid1 device for / on /dev/md0

mdadm –create /dev/md1 –chunk=32 –level=1 –raid-devices 2 /dev/hd[ac]4

and finally a /dev/md1 for the /home partition under raid1 again

Now you can observe /proc/mdstat. You’ll have something like:

~# cat /proc/mdstat

md1 : active raid1 hdc4[1] hda4[0]
127877312 blocks [2/2] [UU]
md0 : active raid1 hdc3[1] hda3[0]
24410688 blocks [2/2] [UU]
[================>….] resync = 82.5% (20147072/24410688) finish=1.5min speed=46944K/sec

if you have problems with /dev/md* just use –auto after the –create instead of /dev/mdX
and mdadm will create md1 and md2 for your two raids (it will number them by the order of
execution of the mdadm –create command)

mkreiserfs (or whatever fs you prefer) /dev/md0 (or md1 if you have used –auto)

our next task is to move the current installation on the RAID:

mkdir /mnt/newroot
mount /dev/md0(1) /mnt/newroot
cd /

now I use tar to move all my files, that way I’m sure it will preserve my links and perms.

in bash:
(cd /;tar cpf – ./bin ./dev ./proc ./sbin ./tmp ./var ./etc ./lib ./opt ./root ./usr ./sys)|(cd /mnt/newroot;tar xvpf -)

and watch 🙂

you might see some errors in /sys/ but that’s OK
now create home and boot:
mkdir /mnt/newroot/home
mkdir /mnt/newroot/boot

if you have more directories just put them in the list above. I had to use a list because I don’t want to move /boot
(separate partition) and /mnt

create /mnt/newroot/mnt/oldroot 🙂
now edit your /mnt/newroot/etc/fstab. Here is mine:
/dev/hda2 swap swap defaults 0 0
/dev/hdc2 swap swap defaults 0 0
/dev/md0 / reiserfs defaults 1 1
/dev/md1 /home reiserfs defaults 1 2
/dev/hda1 /boot ext2 defaults 1 2
/dev/hdc1 /mnt/oldroot reiserfs defaults 1 2
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0

this should do the work.

and the last one:
vim /etc/lilo.conf

if you have something like:
image = /boot/bzImage-2.6.11
root = /dev/hdc1
label = Linux2.6

add another block:
image = /boot/bzImage-2.6.11
root = /dev/md0
label = Linux2.6RAID

run “lilo”
in this case your kernel will be the same. I assume you are doing the above work under your new kernel.
That means you have raid support

now reboot and choose Linux2.6RAID

Good Luck!