Wednesday, April 1, 2009

Simple shell scripting - how to test 4 Seagate drives

Title: Testing 4 seagate drives concurrently, 10 times each, and dumping all the results in different files, in different directories.

Downloaded the seagate test "st" utility. The command to run an extensive test on a drive is:

./st -G device
ex:
./st -G /dev/sg0
./st -G /dev/sg1
./st -G /dev/sg2
./st -G /dev/sg3


1. create 4 directories to dump each set of tests in:
mkdir TESTsg0
mkdir TESTsg1
mkdir TESTsg2
mkdir TESTsg3

2. create a run.sh script which takes as arguments the run number (a number such as 1, 2, 3 ... ) and the device to scan, such as sg0, sg1, sg2, sg3. This script outputs the result of the run into the TESTSG# directories created above. For example, running ./run.sh 8 sg3 will dump the outputs of the test into directory and file TESTsg3/test8sg3.txt

#!/bin/sh
RUN=$1
SG=$2
if [ "$RUN" == "" ] ; then
echo "You must run with an argument of the run number: ./run.sh 5 sg0"
RETURNCODE=1
exit $RETURNCODE
fi
echo "Now executing for run $RUN"
./st -G /dev/"$SG" > ./TEST"$SG"/test"$RUN""$SG".txt


3. create a script to test each drive individually, doing 10 runs.

sg0tests.sh

#!/bin/sh
./run.sh 1 sg0
./run.sh 2 sg0
./run.sh 3 sg0
./run.sh 4 sg0
./run.sh 5 sg0
./run.sh 6 sg0
./run.sh 7 sg0
./run.sh 8 sg0
./run.sh 9 sg0
./run.sh 10 sg0

for sg1tests.sh, sg2tests.sh, and sg3tests.sh, replace the sg0 argument with sg1, sg2, and sg3, respectively.


4. To watch the processes while they're running, create a script called myps.sh:

#!/bin/sh
while true
do
clear
ps aux | grep run.sh | grep -v grep
sleep 3
done

No comments:

Post a Comment