I see conflicting information online about use of IOSTAT. In particular I would like to be able to show an average since boot. Based on information I have read if I have never issued the command IOSTAT it will show the average since boot. But if at some point I have issued an IOSTAT command the next execution will not be since boot, but rather since last execution.

How do I execute IOSTAT since boot assuming I have already run it once before.


iostat displays stats since boot, once (per command run, not per boot). Then depending on parameters (eg: running iostat 2, for every two seconds), it will display stats since previous display in the same command run:

The first report generated by the iostat command provides statistics concerning the time since the system was booted, unless the -y option is used (in this case, this first report is omitted). Each subsequent report covers the time since the previous report. All statistics are reported each time the iostat command is run. The report consists of a CPU header row followed by a row of CPU statistics. On multiprocessor systems, CPU statistics are calculated system-wide as averages among all processors. A device header row is displayed followed by a line of statistics for each device that is configured.

Really iostat is just doing a few substractions. The bookkeeping role is done by the kernel. iostat just accesses various /proc (or perhaps other similar entries). Among them (found simply by using strace on iostat 2):


First read is since boot. To know since its last display, the iostat memorizes (while it's running, in memory) the previous values, and substracts them to the newly read: that's what happened during the time period.

To confirm OP's questions: every run of iostat command is independant of other runs of the iostat command. It won't affect an other concurrently running iostat command or future runs of the iostat command.

|improve this answer|||||
  • How do I execute IOSTAT since boot assuming I have already run it once before? – barrypicker Dec 9 '19 at 17:48
  • Maybe I don't understand 'the first report'. If I log in and issue IOSTAT - is this a first report? If I then log out and log back in (without reboot) and issue IOSTAT is this also a first report? – barrypicker Dec 9 '19 at 17:51
  • 1
    if you type: iostat, you get a first report. If you type again iostat, you get again a first report: it's only within the same command that it matters. two different iostat commands bear no relation between them nor will they alter future commands. – A.B Dec 9 '19 at 17:57
  • Perfect, now I get it.. Thanks! – barrypicker Dec 9 '19 at 17:57
  • So, please confirm - regardless of historical usage on this system, if I issue iostat with no parameters I will get averages since boot. But if I instead issue iostat 5 (include an interval parameter) I will get multiple reports - the first of which is since boot, but all subsequent is since the previous. Is this true? – barrypicker Dec 9 '19 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.