OS Notes
RAID technology — RAID levels 0, 1, 5, 6, and 10, striping, mirroring, parity, performance characteristics, reliability calculations, and choosing the right RAID level.
Introduction
RAID combines multiple physical disk drives into a single logical unit to achieve goals that no single disk can provide alone — higher performance, greater reliability, or both. The fundamental insight is that by spreading data across multiple disks intelligently, you can read/write faster (parallelism), survive disk failures without data loss (redundancy), or achieve a combination of both.
RAID was proposed in 1988 by researchers at UC Berkeley who observed that many cheap disks working together could outperform a single expensive disk while also being more reliable. Today, RAID is used in virtually every server, data center, and NAS (Network Attached Storage) device.
Core RAID Techniques
Striping
Distributing data across multiple disks so that reads and writes happen in parallel:
Without striping (single disk)
Disk 1: [Block1][Block2][Block3][Block4][Block5][Block6]
Read speed: 1x
With striping (3 disks)
Disk 1: [Block1][Block4]
Disk 2: [Block2][Block5]
Disk 3: [Block3][Block6]
Read speed: up to 3x (three disks working simultaneously)
Mirroring
Writing identical data to two or more disks simultaneously. If one disk fails, the other has a complete copy.
Parity
A calculated value that allows reconstruction of lost data. If you have blocks A, B, and C, and parity P = A XOR B XOR C, then any single missing block can be recalculated from the others.
RAID Levels
RAID 0 — Striping Only (No Redundancy)
- Performance: Excellent (N× read and write speed)
- Redundancy: None — ANY disk failure loses ALL data
- Capacity: 100% (all disk space usable)
- Minimum disks: 2
- Use case: Scratch storage, video editing where speed matters and data is backed up elsewhere
Risk calculation: With N disks, probability of failure within a year ≈ N × single disk failure rate. RAID 0 with 4 disks is 4× more likely to fail than a single disk.
RAID 1 — Mirroring
- Performance: Read speed 2× (read from either disk); Write speed 1× (must write to both)
- Redundancy: Survives 1 disk failure
- Capacity: 50% (half the total disk space is usable)
- Minimum disks: 2
- Use case: Operating system disk, boot drives, critical databases requiring simple redundancy
RAID 5 — Striping with Distributed Parity
| Disk 1 | [A1] [B1] [C1] [Dp] |
| Disk 2 | [A2] [B2] [Cp] [D1] |
| Disk 3 | [A3] [Bp] [C2] [D2] |
| Disk 4 | [Ap] [B3] [C3] [D3] |
Parity is distributed across all disks (not on a dedicated disk) to avoid a parity disk bottleneck.
- Performance: Good read (N-1)×; Write slower (must calculate and write parity)
- Redundancy: Survives 1 disk failure
- Capacity: (N-1)/N — lose one disk's worth to parity (e.g., 4×1TB = 3TB usable)
- Minimum disks: 3
- Use case: General-purpose file servers, web servers — good balance of performance, capacity, and protection
Write penalty: Every write requires reading old data + old parity, calculating new parity, then writing new data + new parity. This "read-modify-write" cycle makes random writes slower.
RAID 6 — Dual Parity
Like RAID 5 but with TWO independent parity calculations (P and Q):
- Redundancy: Survives 2 simultaneous disk failures
- Capacity: (N-2)/N
- Minimum disks: 4
- Use case: Large arrays where the probability of a second failure during rebuild is significant
Why RAID 6 matters: With modern large disks (8-16TB), rebuilding a RAID 5 array after a failure takes 12-24 hours. During that rebuild, the array is vulnerable — if another disk fails, ALL data is lost. RAID 6 protects against this scenario.
RAID 10 (1+0) — Mirrors then Stripes
Combines RAID 1 (mirroring) and RAID 0 (striping):
| Disk 1 | Disk 2 | Disk 3 | Disk 4 | |||
|---|---|---|---|---|---|---|
| [A1] | [A1] | [A2] | [A2] | |||
| [A3] | [A3] | [A4] | [A4] |
- Performance: Excellent read and write (stripe width × mirror read advantage)
- Redundancy: Can lose one disk per mirror pair without data loss
- Capacity: 50% (same as RAID 1)
- Minimum disks: 4
- Use case: Databases (fast random writes), high-performance applications
RAID Level Comparison
| Level | Min Disks | Capacity | Read Speed | Write Speed | Fault Tolerance |
|---|---|---|---|---|---|
| 0 | 2 | N × size | N× | N× | None |
| 1 | 2 | size (50%) | 2× | 1× | 1 disk |
| 5 | 3 | (N-1) × size | (N-1)× | Moderate | 1 disk |
| 6 | 4 | (N-2) × size | (N-2)× | Slow | 2 disks |
| 10 | 4 | N/2 × size | N× | N/2× | 1 per pair |
Hardware RAID vs. Software RAID
Hardware RAID
- Dedicated RAID controller card with its own processor and cache
- Battery-backed write cache (protects against power loss during writes)
- OS sees a single disk — transparent
- Expensive but highest performance
Software RAID
- Implemented by the OS (Linux md, Windows Storage Spaces, ZFS)
- Uses main CPU for parity calculations
- More flexible (easy to reconfigure)
- Free (no special hardware needed)
Choosing the Right RAID Level
Ask these questions:
- How critical is the data? (determines redundancy need)
- What is the read/write pattern? (sequential vs random)
- How much capacity can you sacrifice for protection?
- How many disks are available?
- What is the budget?
General guidelines:
- Temporary/replaceable data → RAID 0
- Critical data, simple setup → RAID 1
- File server, good balance → RAID 5
- Large array, high reliability → RAID 6
- Database, maximum performance + safety → RAID 10
Key Takeaways
- RAID uses multiple disks for performance (striping), reliability (mirroring/parity), or both
- RAID 0 is fastest but provides no protection — data loss on any disk failure
- RAID 1 mirrors data for simple redundancy at 50% capacity cost
- RAID 5 uses distributed parity for space-efficient protection but has write penalty
- RAID 6 survives two simultaneous failures (important for large arrays)
- RAID 10 combines mirroring and striping for best performance with good reliability
- RAID is NOT a backup — it protects against hardware failure, not accidental deletion or ransomware
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for RAID - Redundant Array of Independent Disks.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Operating Systems topic.
Search Terms
operating-systems, operating systems, operating, systems, storage, management, raid, raid - redundant array of independent disks
Related Operating Systems Topics