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

Table of Contents

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.

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.

Windows® is a registered trademark of Microsoft® Corporation. This portal is copyrighted by Andreas Wittmann, WittNet, Austria. All rights reserved. Home - Sitemap - Index - Impressum