Kingsfordweg 151, 1043GR Amsterdam, The Netherlands ● 24/7 support — support@novogara.com
Knowledge base

Software RAID with mdadm

Linux software RAID is fast, transparent and portable between machines. It is also silent about failure unless you set up the monitoring.

Look at what you have

cat /proc/mdstat

The first command for anything RAID-related. [UU] means both members are up; [U_] means degraded. A rebuild shows a progress bar and an estimated finish.

mdadm --detail /dev/md0 for the full picture, including the array UUID and each member's role.

Creating an array

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

Then persist the configuration, or the array may come up with a different name after a reboot:

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

update-initramfs -u

That second command is not optional on a root array. Without it the initramfs does not know how to assemble the array and the machine boots into a rescue prompt.

Set up the monitoring, today

A degraded array that nobody notices is a single disk pretending to be redundant. In /etc/mdadm/mdadm.conf:

MAILADDR you@example.com

and make sure mdmonitor is enabled. Better still, alert on it from your monitoring as well — see Prometheus and Grafana. Two independent warnings is the right number for this.

Scrub it monthly

echo check > /sys/block/md0/md/sync_action

This reads every block and finds latent bad sectors before a rebuild does. Most distributions ship a monthly timer for it; confirm yours is actually running. A mismatch count that climbs is a warning worth acting on.

Spares and growing

Add a hot spare so a failure starts rebuilding immediately instead of waiting for a human:

mdadm --manage /dev/md0 --add-spare /dev/sdc1

Growing an array is possible and slow. Expect hours, and take a backup first — it rewrites the layout of every disk:

mdadm --grow /dev/md0 --raid-devices=4

Then grow the filesystem on top, as LVM describes.

Choosing a level

RAID 1
Mirror. Simplest, fastest rebuild, best for anything with a database on it.
RAID 10
Mirrors striped together. The default for four or more disks where performance matters.
RAID 6
Two disks of parity. The sane choice for bulk storage with large drives.
RAID 5
One disk of parity, and a rebuild window long enough to be uncomfortable on modern capacities. Avoid.

It is not a backup

RAID survives a disk. It does not survive rm -rf, ransomware, a controller writing nonsense, or the building. See backups and testing a restore.

Tell us what layout you want before delivery and the machine arrives built that way, rather than rebuilt afterwards — see ordering a server.


Still stuck? Mail support@novogara.com — an engineer answers, at any hour. Back to the knowledge base