linux/Documentation/iostats.txt
<<
>>
Prefs
   1I/O statistics fields
   2---------------
   3
   4Last modified Sep 30, 2003
   5
   6Since 2.4.20 (and some versions before, with patches), and 2.5.45,
   7more extensive disk statistics have been introduced to help measure disk
   8activity. Tools such as sar and iostat typically interpret these and do
   9the work for you, but in case you are interested in creating your own
  10tools, the fields are explained here.
  11
  12In 2.4 now, the information is found as additional fields in
  13/proc/partitions.  In 2.6, the same information is found in two
  14places: one is in the file /proc/diskstats, and the other is within
  15the sysfs file system, which must be mounted in order to obtain
  16the information. Throughout this document we'll assume that sysfs
  17is mounted on /sys, although of course it may be mounted anywhere.
  18Both /proc/diskstats and sysfs use the same source for the information
  19and so should not differ.
  20
  21Here are examples of these different formats:
  22
  232.4:
  24   3     0   39082680 hda 446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  25   3     1    9221278 hda1 35486 0 35496 38030 0 0 0 0 0 38030 38030
  26
  27
  282.6 sysfs:
  29   446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  30   35486    38030    38030    38030
  31
  322.6 diskstats:
  33   3    0   hda 446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  34   3    1   hda1 35486 38030 38030 38030
  35
  36On 2.4 you might execute "grep 'hda ' /proc/partitions". On 2.6, you have
  37a choice of "cat /sys/block/hda/stat" or "grep 'hda ' /proc/diskstats".
  38The advantage of one over the other is that the sysfs choice works well
  39if you are watching a known, small set of disks.  /proc/diskstats may
  40be a better choice if you are watching a large number of disks because
  41you'll avoid the overhead of 50, 100, or 500 or more opens/closes with
  42each snapshot of your disk statistics.
  43
  44In 2.4, the statistics fields are those after the device name. In
  45the above example, the first field of statistics would be 446216.
  46By contrast, in 2.6 if you look at /sys/block/hda/stat, you'll
  47find just the eleven fields, beginning with 446216.  If you look at
  48/proc/diskstats, the eleven fields will be preceded by the major and
  49minor device numbers, and device name.  Each of these formats provide
  50eleven fields of statistics, each meaning exactly the same things.
  51All fields except field 9 are cumulative since boot.  Field 9 should
  52go to zero as I/Os complete; all others only increase.  Yes, these are
  5332 bit unsigned numbers, and on a very busy or long-lived system they
  54may wrap. Applications should be prepared to deal with that; unless
  55your observations are measured in large numbers of minutes or hours,
  56they should not wrap twice before you notice them.
  57
  58Each set of stats only applies to the indicated device; if you want
  59system-wide stats you'll have to find all the devices and sum them all up.
  60
  61Field  1 -- # of reads completed
  62    This is the total number of reads completed successfully.
  63Field  2 -- # of reads merged, field 6 -- # of writes merged
  64    Reads and writes which are adjacent to each other may be merged for
  65    efficiency.  Thus two 4K reads may become one 8K read before it is
  66    ultimately handed to the disk, and so it will be counted (and queued)
  67    as only one I/O.  This field lets you know how often this was done.
  68Field  3 -- # of sectors read
  69    This is the total number of sectors read successfully.
  70Field  4 -- # of milliseconds spent reading
  71    This is the total number of milliseconds spent by all reads (as
  72    measured from __make_request() to end_that_request_last()).
  73Field  5 -- # of writes completed
  74    This is the total number of writes completed successfully.
  75Field  7 -- # of sectors written
  76    This is the total number of sectors written successfully.
  77Field  8 -- # of milliseconds spent reittel number of writes completed successfullyhref="Documentation/iostaL52" id="t"
	1" id="L7171717171n -- # od="t"
)4>  68  72    measured from __make8l number8of sectors read success8ully.8  54may wrap. Applications shoul8  4 -- #8of milliseconds spent r8ading8  52go to zero as I/Os complete; al8of milli8econds spent by all rea8s (as8  6tats.txss=rap.eid="Lef="D="Lish"L72">  72    measured from __make8request(8 to end_that_request_la8t()).8  72    measured from __make83Fie8d  5 -- # of writes com8leted8  72    measured from __make8mber of 8rites completed success8ully.8  72    measured from __make875Fi8ld  7 -- # of sectors w8itten86a href="Documxt#L67ationss=rap.eid=t" clas href="rt,s hreL74" clsur,s hrL72">  72    measured from __make8umber of8sectors written success8ully.87a href="DoL6441" crtxt#L41="L52"ation/ine" nasuccessfulion/ila="L4gr54">  54may wrap. Applications shoul8ve been iintroduced to help measuittel8number of(iostats" iimese" nasuccessful/iostats.txt#L77" ido"L50ion51" cla" n>  54may wrap. Applications shoul8>  68 tat" csyame="L7">L41boyou'll avoid the overhead of 509l number9of sectors read success9ully.9  72    measured from __make9  4 -- #9of milliseconds spent r9ading9  54may wrap. Applications shoul93Fie9d  5 -- # of writes com9leted9  54may wrap. Applications shoul9mber of 9rites completed success9ully.9  54may wrap. Applications shoul975Fi9ld  7 -- # of sectors w9itten96a hrrtxt#ion/ilss 660per name="L36L1cuments="al" id="Lmadetats.txt#L66s ..=L72">  72    measured from __make9umber of9sectors written success9ully.97a hron/iduetats.txtlack>L416" c L50L17" clumentbe" id="L41">=L72">  72    measured from __make9ve been 9introduced to help meas9ittel98a href="Documentation/iostats.txt#L22" id9iostat tyypically interpret these read99a href="Ds.txt#="Documne" nars"line clascputats.txt#adetatxtlack>L416" c L5  9the work for you, but in case yoou are intterested in creating yourullyurua hrelmbut ainon-lss 6ostWhenumentation/iostaocumrtxton/iosper-cpumne" nars  9the work for you, but in case yo>tools, t0he fields are explained 01llyur  102llyur  58Each set of stats only appli10ation is 0found as additional fiel03llyur  selve50">  50eleven fields of statistics10, the sam0e information is found i04llyur4a href="Documentation/iostats.txt#L11" id=0roc/disks0tats, and the other is w05llyur  50eleven fields of statistics10se the sa0me source for the inform09llyur9a hrAtaolngbott,ion/ioation/iosid="L13" clas#L6ts.e="L5."Doectransl" clastion="L10" class="line" name="L10">  10ou are innterested in creating youur ow1
  10>tools, thhe fields are explained h1llyu
  10"L11" claass="line" name="L11">  111
oion/io  64    Reads and writes which are a16, the samme information is found iin tw1
    Reads and writes which are a16roc/disksstats, and the other is wwithi1
  10ich must  be mounted in order to oobtai11  10se the saame source for the informmatio1
  119and so should not d1iffer120umber of writes completed successful/iostats.t="lin66Latsbumrtxtation/5e  65    efficiency.  Thus two 4K re1="L20" cl1ass="line" name="L20">  120  10  111  122  10  232.41
 1726 59220152 19310380 0 3376340 231705161
  10  10  126  127  10  282.6 1sysfs1
  12In 2.4 now, the informaL19">  1152 19310380 0 3376340 231705161
L41s="lngxtacanatioameattributostats.txteame="L36d/iosts="lie="L12">  12In 2.4 now, the informa"L20" cl1486    38030    38030   1 38031
  12In 2.4 now, the informa"L11" claass="line" name="L31">  131  "L50lineeame="L36"" id="="LL74" clsur linewholee" class=Ttritese="L12">  12In 2.4 now, the informaation is ffound as additional field2  50eleven fields of statistics1726 59220152 19310380 0 3376340 23170516134a href="Documentation/iostats.txt#L11" id=  3    1 1  hda1 35486 38030 380301 38031
  135  55your observations are measure1p 'hd1a ' /proc/diskstats&1quot;1
  54may wrap. Applications shoul1her is th1at the sysfs choice work1s wel1
  50eleven fields of statistics1mall set 1of disks.  /proc/disksta1ts ma14  58Each set of stats only appli1>each sna1pshot of your disk stati1stics1
  58Each set of stats only appli1>, the samee information is found in05161
L41s="lng="linL44" class>  58Each set of stats only appli1> 3    1 1hose after the device na1me. I1
across eame="L36,".tes cumentltxt#L68" id="L68" class="line" name="L681st field 1of statistics would be 41462161
  76    This is the total 1look at /1sys/block/hda/stat, you&1#39;l14  12In 2.4 now, the informields wil1l be preceded by the maj1or an1
  58Each set of stats only appli1l others 1only increase.  Yes, the1se ar1
  15732 bit unsigned numbers, and o1es to the1 indicated device; if yo1u wan1
  12In 2.4 now, the informnd all th1e devices and sum them a1ll up1
  12In 2.4 now, the informn each me1ass="line" name="L60">  160    ultimately handed to the disk,1 61Fi1eld  1 -- # of reads com1plete16  10
Doecurigiss="LXRsonftwocumine" na"L10" clahttp://class=="Lge.netocumjioss/lxr">LXRsconmundtya hr,".tes examriline"lostats.tmine"L10" clamailto:lxr@l.6.1.no">lxr@l.6.1.noa hr.
  
lxr.l.6.1.no ketdatioosne" byt"L10" clahttp://www.redpass-l.6cum.no">Redpass L.6cum ASa hr,""L49"> a>L41L.6.1 "DosDocu="d=txt#amr" cla"sserine" n1" cla1995.
/bodyiv /htmlaj