Build a Linux Software RAID from Scratch - Page 3
Part Two: Last week we considered Linux software RAID's advantages, this week we show you how to do it.
Standby Spare Disk
You may add additional fault-tolerance by adding a standby spare disk. This only works in RAID levels with fault-tolerance, like RAID 1 and RAID 5. Don't bother with RAID 0, because if one disk fails the whole array is broken.
Simply install the extra disk, then add these lines to /etc/raidtab:
nr-spare-disks 1 device /dev/hdd1 spare-disk 0
If all goes well, the standby disk will automatically take over when one of the other disks fail.
We covered a lot of ground in a short space here. Be sure to read The Software-RAID HOWTO for explanations of the options in /etc/raidtab. You'll also find the importance of chunk sizes for performance, and chunk-size gotchas with the Ext2/3 filesystem. And tools for monitoring and querying the array, simulating failures and other useful tests and refinements.
Resources
- Linux-raid mailing list
- The Software-RAID HOWTO
- Chapter 9 of the Linux Cookbook, "Managing Files and Partitions," Chapter 10 "Patching, Customizing, and Upgrading Kernels", Chapter 16 "Backup and Recovery"
- Part 3 of ENP's series on customizing kernels, with links to the first two parts
Updated: The examples in this article included a mistake in the commands used to create and prepare swap partitions for use. We've updated the examples. Thanks to the readers who notified us of the error.