May 25, 2001
If you're reading this, you probably already know that RAID is a Redundant Array of Inexpensive Disks, or as my Networking teacher used to call it a Redundant Array of Independent Disks (He didn't like the acronym suggesting that he hadn't paid a lot for those drives). It lets you use multiple disks to create one really large drive, or to create a fault-tolerant backup system in case of problems with one disk. If you want to know more about the various kinds of RAID, check out the Software RAID HOWTO on page 2.
This document assumes you already know what kind of RAID you want to put together, that you have installed the raidtools package (I used version 0.90, which came with Red Hat 7.0), and that you already have the drives installed properly.
I'm not going to bother much with disclaimers, but let me say this... If you have anything on the disks you want to use for your RAID, back it up now or you will lose it. Also, be aware that RAID on Linux is still in development; the raidtools are still an alpha release.
Note that initializing RAID devices destroys all of the
data on the consituent devices.
- mkraid man page, mkraid(8)
First, you need to make sure your kernel has multi-device (MD) support. If you built your own kernel, scan through .config for CONFIG_MD and the RAID options that immediately follow. If your kernel came with your distribution, it may or may not be supported, and you may need to recompile. Kernels lower than 2.2 need to be specially patched to support RAID.
# Multi-device support (RAID and LVM)
# CONFIG_MD_LINEAR is not set
# CONFIG_MD_RAID0 is not set
# CONFIG_MD_RAID5 is not set
# CONFIG_BLK_DEV_LVM is not set
Next, you need to set up your raidtab file. You should hopefully have some sample scripts that came with your version of raidtools. If that is the case, then your work is largely done for you. Copy the file to /etc/raidtab and make any changes needed. The Software RAID HOWTO page 4 has information on how to set up your raidtab.
The following example is for a RAID 1 using drives /dev/hdb1 and /dev/hdc1 as mirrors.
# Sample raid-1 configuration
If the raidtab file is set up properly all you need to do is run mkraid.
Once the raid is started, you may want to format the drive. Slight variations in disk size can produce problems when it comes time to write to the disk; creating a new filesystem on the RAID device will take care of this.
You should now have a working RAID.