Managing RAID on Linux - Derek Vadala [35]
Create an array
Kernel Configuration
Software RAID support must be enabled in the kernel before you can create any arrays. This generally means recompiling your kernel, configuring your boot loader (such as LILO or GRUB) to load the new kernel, and, finally, restarting the system with the new kernel.
A Brief History Lesson
Although kernels prior to 2.0.35 shipped with some RAID support, it wasn't until the release of 2.0.35 that support for RAID-1, RAID-4, and RAID-5 became available. The multiple devices (md) driver that provides kernel RAID support is currently at version 0.90. The latest stable kernels in the 2.0 and 2.2 series ship with an outdated version (0.36) of the software RAID driver. Patches for the 0.90 code are available for these older kernels (see the sections below on Kernel 2.2 and Kernel 2.0). Kernels prior to 2.0.35 ship with version 0.35 of the md driver and should not be used, except if you absolutely have to keep them in operation for legacy reasons.
The 0.90 code was finally merged with the kernel source tree during the 2.3 development phase, so 2.4 ships with the latest RAID code. So will all subsequent stable and development kernels. In general, it's best to run at least a 2.4 series kernel when using software RAID, or a 2.2 kernel with the proper RAID patches applied. Using the old 0.36 driver is not recommended.
Along with drivers to provide software RAID for Linux, a set of utilities for managing, configuring, and tuning software arrays has emerged. These utilities, collectively called the RAID Tools (raidtools is the package name), are maintained by Ingo Molnar and Erik Troan of Red Hat and are now included with many major distributions. Molnar also served as the primary developer and maintainer of the software RAID subsystem from version 0.36 through 0.90's integration into the stable kernel tree. Today, he shares that responsibility with Neil Brown, a software engineer at the University of New South Wales. Brown also contributed many performance and reliability-related patches before becoming an official maintainer. In August 2001, Brown began work on his own software RAID utilities for Linux. His multiple devices administration (mdadm) program is a great alternative to the slightly aging raidtools. Both packages are covered in this book. I recommend using mdadm when possible.
Many other programmers have contributed to the md driver since its original development. Marc Zyngier wrote the original implementations of linear mode and RAID-0, along with the predecessor to raidtools. Miguel de Icaza helped develop the first implementation of RAID-1 and wrote the first version of raidtools. Gadi Oxman wrote the first 0.90 implementation of RAID-5.
Kernel 2.4
As of version 2.4, software RAID has its own subsection in the kernel configuration (in previous versions, options were found under the Block Devices submenu). The Multi-device Support (RAID and LVM) submenu contains all the configuration options for software RAID. The first option, CONFIG_MD, is a configuration switch that reveals options for RAID and Logical Volume Management (LVM). After selecting CONFIG_MD, choose CONFIG_BLK_DEV_MD, which allows the kernel to address multiple physical devices through a single logical device (see Figure 3-1). CONFIG_BLK_DEV_MD provides the foundation for the md driver and needs to be enabled on every system that uses software RAID, regardless of which RAID level is implemented.
Figure 3-1. Enabling kernel RAID support.
In order to successfully build a software RAID device, one of the available RAID levels must also be enabled. The following kernel directives enable support for specific RAID levels:
CONFIG_MD_LINEAR
CONFIG_MD_RAID0
CONFIG_MD_RAID1
CONFIG_MD_RAID5
CONFIG_MD_LINEAR and CONFIG_MD_RAID0 enable support for the non-RAID methods of disk grouping supported by the Linux kernel. CONFIG_MD_RAID1 provides support for data redundancy through disk mirroring. Finally, CONFIG_MD_RAID5 enables support for both RAID-4 and RAID-5 layouts. The choice between using RAID-4