Difference between revisions of "Disk Speed Test"

From James Dooley's Wiki
Jump to: navigation, search
(Created page with "==Overview== Runs hdparm -t, seeker and Nates dd script. By default each test is run 3 times to get a good running average. Outputs are cleaned up to provide usable informati...")
 
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Scripts]]
 
==Overview==
 
==Overview==
  
Line 11: Line 12:
 
==Script==
 
==Script==
  
<code>[javascript,n]
+
<source lang='bash'>
 
#!/bin/bash
 
#!/bin/bash
  
Line 23: Line 24:
 
done
 
done
  
echo "Testing seeker $1"
+
if [ `which seeker 2>/dev/null` ]
for i in `seq 1 $testcount`;
+
then
do
+
echo "Testing seeker $1"
seeker $1 | grep "Results"
+
for i in `seq 1 $testcount`;
done
+
do
 +
seeker $1 | grep "Results"
 +
done
 +
else
 +
echo "Seeker is not installed, please install from rpmforge: 'yum install seeker'"
 +
fi
  
echo "Testing DD pv"
+
if [ `which pv 2>/dev/null` ]
for i in `seq 1 $testcount`;
+
then
do
+
echo "Testing DD pv"
sync
 
 
echo "Write Test"
 
echo "Write Test"
dd if=/dev/zero bs=1M count=2048 2>/dev/null | pv | dd of=$testpath/ddfile 2>/dev/null
+
for i in `seq 1 $testcount`;
 
+
do
sync
+
sync
 +
dd if=/dev/zero bs=1M count=2048 2>/dev/null | dd of=$testpath/ddfile 2>&1 | grep copied
 +
done
 
echo "Read Test"
 
echo "Read Test"
cat $testpath/ddfile | pv > /dev/null
+
for i in `seq 1 $testcount`;
 +
do
 +
sync
 +
cat $testpath/ddfile | pv -trb -s 2G > /dev/null
 +
done
 +
rm -f $testpath/ddfile
 +
else
 +
echo "PV is not installed, please install 'yum install pv'"
 +
fi
 +
</source>
  
rm -f $testpath/ddfile
 
done
 
</code>
 
 
==Usage==
 
==Usage==
<code>[bash,n]
+
<source lang='bash'>
 
sh hdtest <drive path>
 
sh hdtest <drive path>
</code>
+
</source>
  
 
==What to change==
 
==What to change==
  
 
testcount This should be set to the number of times you want this test to run.
 
testcount This should be set to the number of times you want this test to run.

Latest revision as of 14:32, 25 March 2014

Overview

Runs hdparm -t, seeker and Nates dd script.

By default each test is run 3 times to get a good running average.

Outputs are cleaned up to provide usable information

For Nates dd test you will need to have the drive mounted and listed in fstab

Script

#!/bin/bash

testpath=`grep $1 /etc/fstab | awk '{print $2}'`
testcount=3

echo "Testing hdparm -t $1"
for i in `seq 1 $testcount`;
do
	hdparm -t $1 | grep "Timing"
done

if [ `which seeker 2>/dev/null` ]
then
	echo "Testing seeker $1"
	for i in `seq 1 $testcount`;
	do
		seeker $1 | grep "Results"
	done
else
	echo "Seeker is not installed, please install from rpmforge: 'yum install seeker'"
fi

if [ `which pv 2>/dev/null` ]
then
	echo "Testing DD pv"
	echo "Write Test"
	for i in `seq 1 $testcount`;
	do
		sync
		dd if=/dev/zero bs=1M count=2048 2>/dev/null | dd of=$testpath/ddfile 2>&1 | grep copied
	done
	echo "Read Test"
	for i in `seq 1 $testcount`;
	do
		sync
		cat $testpath/ddfile | pv -trb -s 2G > /dev/null
	done
	rm -f $testpath/ddfile
else
	echo "PV is not installed, please install 'yum install pv'"
fi

Usage

sh hdtest <drive path>

What to change

testcount This should be set to the number of times you want this test to run.