forked from wkettler/nexenta-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clear-iostat-sd.sh
35 lines (26 loc) · 981 Bytes
/
clear-iostat-sd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/sh
#
# clear-iostat-sd.sh
#
# This script will clear sd_errstats of a disk. If the disk is called sd3, the argument will be 3
#
# John McLaughlin <[email protected]>
#
if [ $# -ne 1 ]; then
echo Usage : $0 disk-number
exit
fi
# get the address in the kernel of kstat object
sd=`echo "*sd_state::softstate 0t$1" | mdb -kw`
es=`echo "$sd::print struct sd_lun un_errstats"| mdb -k | cut -d" " -f3`
ks=`echo "$es::print kstat_t ks_data" | mdb -k | cut -d" " -f3`
echo Resetting Hard Error
# get the address of the error counters, then set them to 0
ha=`echo "$ks::print -a struct sd_errstats sd_harderrs.value.ui32" | mdb -k | cut -d" " -f1`
echo $ha/W 0 | mdb -kw
echo Resetting Soft Error
ha=`echo "$ks::print -a struct sd_errstats sd_softerrs.value.ui32" | mdb -k | cut -d" " -f1`
echo $ha/W 0 | mdb -kw
echo Resetting Tran Error
ha=`echo "$ks::print -a struct sd_errstats sd_transerrs.value.ui32" | mdb -k | cut -d" " -f1`
echo $ha/W 0 | mdb -kw