LinuxXVII · Software RAIDRAID levels
RAID1 mirroring - simple and reliable
What you'll learn
- Explain RAID1 mirroring and its trade-offs
- Create a RAID1 array with mdadm
- Identify and replace a failed disk
- Recognise when RAID1 is the right choice
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
RAID1 is the simplest RAID level that provides redundancy. Every block is written to all disks; reads come from any disk. RAID1 is the standard choice for boot disks and small, critical data.
How RAID1 works
$ mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdcmdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device, please ensure that your version of mdadm supports metadata at the start (e.g., v1.2 or later).
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.When to use RAID1
Use RAID1 for:
- Boot disks - the OS image is mirrored, so any disk can fail and the host boots from the surviving one.
- Small, critical data - log volumes, audit trails, configuration files.
- Workloads with mostly reads - boot drives, read-heavy application data.
Do not use RAID1 for:
- Large data volumes (capacity is half the raw size).
- Write-heavy workloads (no performance benefit over a single disk).
- The same goal is better served by RAID10 (which gives both striping and mirroring).
Detecting a failed disk
$ mdadm --detail /dev/md0 | grep -E 'State|Active|Working'State : clean, degraded, recovering
Rebuild Status : 12% complete
Active Devices : 1
Working Devices : 2When a disk fails, the array becomes degraded but stays online. The kernel serves reads from the surviving leg and reconstructs writes to the new disk (or a spare) when it appears. Performance drops because every read becomes a single-disk read.
Replacing a failed disk
$ sudo mdadm /dev/md0 --fail /dev/sdb; sudo mdadm /dev/md0 --remove /dev/sdb; sudo mdadm /dev/md0 --add /dev/sddmdadm: set /dev/sdb faulty in /dev/md0
mdadm: hot removed /dev/sdb from /dev/md0
mdadm: added /dev/sdd
mdadm: rebuild startedIf the disk is failing but has not failed - pending sectors,
occasional read errors - prefer mdadm /dev/md0 --replace /dev/sdb --with /dev/sdd. The array rebuilds onto the spare
while the suspect disk stays in service, so a read error
mid-rebuild is still recoverable. See the degraded-rebuilds
lesson for the full procedure.
Knowledge check
Knowledge check · 3 questions
Q1. What is the fault tolerance of a 2-disk RAID1 array?
Q2. RAID1 has excellent read performance because any disk can serve a read.
Q3. Which of the following are correct uses of RAID1? Select all that apply.
Passing score: 75%. Answers are checked in this browser.