Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was going through iostat man page. According to it,

 Show the percentage of time that the CPU or CPUs were idle during which the system    
 had an outstanding disk I/O request.   

 Show the percentage of time that the CPU or CPUs were idle during which the system    
 did not have an outstanding disk I/O request.                  

I didnt understand how iostat figures out that whether the I/O request are outstanding or not.

share|improve this question
up vote 3 down vote accepted

iowait is basically The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.

Measured on a per io basis from the front of the io scheduler until io is done. It covers the time that is taken through scheduler, driver, controller, transport (for san), and storage needed to complete each io. It is the average time, in milliseconds, for I/O requests completed by storage and includes the time spent by the requests in the scheduler queue and time spent by storage servicing them.

There are multiple phases of an IO while it is being transferred. After application sends an IO, a request is allocated for it, when the request is granted kernel sees whether it can merge the io to any existing request queue. Time spent in the request queue adds to the total service time. Then after merging is done, the io is submitted to storage. If the storage is under pressure or can't cope with the IO numbers, then our IO has to wait to be serviced by the storage also. So, there are essentially two waiting phases which iostat measure up.

The proc file /proc/diskstats is the one that it refers for the purpose.

share|improve this answer
Can you tell me whether i can get all these waiting times from proc. I looked into /proc/diskstats/ and /sys/block/<devicename>/stat` also. Both are containing same metrics but none is having the waiting times. – pradeepchhetri Oct 25 '12 at 18:47
Hey, I will check it but no time now. Gimme few hours and I will get back. – Soham Chakraborty Oct 25 '12 at 18:51
@pradeepchhetri /proc/diskstats/ only shows disk activity, I already told you where you get the time spent waiting for I/O. – scai Oct 26 '12 at 6:53
@scai: Sorry for that, I didnt notice. Thanks a lot. – pradeepchhetri Oct 26 '12 at 7:02

By asking the kernel. This information is directly contained in the first line of /proc/stat, see the proc documentation.

share|improve this answer
I know that it is getting from proc filesystem, but i want to know how it decide whether this time disk I/O is outstanding. – pradeepchhetri Oct 25 '12 at 10:02
Please see the linked documentation. The 4th number (5th column) is the idle value reported by iostat and the 5th number (6th column) of the first line is the iowait value reported by iostat. It doesn't have to decide anything, the kernel already does. – scai Oct 25 '12 at 11:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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