--- /dev/null
+#!/bin/sh -x
+
+DRIVE=$1
+
+test -z "$DRIVE" && echo "usage: $0 /dev/sda" && exit
+
+smartctl -a $DRIVE > /tmp/smart.0
+
+sector=`smartctl -a $DRIVE | grep 'Completed: read failure' | head -1 | awk '{ print $10 }'`
+
+if [ ! -z "$sector" ] ; then
+
+ echo $sector
+ hdparm --read-sector $sector $DRIVE
+ smartctl -a $DRIVE > /tmp/smart.1
+ hdparm --write-sector $sector --yes-i-know-what-i-am-doing $DRIVE
+ smartctl -a $DRIVE > /tmp/smart.2
+
+ smartctl -t long $DRIVE
+
+ echo "when smartctl test finishes, re-check your arrays with:"
+ cat /proc/mdstat | grep sdd | cut -d' ' -f1 | xargs -i echo "echo check > /sys/block/{}/md/sync_action"
+
+fi
+