This is an old revision of the document!
Mdadm Helpers
How do I replace a disk marked as removed from a linux md raid-5 array
If drives are "hot swap", don't need to power off server/pc...
First identify removed drive:
lsblkFind serial number, if necessary:
smartctl -a /dev/sdb | grep Serial
If drive is just remved:
mdadm --zero-superblock /dev/sdXn mdadm /dev/md0 --add /dev/sdXn
If replacing damaged drive, then only:
mdadm /dev/md0 --add /dev/sdXn
Check every drive manually
mdadm --examine /dev/sdX
“not enough to start the array” – error while staring mdadm RAID array
Stop failed array:
mdadm -S /dev/md0
Assemble the pre-existing array:
mdadm -A -f /dev/md0
Test Email Settings
mdadm --monitor --scan --test
If got error: “mdadm: Only one autorebuild process allowed in scan mode, aborting”
mdadm --monitor /dev/md0 --test
Simple Script to read Hdd serial numbers
#!/bin/bash
smartctl -a /dev/sda | grep -i 'Serial';
echo "";
echo "";
for i in {a..z} ; do
echo $i
smartctl -a /dev/sd$i | grep -i 'Serial';
done
A SparesMissing event had been detected on md device
Removing the spares=1 option or just recreating the mdadm.conf from scratch fixes the problem:
/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf.copy
Double check new configuration ad then save as mdadm.conf