Showing posts with label dd. Show all posts
Showing posts with label dd. Show all posts

Finding read throughput using "dd"

If you are trying to find the read throughput of a device (like an SD card), you can do the following:

1. If possible unmount the device but keep it connected. Let's say you are looking at an SD card at sdd. (Don't worry about the volumes)
2. Run the following:
sudo dd if=/dev/sdd of=/dev/null bs=50M count=1

This will print the read throughput, something like this:
1+0 records in
1+0 records out
52428800 bytes (52 MB) copied, 2.62946 s, 19.9 MB/s


Now, if the device is mounted, you might see a variability in the throughput because of file system page caching between runs. To avoid that, free the page caches using:
sync; echo 1 | sudo tee /proc/sys/vm/drop_caches

NOTE: To free deentries and inodes the following can be used:
sync; echo 2 | sudo tee /proc/sys/vm/drop_caches

If you want to free up everything (page caches, deentries and inodes), do the following:
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches