Rebuild
Cheat sheet · https://pcornel.dk/topic.php?topic=2775
Answer
A rebuild (resync/recovery) copies or reconstructs data onto a replacement disk after a failure, restoring redundancy.
Remember
Mark the failed disk faulty and remove it (mdadm /dev/md0 --fail /dev/sdX1 --remove /dev/sdX1), partition the new disk like the others, add it (--add). Progress in /proc/mdstat. Rebuild speed limits: /proc/sys/dev/raid/speed_limit_min/max. Avoid heavy load during rebuild.
First checks
cat /proc/mdstat— md arrays and sync statusmdadm --detail /dev/md<n>— array state and membersmdadm --examine /dev/<dev>— member superblocksmartctl -H /dev/<disk>— disk health
Commands
mdadm --detail /dev/md0mdadm --detail --scan
Verify in this order
failed member removed → new disk partitioned → added → recovery copies/reconstructs → array clean
Where it usually breaks
First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2775