Test the IO performance of hard-disks/disks using Linux

Measurements by means of dd

Measure writing performance. This test can also be used with CIFS and NFS and is relatively objective:

dd if=/dev/zero of=temp.bin bs=1M count=1024 conv=fdatasync,notrunc

The parameter fdatasync only ends the dd command when the data has been completely synced. Instead, you could also use oflag=dsync which also takes caches into account and waits until they have been written.

Um ohne Puffer zu testen empfiehlt sich der Parameter oflag=direct bei dd. Zusätzlich sollte der Schreibcache der Disk ebenfalls mit

To test without a buffer, we recommend the parameter oflag=direct using dd. In addition, the write cache of the disc should deactivated using:

hdparm -W0 /dev/sda

It can be re-activated using:

hdparm -W1 /dev/sda

The reading performance can be obtained with the command

time dd if=/tmp/test.bin of=/dev/null bs=4k

bs should be matched to the source drive.

Before doing read tests, it is recommended to flush the read cache:

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

In all tests, where caches play a role, the RAM’s performance is of course also decisive!

Determine data throughput

This point complements the information above, but comes from a different source:

if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync

Determine latency

This point complements the information above, but comes from a different source:

dd if=/dev/zero of=/tmp/test2.img bs=512 count=1000 oflag=dsync

Measurements using hdparm

To test the performance of the cache, hdparm can be used.

hdparm -Tt /dev/sda

Using -t the performance of buffered read accesses is determined. This test primarily determines the performance between disk, kernel and chipset including system caches. The optional parameter --direct bypasses system caches and shows the direct data throughput between disk, kernel and chipset.

With -T the read cache is tested, this test does not make hard disk access because it only reads from the Linux buffer cache.

Leave a Comment

5 + 4 =