User:SwifT/Complete Handbook/Software RAID

Introduction
Redundant Array of Inexpensive Disks (RAID) is a technology to combine multiple disks in order to improve their reliability and/or performance. There is hardware RAID, implemented by the controller on your motherboard or specific extension cards, and there is software RAID, implemented by the kernel.

Advantages of RAID
The main advantages of RAID are reliability and/or performance improvements.

There are vast differences between soft- and hardware RAID. Differences include: cost (monetarily), performance, overhead and flexibility. Of course software RAID comes cheapest. Another advantage of soft- over hardware RAID is that you can easily move you RAID set to another (Linux) computer. With hardware RAID you will depend on the vendor.

Disadvantages of RAID
RAID usually takes more disk space than it delivers. E.g. a RAID-1 set of two 3TB disks delivers a 3TB RAID disk (a reduction of 50%).


 * The time it takes to synchronize you RAID disk (initially and when they need to rebuild).
 * The extra effort to manage and monitor your RAID disks. To make full use of software RAID, you need to learn about disk failures so you don't end up loosing two disks from your 3 disk RAID-5 just because you don't notice failure of the first one.

Installing the Tools
Start with the kernel configuration. After all, the kernel does most of the work:

Get the proper RAID admin tool:

Make sure your RAID disks are started and stopped:

Using Software RAID
To create a simple mirrored disk, make sure you have two partitions that have the same size and bring them together in your first RAID-1 disk:

The disks in the mirror will now be synchronized (also when there is no data or file system yet). you can check the status like this:

Create a filesystem of choice:

Start using the RAID!

Boot Using GRUB 2.x and genkernel's initramfs
When the root file system is located on a software RAID, you need initramfs for automatic assembly. Genkernel's initramfs can be used. Generate the initramfs with  option, or have   in  before generation. Then add the  parameter to the kernel command line (initramfs interprets this parameter, not the kernel itself). Using GRUB 2.x, the parameter can be added to :

Remember to regenerate your configuration file with the following command:

Adding Disks
To add a new disk to the software RAID, issue this command:

If the RAID has healthy members, the new disk will be added as spare disk.

Removing Disks
First determine the disk to be removed.

As you can see, there sdd1 marked as failed  and RAID missing one of disks. To remove the failed drive execute following command:

Physically replace the (sdd) disk or add blank space from another attached location.

Sometimes you may need to remove an healthy member. For this you need to mark drive as failed then remove it from the software RAID set. Perform this action all in one command:

Changing RAID Layout
In some cases it is necessary to change the RAID layout. An example case would be when adding disks to a RAID1 or converting a RAID1 to a RAID5.

External Resources

 * The mdadm page on Wikipedia
 * The Linux RAID kernel list