My notes on basic i/o benchmarks on linux/unix systems.
Writing a file without sync is fast ofcourse:
time dd if=/dev/zero of=file bs=512M count=1
So sync should be used, using one of these variants:
sync; time bash -c 'dd if=/dev/zero of=file bs=512M count=1; sync' time dd if=/dev/zero of=file bs=512M count=1 oflag=direct
# capturing data for i in {1..11}; do time dd if=/dev/zero of=file bs=1G count=6 oflag=direct 2>&1; done | tee time.txt vmstat 10 | tee vmstat.txt iostat -x 10 sda2 | tee iostat.txt # calculating average time: # cat time_ht |grep real|sed -e 's,.*m,,' -e 's,s,,' | \ # awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1< min) {min=$1}; total+=$1; count+=1} END {print total/count, min, max}' # suming up wait from vmstat # manually removed entries at beginning/end of file that were bevore/after the dd run # cat vmstat_ht |egrep -v '^procs|^ r b'|awk '{print $16}' | \ # awk '{if(min==""){min=max=$1}; if($1>max) {max=$1}; if($1< min) {min=$1}; total+=$1; count+=1} END {print total/count, min, max}'