I am using the iostat utility on my RedHat Linux server to monitor the performance of a disk. When I use "iostat -xd sdh 1", I get the perf result printed every one second. When I use "iostat -xd sdh 5", I get the perf result printed every five second. My feeling is the latter command is printing a snapshot of the perf every five second, rather than averaging over the past 5 seconds. Am I correct in my understanding?

If so, is there a way I can make iostat print the perf. number averaged over n seconds, or is there some other utility that will do that.

Currently, the perf number is fluctuating within a range, and I want to get a somewhat "stable" number. I am hoping that averaging over a period of time will give me such a number.

Thank you, Ahmed.


1 Answer 1


We can read from IOSTAT(1):

The first report generated by the iostat command provides statistics concerning the time since the system was booted. Each subsequent report covers the time since the previous report.

If you need a long-term report to see average IO statistics since boot, i.e. so called by you "stable number", you have to use watch utility:

watch -n 1 iostat -xd sdh 5 2

The 5 2 in the last command means "display 2 reports at 5 seconds interval". With watch utility you'll see always at first line average "static" statistics since system boot which will be changed relatively slow and at second line "dynamic" statistics with "real-time" numbers. Due to watch utility the first "stable/slow" line will be updated every 5 seconds too.

Consider to add -t option to see each report time:

watch -n 1 iostat -xtd sdh 5 2

Try to see more "dynamic" reports:

watch -n 1 iostat -xtd sdh 5 3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .