In lack of better or more specialized tools, a disk’s read and write speed can be quickly and roughly tested using Linux’s built-in dd tool.

All operations are performed in the current folder, so before starting ensure you are in a (sub)folder on the disk or disk system you wish tested.

We start with writing a blank file that’s as large as the system’s memory (in this case 8KB * 2.000.000 blocks = 16GB):
time sh -c "dd if=/dev/zero of=ddfile bs=8k count=2000000 && sync"

The measured numbers are the system’s disk(s) write speed. These results can vary in time due to other activities that occur on the system.

To test the read speed we’ll be reading back the written file. However, to exclude disk and memory caching from the read test we write a secondary file (the same size as the system memory). This will make sure the initial data is cleared from cache/RAM.
time sh -c "dd if=/dev/zero of=ddfile2 bs=8k count=500000 && sync"

Finally the system’s disk(s) read speed can be tested by reading the initially generated file:
time dd if=ddfile of=/dev/null bs=8k

Again, results can vary in time depending on other processes usage.

Finally, some cleanup:
rm -f ddfilerm -f ddfile2

Leave a Reply