Repairing Broken Sectors
- Mark the device as failed in the array
mdadm <raid dev> -f <problem device>
- Remove the failed device from the array
mdadm <raid dev> -r <problem device>
- Make the drive read all its sectors to detect all the problems
dd if=<problem device> of=/dev/null conv=noerror
- With the problems known to the drive, erase all its data so it can do sector re-mapping
dd if=/dev/zero of=<problem device> bs=8192
- Verify the drive has no bad sectors now
smartctl -t long <problem device>
- Wait for test completion
smartctl -l selftest <problem device>
- Re-create the partition table
parted <known good RAID member> unit s print # Learn what a correct geometry looks like parted <problem device> mklabel gpt mkpart primary <start>s <end>s # Configure the correct geometry
- Make sure the system is aware of the newly created partition
partprobe <problem device>
- Add the device into the array
mdadm <raid dev> -a <problem device>
- Monitor RAID rebuild progress
cat /proc/mdstat
Forcing Drive Detection
- You have to know which SCSI host (bus) to scan, but once that is known:
echo "- - -" > /sys/class/scsi_host/host#/scan