I am in the process of setting up one of my new servers. Yes my old dual pIII machines are going to retire. They are going to live in a “retirement community” :P. Any way This time around I am going to use a mirror to protect my data. I never experienced a hardware failure before but I figure better safe than sorry right? So I am going to outline the steps needed to boot from a RAID0.

 

modprobe raid1 
mknod /dev/md1 b 9 1 
mknod /dev/md2 b 9 2 
mknod /dev/md3 b 9 3

Now setup your /boot swap and / partitions on your first disk (I will assume sda). After you have created your partitions we need to make the second drive partition table match. (I assume your drives are the same size)

 

sfdisk -d /dev/sda | sfdisk /dev/sdb

Now we need to create the raids using mdadm

 

mdadm --create --verbose /dev/md1 --level=1 \ 
--raid-devices=2 /dev/sda1 /dev/sdb1 
mdadm --create --verbose /dev/md2 --level=1 \ 
--raid-devices=2 /dev/sda2 /dev/sdb2 
mdadm --create --verbose /dev/md3 --level=1 \ 
--raid-devices=2 /dev/sda3 /dev/sdb3

Or if you are lazy like me

 

for i in `seq 1 3`; do mknod /dev/md$i b 9 $i;\ 
mdadm --create /dev/md$i --level=1 --raid-devices=2\ 
/dev/sda$i /dev/sdb$i; done

Backup your raid config

 

mdadm --detail --scan >> /etc/mdadm.conf

You can monitor the status of your raids via /proc/mdstat

 

watch -n .1 "cat /proc/mdstat"

Once the raid is done syncing you need to create your file systems on your md devices and proceed with the normal install routine. You need to do a bit of extra work when installing grub to make sure its installed on both devices, as well as allows you extra options in case of raid failure.

 

grub>device (hd0) /dev/sda 
grub>root (hd0,0) 
grub>setup (hd0) 
grub>device (hd0) /dev/sdb 
grub>root (hd0,0) 
grub>setup (hd0)
grub.conf
default 0 
timeout 30 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz  

title=Gentoo (2.6.17-gentoo-r7) 
        root (hd0,0) 
        kernel /boot/vmlinuz-2.6.17-gentoo-r7 root=/dev/md3  

title=Gentoo (2.6.17-gentoo-r7) [mirror recovery] 
        root (hd1,0) 
        kernel /boot/vmlinuz-2.6.17-gentoo-r7 root=/dev/md3
 
 
 [backdated from old website]