I have decided to provide a quick software raid how to, since all of the ones I can find online are either not consistant or do not make much sinse.
Software raid in linux seems to be working very well for me and has the same performance as any IDE raid controller I have used.
I choose software raid because my piece of crap server has a on-board promise raid controller that I can not get to work in linux. I have followed serveral examples from on line how to's but none work -- it detects the controller, gives me hde and hdg which are the two drives on the promise controller.
Anyways -- the simplest way to setup software raid,
Compile a customer kernel and include all the hardware that is required, make sure to include raid support into the kernel.
Then make an ISO containing this kernel, I created a directory in my slackware-9.1/kernels dir called util.i and in here add my config, bzImage and a System.map.gz file. I also altered my isolinux/isolinux.cfg file so this was the default kernel loaded from the CD.
You may want to add the "nousb" option to the append line in the isolinux.cfg file for your custom kernel, mine kerenl would lock up the box if I did not add it in. This is because I have added usb support to my kernel and in the slackware initrd.img file, which contains the root file system. The rc.S file tries to load usb support, so the two seems to conflict with one another.
Once the system has booted, with your custom kernel including raid you have to make a raidtab file or import one from a floppy like I did.
I used the following file,
I have two HDD in the machine, one is hde and the second is hdg, so my partition looks like this:
The drives have to have the same partition scheme and the root and home partition are type fd (Linux raid). I am not raiding the swap partitions, performance is not worth it, it is a risk... I guess.
I know that some people like to put there /boot partition by it self, but the I kept receiving messages stating that my boot partition must be on the same drive as my root with I did the mkraid command. Not sure if there is away around it.
So once you have created or imported your raidtab file you must run the following commands.
mkraid -R -c /floppy/raidtab /dev/md0
mkraid -R -c /floppy/raidtab /dev/md1
You must run the command for each md[0-9] device you have, each md device is a set of raided partitions. The "-R" means to force the make, it will complain about there could be data on the drives and do you want to continue. The "-c" specifies the config file to use, the default is /etc/raidtab
This will make the raid device, but do not run them all at once, after each command watch the file /proc/mdstat. This will show the state of the array, I suggest that you wait until each device is finished syncing before doing the next - I am not sure of the out come if you do not.
Once all this is done, you can simple install your favority distro, I use slack, so I ran the setup file, selected my swaps (hde1,hdg1) and then slected my root (/dev/md0) and my home (/dev/md1)
Just make sure you refer to the devices by md[0-9] and not hdXX.
One more think, lilo setup -- I have to do the following - I believe this is because the md0 is a software device and not a physical one.
So to use lilo - like after you build a new kernel or finish the install.
Make your lilo.conf file, boot=/dev/md0 (for me), root=/dev/md0 (for me)
command - lilo
****** then ******
lilo -M /dev/hde
lilo -M /dev/hdg
### This will update the mbr of the physical device - so the boot loader is in the MBR - since the BIOS will not know about /dev/md0 because it does not really exist.
****** then ******
lilo -A /dev/hde
lilo -A /dev/hdg
#### This will mark the partition active - this is also needed so the BIOS will load the MBR for either disk.
*** NOTE the above examples hde and hdg are my device names and yours may differ
Use the correct ones, also you can get away with only running the lilo commands on my hdXXX device and not both, but this way if one drive fails the other will still boot up.
I hope this helps.