A Fedora Raid
The RAID Device
Fedora Core seems to have done away with the raidtools. If you want to setup a software RAID on your system you have to rely on the mdadm tool instead. I have always felt that the easiest way to setup a RAID with Redhat based systems is to do so at the installation time, since that option has now been ruled out let's look at mdadm instead.
We will attempt to setup a RAID0 (striped) system as swap. Since striping doubles the risk of data loss, you should only use it for mounts that do not hold important data, nothing could be less important than the swap.
The first step is to create two partions of the same size on /dev/hda and /dev/hdb, carefully note down the numbers assigned to these paritions, if you get them wrong you lose all your source code. In my case these partitions were /dev/hda7 and /dev/hdb5.
It's rare for a linux system to need a reboot after a configuration or system change, creating or deleting a partition is one of these rare occaisions. After a restart build the array with the command:
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/hda7 /dev/hdb5
If your command fails for some reason you will probably need to run mdadm --stop /dev/md0 before you try again. You might also need to run mdadm /dev/md1 -f /dev/hda7 -f /dev/hdb5.
Now you need to make sure that your totally memory usage is not higher than the available physical memory. If you have swapped into the existing, partition the swapoff command may cause your machine to get stuck. If the swap is not being used switch off swapping temporarily by calling swapoff -a. If the existing swap is being used, skip the swapon and swapoff steps and your new raid array will be used the next time you boot up.
Now to set the raid array as your swapspace, use the mkswap /dev/md0 command to mark it as swap space. Edit your /etc/fstab/ and add the following entry and comment out the line for the existing swap:
/dev/md0 swap swap defaults 0 0
Now you can switch swapping back on with the swapon -a command and if all goes well your new array will be deteced and used as the swap space. We have not made a permanent record of our RAID configuration and unless we do so the array will not be available the next time we boot up.
Fortunately the mdadm program can automatically build a mdadm.conf file for you but you have to help out by defining what the devices to use. So create an /etc/mdaconf file with the following entry:
DEVICE /dev/hda* /dev/hdb*.
Then follow up with:
mdadm --detail --scan >> /etc/dadm.conf your final result may look like this:
DEVICE /dev/hda* /dev/hdb* ARRAY /dev/md0 level=raid0 num-devices=2 UUID=11710e55:22f133ca:e4442fbc:8ad00ccd devices=/dev/hda7,/dev/hdb5