User:SwifT/Complete Handbook/Software RAID

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

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

There are quite some difference between soft- and hardware RAID. These are things like cost, 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
RAID usually takes more disk space then it delivers. E.g. a RAID-1 set of 2 3TB disks delivers you a 3TB RAID disk, that is 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. Nothing is more frustrating then loosing the 2nd disk from your 3 disk RAID-5 set after you did not notice the first disk was out-of-order for months already :-(

Installing the tools
Start with your 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 you filesystem-of-choice:

and off you go.

Boot using GRUB 2.x
When using GRUB 2.x and the root file system is located on a software RAID, add the domdadm parameter to the Kernel parameters in /etc/default/grub:

Adding disk
To add new disk to RAID, you need issue this command:

If RAID have all healthy members, new disk will be added as spare disk (S).

Removing disks
First you need determine what disk you need to remove.

As you can see, there sdd1 marked as failed (F) and RAID missing one of disks ([U_]). To remove that drive you need execute following command:

Now you need to replace sdd disk or add blank space from somewhere.

Sometime you may need remove healthy member. For this you need to mark drive as failed and remove it. That can be done with this one command:

External resources

 * The mdadm page on Wikipedia
 * The Linux-raid kernel list