LFCS 93 š§ RAID ā Concepts
Redundant Array of Independent DisksāRAIDāis not a backup strategy. It is a method of combining multiple physical drives into a single logical unit to achieve one of three goals: increased performance, increased fault tolerance, or both. The LFCS exam expects you to understand the trade-offs between the common RAID levels and to recognize which level fits a given scenario. The concepts are stable across hardware and software implementations, but the exam focuses on Linux software RAID managed by mdadm, where the kernel handles the parity calculations and disk management rather than a dedicated controller card .
Key point: RAID trades capacity for redundancy or speed. RAID 1 and RAID 10 sacrifice half of the raw capacity for fault tolerance. RAID 5 sacrifices the capacity of one drive for parity. RAID 0 sacrifices fault tolerance entirely for speed.
Why RAID exists
The performance problem. A single spinning disk has a physical limit on how fast it can read and write. By spreading data across multiple disksāa technique called stripingāRAID can read and write in parallel, increasing throughput. This is the foundation of RAID 0, which offers no redundancy but significant speed gains .
The failure problem. Disks fail. A RAID 1 array mirrors data across two disks, so if one fails, the other contains an exact copy. The array continues to operate, and the failed disk can be replaced and rebuilt without downtime. This is the simplest form of redundancy .
The capacity problem. Mirroring is expensiveāit halves usable capacity. RAID 5 offers a middle ground: it stripes data across three or more disks and stores parity information distributed across all drives. If any single disk fails, the parity can reconstruct the lost data. The cost is one disk’s worth of capacity, regardless of array size .
The double-failure problem. RAID 5 protects against one disk failure. If a second disk fails during the rebuild process, the array is lost. RAID 6 extends the parity scheme to two independent parity blocks, allowing the array to survive two simultaneous disk failures. The cost is two disks’ worth of capacity and slower write performance due to the additional parity calculation .
The rebuild problem. Rebuilding a failed disk in RAID 5 or 6 places heavy random I/O load on all remaining disks. For large drives (2 TB or more), the rebuild time can be hours or days, and the stress increases the likelihood of a second failure. RAID 10, by contrast, rebuilds by copying from a single mirror partner, with minimal impact on the rest of the array .
The trade-off. RAID 0 maximizes speed and capacity but has zero fault tolerance. RAID 1 maximizes simplicity and read performance but halves capacity. RAID 5 balances capacity and redundancy but has slow rebuilds and write penalties. RAID 6 survives double failures but is even slower on writes. RAID 10 offers the best performance and fastest rebuilds but is the most expensive in terms of raw capacity .
a. RAID 0, 1, and 10: striping and mirroring
RAID 0 (striping) splits data into blocks and writes them across all disks in the array. A file is not stored on one disk; it is scattered across every disk. This allows parallel reads and writes, multiplying throughput. The minimum is two disks. There is no redundancy: if any disk fails, the entire array is lost, and data recovery is impossible without external backups .
RAID 1 (mirroring) writes identical copies of data to two disks. Every write goes to both drives. Reads can come from either drive, potentially doubling read throughput if the controller or software can parallelize them. The usable capacity is the size of one disk. If one disk fails, the other continues to serve data. RAID 1 is the simplest redundant configuration and requires exactly two disks for a basic mirror .
RAID 10 (mirroring plus striping) combines the two. It creates multiple RAID 1 mirrors and then stripes data across those mirrors. For example, with four disks, two pairs are mirrored, and data is striped across the two mirrors. This provides the fault tolerance of RAID 1 with the performance of RAID 0. The minimum is four disks. RAID 10 can survive multiple disk failures as long as no single mirror pair loses both disks. Rebuilds are fast because data is copied from the surviving mirror partner, not reconstructed from parity .
b. RAID 5 and 6: distributed parity
RAID 5 uses block-level striping with parity distributed across all disks. For each stripe of data, parity is calculated and written to one disk. On the next stripe, the parity moves to a different disk. This avoids the write bottleneck of dedicating a single parity disk. If one disk fails, the missing data is reconstructed by reading the surviving data and parity blocks and recalculating the lost value. The minimum is three disks, and the usable capacity is (N-1) disks .
The write penalty is the critical concept. Updating a single block requires reading the old data, reading the old parity, calculating the new parity, and writing both the new data and new parity. This is known as the read-modify-write cycle. For random small writes, RAID 5 is significantly slower than RAID 1 or RAID 10 because every write touches multiple disks .
RAID 6 extends RAID 5 with a second independent parity block. This allows the array to survive two simultaneous disk failures. The minimum is four disks, and the usable capacity is (N-2) disks. The write penalty is even higher because two parity blocks must be calculated and written. RAID 6 is appropriate when large drives make rebuild times long and the risk of a second failure during rebuild is unacceptable .
c. Choosing a RAID level
The choice depends on the workload and the acceptable risk. For a database with heavy random writes, RAID 10 is the standard recommendation because parity calculations make RAID 5 and 6 too slow . For bulk storage where capacity matters more than write speed, RAID 5 or 6 offers better efficiency. For a simple boot mirror, RAID 1 is sufficient.
The capacity math is straightforward. With four 1 TB disks: RAID 0 gives 4 TB, RAID 1 gives 1 TB (if all four are mirrored together) or 2 TB (if two mirrors), RAID 5 gives 3 TB, RAID 6 gives 2 TB, and RAID 10 gives 2 TB. The fault tolerance also scales: RAID 0 survives zero failures, RAID 5 survives one, RAID 6 survives two, and RAID 10 survives one per mirror pair.
Complete Example Session
# ============================================
# PART 1: UNDERSTANDING THE TRADE-OFF
# ============================================
RAID 0: speed, no redundancy.
RAID 1: redundancy, half capacity.
RAID 5: redundancy, one-disk overhead, slow writes.
RAID 6: double redundancy, two-disk overhead, slower writes.
RAID 10: redundancy and speed, half capacity, fast rebuilds.
# ============================================
# PART 2: RAID 0 CAPACITY AND FAULT TOLERANCE
# ============================================
# 4 disks Ć 1 TB
# Usable: 4 TB
# Fault tolerance: 0 disks
# Performance: best read/write
# ============================================
# PART 3: RAID 1 CAPACITY AND FAULT TOLERANCE
# ============================================
# 2 disks Ć 1 TB
# Usable: 1 TB
# Fault tolerance: 1 disk
# Read performance: improved (parallel reads)
# Write performance: slightly reduced (both disks written)
# ============================================
# PART 4: RAID 5 CAPACITY AND FAULT TOLERANCE
# ============================================
# 4 disks Ć 1 TB
# Usable: 3 TB
# Fault tolerance: 1 disk
# Write penalty: read-modify-write for every small update
# ============================================
# PART 5: RAID 6 CAPACITY AND FAULT TOLERANCE
# ============================================
# 4 disks Ć 1 TB
# Usable: 2 TB
# Fault tolerance: 2 disks
# Write penalty: double parity calculation
# ============================================
# PART 6: RAID 10 CAPACITY AND FAULT TOLERANCE
# ============================================
# 4 disks Ć 1 TB
# Usable: 2 TB
# Fault tolerance: 1 disk per mirror (up to 2 if different mirrors fail)
# Rebuild: fast, linear copy from mirror partner
# ============================================
# PART 7: THE REBUILD RISK
# ============================================
# RAID 5 rebuild on large drives:
# - Random I/O on all remaining disks
# - Hours or days of degraded performance
# - Elevated risk of second failure
# RAID 10 rebuild:
# - Linear read from mirror, linear write to new disk
# - Minimal impact on array performance
# ============================================
# PART 8: SOFTWARE VS HARDWARE RAID
# ============================================
# Software RAID (mdadm):
# - Managed by Linux kernel
# - No proprietary controller
# - Easy to move between systems
# Hardware RAID:
# - Dedicated controller card
# - OS sees a single disk
# - Requires driver, less portable
# ============================================
# PART 9: RAID IS NOT BACKUP
# ============================================
# RAID protects against disk failure.
# It does not protect against:
# - Accidental deletion
# - Filesystem corruption
# - Malware
# - Controller failure
# - Theft or disaster
The nine parts trace the conceptual landscape: the trade-off statement, capacity and fault tolerance for each level, the rebuild risk for parity RAID, the software vs hardware distinction, and the backup caveat.
Quick Reference
RAID Levels Compared
| Level | Min Disks | Fault Tolerance | Usable Capacity | Write Performance |
|---|---|---|---|---|
| 0 | 2 | None | 100% | Best |
| 1 | 2 | 1 disk | 50% | Slightly reduced |
| 5 | 3 | 1 disk | (N-1)/N | Poor (random) |
| 6 | 4 | 2 disks | (N-2)/N | Worst (random) |
| 10 | 4 | 1 per mirror | 50% | Good |
mdadm Concepts (for the next chapter)
| Term | Meaning |
|---|---|
/dev/md0 | RAID array device |
/proc/mdstat | Kernel RAID status |
mdadm --detail | Array details |
| Spare | Replacement disk |
Best Practices
ā Do This:
RAID 10 for databases
<!-- Random write performance is critical --> # ā
RAID 6 for large drives
<!-- Survives second failure during rebuild --> # ā
RAID 1 for boot devices
<!-- Simple, reliable mirror --> # ā
ā Don’t Do This:
RAID 0 for critical data
<!-- Any disk failure loses everything --> # ā
RAID 5 with 4 TB drives
<!-- Rebuild takes days; second failure likely --> # ā
RAID as backup
<!-- Does not protect against deletion or malware --> # ā
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| RAID 5 write performance | Read-modify-write cycle | Use RAID 10 for random writes |
| Lost data after double failure | RAID 5 only survives one | Use RAID 6 or RAID 10 |
| Rebuild takes too long | Large drive, parity reconstruction | Plan for redundancy at 2+ disks |
| RAID treated as backup | Confusion about purpose | Implement separate backup strategy |
Real-World Examples
1. RAID 0 Scratch Space
# Temporary data, speed matters, loss acceptable
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
2. RAID 1 Boot Mirror
# Two disks, identical copies
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
3. RAID 5 Bulk Storage
# Three disks, one parity
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
4. RAID 6 Large Array
# Four disks, double parity
mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
5. RAID 10 Database
# Four disks, mirrored stripes
mdadm --create /dev/md0 --level=10 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
6. Check Status
cat /proc/mdstat
7. Detail View
mdadm --detail /dev/md0
8. Mark Failed
mdadm --fail /dev/md0 /dev/sdb
9. Remove Failed
mdadm --remove /dev/md0 /dev/sdb
10. Add Replacement
mdadm --add /dev/md0 /dev/sdf
Visual
RAID 0: Striping
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
ā Disk 1 ā ā Disk 2 ā
ā Block A ā ā Block B ā
ā Block C ā ā Block D ā
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
ā ā
āāāāāāāāāā¬āāāāāāāāā
ā¼
āāāāāāāāāāāāāāāā
ā /dev/md0 ā
ā A B C D ā
āāāāāāāāāāāāāāāā
Data is split across disks. No redundancy.
RAID 1: Mirroring
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
ā Disk 1 ā ā Disk 2 ā
ā Block A ā ā Block A ā
ā Block B ā ā Block B ā
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
ā ā
āāāāāāāāāā¬āāāāāāāāā
ā¼
āāāāāāāāāāāāāāāā
ā /dev/md0 ā
ā A B ā
āāāāāāāāāāāāāāāā
Identical copies. One disk can fail.
RAID 5: Striping with Distributed Parity
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
ā Disk 1 ā ā Disk 2 ā ā Disk 3 ā
ā Block A ā ā Block B ā ā Parity ā
ā Parity ā ā Block C ā ā Block D ā
ā Block E ā ā Parity ā ā Block F ā
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
Parity rotates across disks. One disk can fail.
RAID 6: Double Parity
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
ā Disk 1 ā ā Disk 2 ā ā Disk 3 ā ā Disk 4 ā
ā Block A ā ā Block B ā ā P1 ā ā P2 ā
ā P2 ā ā Block C ā ā Block D ā ā P1 ā
ā Block E ā ā P1 ā ā P2 ā ā Block F ā
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
Two parity blocks. Two disks can fail.
RAID 10: Mirrored Stripes
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
ā Disk 1 ā ā Disk 2 ā ā Disk 3 ā ā Disk 4 ā
ā Block A ā ā Block A ā ā Block B ā ā Block B ā
ā Block C ā ā Block C ā ā Block D ā ā Block D ā
āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā
ā ā ā ā
āāāāāāā¬āāāāāāā āāāāāāā¬āāāāāāā
ā¼ ā¼
āāāāāāāāāāā āāāāāāāāāāā
ā Mirror ā ā Mirror ā
ā A C ā ā B D ā
āāāāāāāāāāā āāāāāāāāāāā
ā ā
āāāāāāāāāāāāā¬āāāāāāāāāāāāāā
ā¼
āāāāāāāāāāāāāāāā
ā /dev/md0 ā
ā A B C D ā
āāāāāāāāāāāāāāāā
Mirror pairs, striped together. Fast rebuilds.
Summary
| Item | Value |
|---|---|
| RAID 0 | Striping, no redundancy, max speed |
| RAID 1 | Mirroring, 1 disk tolerance, 50% capacity |
| RAID 5 | Distributed parity, 1 disk tolerance, (N-1) capacity |
| RAID 6 | Double parity, 2 disk tolerance, (N-2) capacity |
| RAID 10 | Mirrored stripes, fast rebuilds, 50% capacity |
| Minimum disks | R0:2, R1:2, R5:3, R6:4, R10:4 |
| Write penalty | R5/R6 suffer on random writes |
| Rebuild risk | R5/R6 high for large drives |
Key takeaways:
- RAID is about redundancy, not backup. It protects against disk failure, not against deletion, corruption, or disaster .
- RAID 0 offers speed at the cost of all fault tolerance. A single disk failure destroys the array.
- RAID 1 is simple and reliable. Mirroring halves capacity but provides the easiest recovery path.
- RAID 5 balances capacity and redundancy but has a write penalty. Every small write requires a read-modify-write cycle across multiple disks .
- RAID 6 survives double failures but is slower on writes. The second parity block doubles the parity calculation overhead .
- RAID 10 offers the best performance and fastest rebuilds. It is the standard choice for databases and write-heavy workloads .
- Rebuild risk is real. For large drives, RAID 5 and 6 rebuilds can take days and stress the remaining disks, increasing the chance of a second failure .
Remember: RAID combines disks for speed or safety. RAID 0 is fast but fragile. RAID 1 is safe but wasteful. RAID 5 is a compromise that works for read-heavy data but struggles with random writes. RAID 6 protects against double failures at a performance cost. RAID 10 is the performance leader with fast recovery. Choose based on the workload, and never treat RAID as a substitute for backups.
Stop using slow, ad-bloated tool sites! š¤®
š Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
ā
Finance (Mortgage, Interest, Inflation)
ā
Tech (Base64, JSON, Dev Suite, IP)
ā
Health (BMI, BMR, TDEE)
ā
Productivity (Timer, Workspace, QR)
ā”ļø Fast & Private
š No data leaves your device
š 100% Free
š Use it now: https://tools.kandz.me
š Bookmark itāyouāll need it later!