Skip to content

Instantly share code, notes, and snippets.

@homelinen
Created January 3, 2013 13:17
Show Gist options
  • Save homelinen/4443417 to your computer and use it in GitHub Desktop.
Save homelinen/4443417 to your computer and use it in GitHub Desktop.
Short script to test read and write on a disk
#!/bin/bash
# Some simple read and write tests using dd
# Write
echo "Write"
dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
# Read Without Cache
echo "Read w/o Cache"
sudo echo 3 > sudo /proc/sys/vm/drop_caches
dd if=tempfile of=/dev/null bs=1M count=1024
# Read With Cache
echo "Read w/ Cache"
dd if=tempfile of=/dev/null bs=1M count=1024
# tempfile no longer needed
rm tempfile
@weakish
Copy link

weakish commented Mar 15, 2015

commit 462e5

Line 10

sudo echo 3 > sudo /proc/sys/vm/drop_caches

Second sudo is a typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment