#!/bin/bash if [[ ! $1 =~ ^/.+ ]]; then echo "Please provide FULL PATH directory (where files will be created)" exit fi dir=$1 dev=$(df $dir | grep -E '^/dev' | cut -d ' ' -f 1) runtime=10 # in seconds size=128M # size of each file, 16 of these sizes will be created # legge til single thread sync, ref vmware geek hardest test # Create a temp directory (from http://mywiki.wooledge.org/BashFAQ/062) # to store results temp_dir=${TMPDIR:=/tmp}/$(awk -v p=$$ 'BEGIN { srand(); s = rand(); \ sub(/^0./, "", s); printf("%X_%X", p, s) }') # the following line gives me error "line 1: rm: command not found" #trap '[ -n "$temp_dir" ] && \ rm -fr "$temp_dir"' EXIT mkdir -m 700 "$temp_dir" || { echo '!! unable to create a tempdir' >&2; \ temp_dir=; exit 1; } # cd to directory where test will be performed cd $dir cdir=$(pwd) # cdir = consistant dir name in case $1 with/without trailing '/' # Simple sequential read from device with and without buffer cache. # # -t: "This measurement is an indication of how fast the drive can sustain # sequential data reads under Linux, without any filesystem overhead" # # -T: "This measurement is essentially an indication of the throughput of # -the processor, cache, and memory of the system under test" echo "Baseline reads with hdparm" hdparm -tT $dev | tee -a $temp_dir/hdparm_baseline.dat # Sequential read echo "Sequential read" fio --size=128M --direct=1 --rw=read --refill_buffers --ioengine=libaio \ --bs=4k --iodepth=16 --numjobs=16 --runtime=$runtime --group_reporting \ --name=4kseqreadtest | tee -a $temp_dir/4kseqreadtest.dat | grep iops rm $dir/4kseqreadtest* # Sequential write echo "Sequential write" fio --size=128M --direct=1 --rw=write --refill_buffers --ioengine=libaio \ --bs=4k --iodepth=16 --numjobs=16 --runtime=$runtime --group_reporting \ --name=4kseqwritetest | tee -a $temp_dir/4kseqwritetest.dat | grep iops rm $cdir/4kseqwritetest* # Random read echo "Random read" fio --size=128M --direct=1 --rw=randrw --refill_buffers --norandommap \ --randrepeat=0 --ioengine=libaio --bs=4k --rwmixread=100 --iodepth=16 \ --numjobs=16 --runtime=$runtime --group_reporting --name=4krandreadtest \ | tee -a $temp_dir/4krandreadtest.dat | grep iops rm $cdir/4krandreadtest* # Random write echo "Random write" fio --size=128M --direct=1 --rw=randrw --refill_buffers --norandommap \ --randrepeat=0 --ioengine=libaio --bs=4k --rwmixwrite=100 --iodepth=16 \ --numjobs=16 --runtime=$runtime --group_reporting --name=4krandwritetest | tee -a \ $temp_dir/4krandwritetest.dat | grep iops rm $cdir/4krandwritetest* # Combined workload from Storage Review # http://www.storagereview.com/fio_flexible_i_o_tester_synthetic_benchmark echo "Mixed 70/30 random read and write with 8K block size" fio --size=128M --direct=1 --rw=randrw --refill_buffers --norandommap \ --randrepeat=0 --ioengine=libaio --bs=8k --rwmixread=70 --iodepth=16 \ --numjobs=16 --runtime=$runtime --group_reporting --name=8k7030test | tee -a \ $temp_dir/8k7030test.dat | grep iops rm $cdir/8k7030test*