Skip to content

Instantly share code, notes, and snippets.

@hgomez
Last active February 6, 2019 11:09
Show Gist options
  • Save hgomez/4539234 to your computer and use it in GitHub Desktop.
Save hgomez/4539234 to your computer and use it in GitHub Desktop.
Sample HDD test script
#!/bin/sh
#
COUNT=2048
BLOCKSIZE=1M
while getopts "c:b:" opt; do
case $opt in
c)
COUNT=$OPTARG
;;
b)
BLOCKSIZE=$OPTARG
;;
esac
done
echo "tests with $COUNT blocks of ${BLOCKSIZE}b"
echo
echo "testing pseudo-IO performances - 1st Pass"
dd if=/dev/zero of=/dev/null bs=$BLOCKSIZE count=$COUNT
echo
echo "testing IO write performances - 1st Pass"
dd if=/dev/zero of=PERFTEST bs=$BLOCKSIZE count=$COUNT oflag=direct
echo
echo "testing IO read performances - 1st Pass"
dd if=PERFTEST of=/dev/null bs=$BLOCKSIZE count=$COUNT
echo
echo "testing IO read performances - 2nd Pass"
dd if=PERFTEST of=/dev/null bs=$BLOCKSIZE count=$COUNT
echo
echo "testing IO write performances - 2nd Pass"
dd if=/dev/zero of=PERFTEST bs=$BLOCKSIZE count=$COUNT oflag=direct
rm -f PERFTEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment