Pages

Wednesday, May 9, 2012

Meassure disk performance

This tutorial was tested on Slackware Linux only but should work for any other Unix with some minor changes in the iostat options. Keep in mind that some file systems (zfs, vxfs etc.) have their own tools to measure disk performance. In this case you should refer to them.
To meassure the disk performance of a specific disk use iostat - not dd. You can use dd to create some load but not to meassure the performance of a disk. The usage of iostat is very easy, a simple example for /dev/sdb could look like this:# iostat -dm -p /dev/sdb 1 100Linux 2.6.33.4 (dc01) 05/07/2012 _x86_64_ (2 CPU)

-d: use devices only (not CPU)
-m: show results in megabytes
-p: the device you want to monitor
1: interval
100: count

You can display multiple devices by comma seperating them:

# iostat -dm -p /dev/sda,/dev/sdb 1 100...

Each device you want to monitor will be displayed as a device with an overall statistic for all partitions. Partitions will be listed separately (see above). The first output is always the cumulative results since the machine was booted:

In this case the device md0 has read 22.42GB and written 15.99GB since the machine was booted.
To meassure the speed of your hard disk you can use dd to create some load and iostat to measure the read and write speed. Open two consoles, on the first start iostat first:

# iostat -dm -p /dev/sdb 1 100...

On the second start dd to create a 100MB file (/dev/sdb1 was mounted on /export):