Perform bechmarks on the filesystem

From www.ReeltoReel.nl Wiki
Jump to navigation Jump to search
  • To test the speed of the filesystem (not the physical disk!) you can use the following script:

<syntaxhighlight lang="bash">

  1. !/bin/bash
  1. USAGE:
  2. ./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

  1. clean up

rm some_random_file_ rm $2 </syntaxhighlight>

  • 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

The result will be something like

./speed_test.sh ./zerofile ./2delete 5
237 MB/s