Skip to content

Instantly share code, notes, and snippets.

@prule
Created December 29, 2014 21:58
Show Gist options
  • Save prule/7f72f27c197dfa750cec to your computer and use it in GitHub Desktop.
Save prule/7f72f27c197dfa750cec to your computer and use it in GitHub Desktop.
Disk speed benchmark script copied from http://www.amsys.co.uk/2013/blog/using-command-line-to-benchmark-disks/#.VKDxQsAGA - added sudo for the purge command.
#!/bin/bash
echo "---------------------"
echo "Write Test Running. Please Wait..."
write=$(dd if=/dev/zero bs=2048k of=tstfile count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
sudo purge
echo ""
echo "Read Test Running. Please Wait..."
read=$(dd if=tstfile bs=2048k of=/dev/null count=1024 2>&1 | grep sec | awk '{print $1 / 1024 / 1024 / $5, "MB/sec" }')
clear
echo ""
echo "Read Speed is: $read"
echo "Write Speed is: $write"
echo "---------------------"
echo "Cleaning up. Please Wait..."
sudo purge
rm tstfile
echo ""
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment