Perform bechmarks on the filesystem

From www.ReeltoReel.nl Wiki
Revision as of 19:48, 31 January 2012 by Root (talk | contribs) (Created page with "To test the speed of the filesystem (not the physical disk!) you can use the following script: <pre> #!/bin/bash # USAGE: # ./speed_test.sh /path/to/my/file /path/to/destinat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To test the speed of the filesystem (not the physical disk!) you can use the following script:

#!/bin/bash

# USAGE:
# ./speed_test.sh /path/to/my/file /path/to/destination number_of_tests

NUM_TESTs=$3
SUM=0
for i in $( seq 1 $NUM_TESTs ); do

REC=`dd if=$1 of=$2 2> some_random_file_ ; cat some_random_file_ | cut -d " " -f8 | tail -1`

SUM=`echo $SUM + $REC | bc`

done

RESULT=`echo $SUM / $NUM_TESTs | bc |  awk '{ str1=str1 $0 }END{ print str1 }'`

echo $RESULT MB/s

#clean up
rm some_random_file_
rm $2

to make a big file, use

cat /dev/zero > zerofile

and abort it with CTRL-C after a few seconds.

Alternatively, you can use something like

dd if=/dev/zero of=file.out bs=1MB count=500

to create a 500MB file.


Start the script like this:

./speed_test.sh /mnt/sda1/zerofile /mnt/sdb1/zerofilecopy 3