Managing RAID on Linux - Derek Vadala [36]
Figure 3-2. Enable support for specific RAID levels.
You will also notice an option for Multipath I/O support (CONFIG_MD_MULTIPATH). This newer feature of the md driver allows the addressing of a single physical disk using multiple I/O paths (controllers or channels). So if one I/O path becomes unavailable, the disk is still accessible. Multipath I/O support is not covered in this book.
Once you have added the desired options to your kernel configuration, compile the new kernel with support for software RAID.
# make dep
# make bzImage
The new kernel should be located at .../arch/i386/boot/bzImage (for i386-based systems), under the kernel source directory. If you are using a non-Intel machine, look for the compiled kernel image in the directory that is appropriate for your architecture (.../arch/sparc/boot/ on SPARC systems, for example).
Installing the new kernel
Linux kernels are traditionally stored in the /boot directory (usually a dedicated partition) or occasionally in the root directory. Copy the new kernel to the /boot directory, or to the directory where you normally keep your kernels, if you have a nonstandard situation. The following example works on i386-based systems.
# cp arch/i386/boot/bzImage /boot/bzImage.raid
# cp System.map /boot/
You can name the kernel anything you like, but I find it helpful to name it something descriptive. Others prefer to include the version number in the filename. Next, add an entry for the RAID-enabled kernel to the boot loader configuration.
On systems using the Linux Loader (LILO), /etc/lilo.conf contains information about which kernel image is loaded during the system initialization. LILO users might add the following entry to /etc/lilo.conf:
image=/boot/bzImage.raid
label=linux-raid
read-only
root=/dev/sda1
Make sure that you enter the correct root device, if it is not /dev/sda1. Either place this stanza before all the others listed in /etc/lilo.conf, or use the default global keyword to specify which kernel to boot (see the lilo.conf manual page for further details). You can also simply select the Linux-raid kernel from the LILO prompt during startup and avoid changing the default.
# lilo
Added linux-raid *
Added linux-orig
# shutdown -r now
You can also use lilo -R to specify which kernel to load when the system restarts (after you run lilo to rebuild the boot sector). In the following example, the Linux-raid kernel will be loaded the next time the system restarts, even though it is not the default kernel listed in /etc/lilo.conf.
# lilo
Added linux-raid
Added linux-orig *
# lilo -R linux-raid
# shutdown -r now
lilo -R works for only one subsequent reboot. So, once you are satisfied with the new kernel, remember to change the default in /etc/lilo.conf or rearrange the stanzas.
Some distributions are beginning to use the Grand Unified Bootloader (GRUB) instead of LILO. GRUB users can add lines like the following to their /boot/grub/grub.conf file:
title Linux RAID (2.4.18)
root (hd0,0)
kernel /bz.2418 ro root=/dev/sda2
This entry will load the kernel found at /boot/bz.2418 on the first hard disk (hd0,0) using a root device of /dev/sda2, mounted initially as read-only. By default, GRUB will boot the first entry it finds in grub.conf, so you could either place the lines above as the first entry or change the default parameter to reflect the correct kernel.
System initialization
When the system restarts, a message indicates that the md driver has initialized. Each RAID level compiled