Skip to main content
RunBook Academy

LinuxXVII · Software RAIDRAID concepts

mdadm RAID concepts - levels, layouts, and failure modes

Foundation⏱ ~10 minbashmdadmcatlsblk

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

Not yet marked complete on this device.

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

LevelMin disksFault toleranceCapacityWrite holeUse for
RAID 020 disksN * sizeNo parity, no redundancy eitherTemp scratch, never production data
RAID 12(N-1) disks1 diskNoneBoot disks, small critical data
RAID 531 disk(N-1) * sizeYes - needs PPL, a write journal or a healthy BBUGeneral-purpose data, only once the write hole is closed
RAID 642 disks(N-2) * sizeYes - narrower window, not closedLarge data, longer rebuilds
RAID 104(N/2) disksN/2 * sizeNoneHigh-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

Read-only / Safemdadm array
$ lsblk -o name,size,type,fstype,mdraid
NAME          SIZE TYPE FSTYPE MDRAID
sda          100G disk
sdb          100G disk
sdc          100G disk
sdd          100G disk
md0          200G raid10 ext4
Read-only / Safemdstat
$ cat /proc/mdstat
Personalities : [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

Read-only / Safemdadm detail
$ 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 : clean

When 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.

Configuration changeadd new disk to array
$ mdadm /dev/md0 -a /dev/sde
mdadm: added /dev/sde

Knowledge check

Knowledge check · 3 questions

  1. Q1. Which RAID level provides the best combination of performance, capacity, and fault tolerance for a large production database?

  2. Q2. RAID provides redundancy and is a substitute for backups.

  3. Q3. Which of the following are correct for production RAID? Select all that apply.

Passing score: 75%. Answers are checked in this browser.