CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 2 of 6 · 2 min read

Striping and mirroring

Think of two ways to carry a large pile of books. Four people can each carry a quarter, so the pile moves four times faster. Or two people can each carry a full copy, so a pile is safe if one person trips. The analogy stops in one place: carrying a copy costs an extra person, while the cost in RAID is extra disks and extra writes.

In plain words: RAID (redundant array of independent disks) combines several disks into one virtual disk. Striping cuts the data into chunks and spreads the chunks over the disks in turn. Several disks work at once, so the speed grows. Striping alone adds no safety, since the loss of any one disk destroys the whole array. This layout is RAID 0. Mirroring writes each block to two disks, so that one copy survives a failure. This layout is RAID 1. It halves the usable capacity. Combining the two gives RAID 10, where pairs of mirrors are striped.

A worked example (made up to show the idea). An array has six disks of 4 TB each, which is 24 TB of raw space. RAID 0 gives 24 TB and survives no failure. RAID 1 in three mirrored pairs, striped as RAID 10, gives 12 TB. It survives one failure for sure and survives more only if they hit different pairs. After one disk fails, a second failure destroys the array only if it is the partner of the first: 1 chance in 5 among the five survivors.

The key lines. The random failure rate of RAID 0 is higher than that of one disk. With a yearly failure chance of 2% for one disk (made up), six disks give a chance of 1 - 0.98^6 = 11.4% that at least one fails, and the whole array is lost then.

RAID

RAID is a way to combine several physical disks into one logical disk, to gain speed, to survive disk failures, or both. The common layouts are called levels. They differ in how they spread the data, and in what redundancy they keep.

Example: RAID 1 keeps two identical copies of every block on two disks.

Check yourself: 1. What does striping give, and what does it not give? 2. How much usable space do six disks of 4 TB give in RAID 10? 3. Why is RAID 0 less reliable than one disk?