Skip to content

Instantly share code, notes, and snippets.

@hydra35
Created June 28, 2012 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydra35/3009586 to your computer and use it in GitHub Desktop.
Save hydra35/3009586 to your computer and use it in GitHub Desktop.
dd testing script
#!/bin/bash
if [ $# -lt 2 ]; then
echo "usage:$0 dev output_dir"
exit 1
fi
DEV="$1"
OUTDIR="$2"
DATASIZE="500" # in MB
mkdir -p $OUTDIR
BLOCK_SIZES="8192 262144"
function run_test()
{
local rc=
block_size=$1
count=`echo "$DATASIZE*1048576/$block_size"|bc`
echo "doing write in ${block_size}B"
rc=$(dd if=/dev/zero of=$DEV bs=$block_size count=$count oflag=direct 2>&1)
echo $rc
echo $rc >"$OUTDIR/dd.write.$block_size.log"
echo
echo "doing read in ${block_size}B"
rc=$(dd of=/dev/null if=$DEV bs=$block_size count=$count iflag=direct 2>&1)
echo $rc
echo $rc >"$OUTDIR/dd.read.$block_size.log"
}
# run all the jobs
for block_size in $BLOCK_SIZES
do
run_test $block_size
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment