• How to test Linux Disk I/O Performance With dd Command and hdparm

Use dd command on Linux to test write speed:

dd if=/dev/zero of=/tmp/test.tmp bs=1G count=1 oflag=dsync

or time sh -c "dd if=/dev/zero of=test.tmp bs=1073741824 count=1 && sync" Sample output:

1+0 records in 1+0 records out 1073741824 bytes (1.1 GB) copied, 2.71482 s, 396 MB/s

Use dd command on Linux to test read speed:
To get accurate read speed, first flush cache by running the following commands:

echo 3 | sudo tee /proc/sys/vm/drop_caches

Then run the read test:

time dd if=/tmp/test.tmp of=/dev/null bs=1M

Sample output:

1024+0 records in 1024+0 records out 1073741824 bytes (1.1 GB) copied, 0.442772 s, 2.4 GB/s

Use hdparm command to see buffered and cached disk read speed:

Buffered disk read test for /dev/sda

hdparm -t /dev/sda1


hdparm -t /dev/sda

Sample output:

/dev/sda: Timing buffered disk reads: 2458 MB in 3.00 seconds = 818.94 MB/sec

To perform timings of cache reads use the -T option:

Cache read benchmark for /dev/sda

hdparm -T /dev/sda1


hdparm -T /dev/sda

OR combine both tests:

hdparm -Tt /dev/sda

This article was last modified: May 24, 2024, 9:07 a.m.


Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.


Hacker News