Created
June 28, 2012 06:55
-
-
Save hydra35/3009586 to your computer and use it in GitHub Desktop.
dd testing script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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