/[sysadmin-cookbook]/recepies/smart/smart-relocate-sector.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /recepies/smart/smart-relocate-sector.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 285 - (show annotations)
Wed Dec 28 23:39:34 2011 UTC (12 years, 4 months ago) by dpavlin
File MIME type: application/x-sh
File size: 627 byte(s)
relocated failed sector using hdparm

1 #!/bin/sh -x
2
3 DRIVE=$1
4
5 test -z "$DRIVE" && echo "usage: $0 /dev/sda" && exit
6
7 smartctl -a $DRIVE > /tmp/smart.0
8
9 sector=`smartctl -a $DRIVE | grep 'Completed: read failure' | head -1 | awk '{ print $10 }'`
10
11 if [ ! -z "$sector" ] ; then
12
13 echo $sector
14 hdparm --read-sector $sector $DRIVE
15 smartctl -a $DRIVE > /tmp/smart.1
16 hdparm --write-sector $sector --yes-i-know-what-i-am-doing $DRIVE
17 smartctl -a $DRIVE > /tmp/smart.2
18
19 smartctl -t long $DRIVE
20
21 echo "when smartctl test finishes, re-check your arrays with:"
22 cat /proc/mdstat | grep sdd | cut -d' ' -f1 | xargs -i echo "echo check > /sys/block/{}/md/sync_action"
23
24 fi
25

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26