How can I use dd command on a Linux to test I/O performance of my hard disk drive?
How do I check the performance of a hard drive including the read and write speed on a Linux operating systems?
You can use the following commands on a Linux or Unix-like systems for simple I/O performance test:
dd command : It is used to monitor the writing performance of a disk device on a Linux and Unix-like system.
hdparm command : It is used to get/set hard disk parameters including test the reading and caching performance of a disk device on a Linux based system.
In this tutorial you will learn how to use the dd command to test disk I/O performance.
Use dd command to monitor the reading and writing performance of a disk device:
- Open a shell prompt (Or login to a remote server via ssh)
- Use the dd command to measure server throughput (write speed)
dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
- Use the dd command to measure server latency
dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync
The dd command is useful to find out simple sequential I/O performance.
Here’s some examples:
As you can see, writing 1 file (1 GigaByte dimension) can permit to test the maximum speed of writing bandwidth, instead, writing a small file many times, is better to simulate the actual daily behavior of a server (many small files, many times a day)
IMPORTANT! To keep your filesystem clean by useless files, remember to delete test1.img and test2.img at the end of test:
- cd /tmp/
- rm test1.img
- rm test2.img