LinuxXVII · Software RAIDRAID concepts
mdadm RAID concepts - levels, layouts, and failure modes
What you'll learn
- Explain the RAID levels 0, 1, 5, 6, 10 and when to use each
- Understand the trade-offs between performance, capacity, and fault tolerance
- Recognise a degraded array and what to do
- Choose the right RAID level for production workloads
Prerequisites
Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09
RAID (Redundant Array of Independent Disks) provides redundancy and/or performance by combining multiple physical disks into a logical unit. The choice of RAID level depends on the workload and the failure-tolerance budget.
The RAID levels
| Level | Min disks | Fault tolerance | Capacity | Write hole | Use for |
|---|---|---|---|---|---|
| RAID 0 | 2 | 0 disks | N * size | No parity, no redundancy either | Temp scratch, never production data |
| RAID 1 | 2 | (N-1) disks | 1 disk | None | Boot disks, small critical data |
| RAID 5 | 3 | 1 disk | (N-1) * size | Yes - needs PPL, a write journal or a healthy BBU | General-purpose data, only once the write hole is closed |
| RAID 6 | 4 | 2 disks | (N-2) * size | Yes - narrower window, not closed | Large data, longer rebuilds |
| RAID 10 | 4 | (N/2) disks | N/2 * size | None | High-performance, high-reliability, anything that must not corrupt silently |
The write hole column is the one most selection tables omit,
and omitting it is how RAID5 gets chosen for a database. Updating
a parity stripe is two non-atomic writes - the data chunk and the
recomputed parity chunk, on different disks. Lose power between
them and parity no longer matches data, yet the array comes back
clean. The damage surfaces months later, when a disk fails and
md reconstructs from the stale parity and returns plausible,
wrong data with no error anywhere.
Mirroring has no write hole because there is no parity to
recompute. On a parity level, close the hole explicitly with PPL
(--consistency-policy=ppl), a write journal
(--write-journal), or a controller with a verified-good BBU -
and scrub monthly. The lesson linux-raid5-raid6-parity covers
the mechanism and the mitigations in full.
Trade-offs
$ lsblk -o name,size,type,fstype,mdraidNAME SIZE TYPE FSTYPE MDRAID
sda 100G disk
sdb 100G disk
sdc 100G disk
sdd 100G disk
md0 200G raid10 ext4$ cat /proc/mdstatPersonalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md0 : active raid10 sdd[3] sdc[2] sdb[1] sda[0]
204800 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]Common failure modes
$ mdadm --detail /dev/md0 | head -10/dev/md0:
Version : 1.2
Creation Time : Mon Jan 1 10:00:00 2026
Raid Level : raid10
Array Size : 204800 (200.00 MiB 200.00 MB)
Used Dev Size : 102400 (100.00 MiB 100.00 MB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Mon Jan 1 10:00:00 2026
State : cleanWhen a device fails, the array becomes degraded. The kernel continues to serve reads and writes from the remaining devices. Performance drops because the missing data must be reconstructed. Once you replace the failed disk and add it to the array, mdadm rebuilds the array.
$ mdadm /dev/md0 -a /dev/sdemdadm: added /dev/sdeKnowledge check
Knowledge check · 3 questions
Q1. Which RAID level provides the best combination of performance, capacity, and fault tolerance for a large production database?
Q2. RAID provides redundancy and is a substitute for backups.
Q3. Which of the following are correct for production RAID? Select all that apply.
Passing score: 75%. Answers are checked in this browser.