Creating the RAID Software
Once the discs have been partitioned, we need to create the RAID array (-let's call it /dev/md0) as a RAID 1 type using the mdadm command. The general syntax that we need to use to create a new RAID array is as follows:
mdadm --create /dev/md<raid device> --level=<RAID type> --raid-devices=<number of devices in the array> <partition 1> missing
For example, consider the following:
$ mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 missing
mdadm: /dev/sdb1 appears to contain an ext2fs file system
size=976760000K mtime=Thu Dec 30 04:55:21 2010
Continue creating array? y
mdadm: array /dev/md0 started.This creates a new RAID array called "/dev/md0", of type RAID1, consisting of two devices (-one mirroring the other): the first device being /dev/sdb1 and the second to be added in later (-hence it is specified as missing).
With the RAID array create, we then decide to add the mirroring partition (/dev/sdc1) using the syntax:
mdadm --manage --add /dev/md<raid device> <partition 2>
For example, to add /dev/sdc1 to our example above:
$ mdadm --manage --add /dev/md0 /dev/sdc1
mdadm: added /dev/sdc1
We now have a RAID1 array (/dev/md0) consisting of two mirrored partitions (/dev/sdb1 and /dev/sdc1).