Skip to content

Instantly share code, notes, and snippets.

@robzr
Last active February 7, 2018 23:29
Show Gist options
  • Save robzr/d879edb97dcd4dcb1e5a51661e86167d to your computer and use it in GitHub Desktop.
Save robzr/d879edb97dcd4dcb1e5a51661e86167d to your computer and use it in GitHub Desktop.
Sequential disk benchmarking on Linux with dd

Setup your benchmark parameters:

BM_FILE=./benchmark_data.$$
BM_SIZE=10 # in GB

Write the file:

sync && echo 3 > /proc/sys/vm/drop_caches && dd if=/dev/zero of="$BM_FILE" bs=1G count=$BM_SIZE conv=fdatasync

Clear the pagecache, dentries and inode buffers, then read the file:

sync && echo 3 > /proc/sys/vm/drop_caches && dd if="$BM_FILE" of=/dev/null bs=1G count=$BM_SIZE

And of course, don't forget to clean it up when you're done:

rm -f "$BM_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment