Pcornel
Linux · RAID

Rebuild

Cheat sheet · https://pcornel.dk/topic.php?topic=2775

Back to the Topic

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 status
  • mdadm --detail /dev/md<n> — array state and members
  • mdadm --examine /dev/<dev> — member superblock
  • smartctl -H /dev/<disk> — disk health

Commands

mdadm --detail /dev/md0
mdadm --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

Confirmation

Confirm action

Continue?