mdadm array degraded, or missing after a reboot
A member has dropped out of the array, or the array did not assemble at boot because the configuration no longer matches the disks.
What you see
The array runs with one disk missing, or the device is absent at boot and the filesystem does not mount. /proc/mdstat shows the state.
What is actually wrong
A failing disk, a loose cable, or a mdadm.conf and initramfs that were not updated after the array was changed.
Codes and articles
Fixes (2)
Replace the failed member
The array is degraded but running. Do this promptly — a second failure during a rebuild loses everything on a RAID5.
Read the state and identify the failed device.
cat /proc/mdstatsudo mdadm --detail /dev/md0
Check the health of every remaining member before rebuilding. A rebuild reads every sector of every disk and is exactly when a second marginal drive fails.
for d in /dev/sd{a,b,c,d}; do echo "== $d"; sudo smartctl -H $d; doneThis is the step that separates a routine replacement from losing the array. If a second disk is showing pending sectors, back up before rebuilding, not after.
Remove the failed member.
sudo mdadm --manage /dev/md0 --fail /dev/sdc1 --remove /dev/sdc1Partition the replacement to match, then add it.
sudo sfdisk -d /dev/sda | sudo sfdisk /dev/sdcsudo mdadm --manage /dev/md0 --add /dev/sdc1
Watch the rebuild. Do not reboot during it.
watch -n5 cat /proc/mdstatSet up email alerting so the next failure is noticed on the day it happens.
sudo sed -i 's/^MAILADDR.*/MAILADDR admin@example.com/' /etc/mdadm/mdadm.confsudo mdadm --monitor --scan --test --oneshot
cat /proc/mdstat; sudo mdadm --detail /dev/md0 | grep -E 'State|Active|Working|Failed'Reassemble an array that did not come up
The array is inactive or missing after a reboot.
Look for the members and their superblocks.
sudo mdadm --examine /dev/sd[a-d]1 | grep -E 'Device Role|Array UUID|Events|State'The Events counter is the key number. Members with matching counts can be assembled cleanly; a member several hundred behind was out of the array and must be re-added rather than assembled, or it will corrupt the data.
Assemble by UUID, which is stable across device name changes.
sudo mdadm --assemble --scansudo mdadm --assemble /dev/md0 --uuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
If it will not assemble because a member is behind, force it only after understanding which member and by how much.
sudo mdadm --assemble --force /dev/md0 /dev/sda1 /dev/sdb1Once running, write the configuration and rebuild the initramfs — this is the step whose absence causes the array to vanish at every boot.
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.confsudo update-initramfs -u
The array is assembled from the initramfs before the root filesystem is available, so a configuration written only to /etc is not read at the time it is needed.
Check fstab uses UUIDs rather than /dev/md0, which can change number.
sudo blkid /dev/md0grep md /etc/fstab
sudo rebootcat /proc/mdstat
Related faults
Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.