linux/Documentation/iostats.txt
<<
>>
Prefs
   1I/O statistics fields
   2---------------
   3
   4Since 2.4.20 (and some versions before, with patches), and 2.5.45,
   5more extensive disk statistics have been introduced to help measure disk
   6activity. Tools such as sar and iostat typically interpret these and do
   7the work for you, but in case you are interested in creating your own
   8tools, the fields are explained here.
   9
  10In 2.4 now, the information is found as additional fields in
  11/proc/partitions.  In 2.6, the same information is found in two
  12places: one is in the file /proc/diskstats, and the other is within
  13the sysfs file system, which must be mounted in order to obtain
  14the information. Throughout this document we'll assume that sysfs
  15is mounted on /sys, although of course it may be mounted anywhere.
  16Both /proc/diskstats and sysfs use the same source for the information
  17and so should not differ.
  18
  19Here are examples of these different formats:
  20
  212.4:
  22   3     0   39082680 hda 446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  23   3     1    9221278 hda1 35486 0 35496 38030 0 0 0 0 0 38030 38030
  24
  25
  262.6 sysfs:
  27   446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  28   35486    38030    38030    38030
  29
  302.6 diskstats:
  31   3    0   hda 446216 784926 9550688 4382310 424847 312726 5922052 19310380 0 3376340 23705160
  32   3    1   hda1 35486 38030 38030 38030
  33
  34On 2.4 you might execute "grep 'hda ' /proc/partitions". On 2.6, you have
  35a choice of "cat /sys/block/hda/stat" or "grep 'hda ' /proc/diskstats".
  36The advantage of one over the other is that the sysfs choice works well
  37if you are watching a known, small set of disks.  /proc/diskstats may
  38be a better choice if you are watching a large number of disks because
  39you'll avoid the overhead of 50, 100, or 500 or more opens/closes with
  40each snapshot of your disk statistics.
  41
  42In 2.4, the statistics fields are those after the device name. In
  43the above example, the first field of statistics would be 446216.
  44By contrast, in 2.6 if you look at /sys/block/hda/stat, you'll
  45find just the eleven fields, beginning with 446216.  If you look at
  46/proc/diskstats, the eleven fields will be preceded by the major and
  47minor device numbers, and device name.  Each of these formats provides
  48eleven fields of statistics, each meaning exactly the same things.
  49All fields except field 9 are cumulative since boot.  Field 9 should
  50go to zero as I/Os complete; all others only increase (unless they
  51overflow and wrap).  Yes, these are (32-bit or 64-bit) unsigned long
  52(native word size) numbers, and on a very busy or long-lived system they
  53may wrap. Applications should be prepared to deal with that; unless
  54your o,servbusy orld
   5moree extensiive disk statistics havening 55tisticsystats.txt#L1 wit twhrefocumenxt#L4t#Lhreficsm"L49" class="line" name="L49">  495proc/dis5stats, the eleven field5 will56id="L42" class="line" name="L42">  425inor dev5ce numbers, and device 5ame. 5Each entatocumentL38" ition/ahat;qstions.txt#d; unes
  425leven fi5lds of statistics, each5meani5g exat#L53"-wid=tL38" i500 or morehref=ion46216="Dostats.txt#mation
u" id=m6="Doup"L49" class="line" name="L49">  495ll field5 except field 9 are cum5lativ5 id="L30" class="line" name="L30">  306o to zer6 as I/Os complete; all 6thers6only .txt#Lcum-- #menttatdthey
  506verflow 6nd wrap).  Yes, these a6e (32682310 42 Tref=Documf=iotostn/iostats.tatdthey
  496native w6rd size) numbers, and o6 a ve62nly .txt#Lc2m-- #menttatdthmely d,should
6m-- #mentwri&qstmely dL49" class="line" name="L49">  496ay wrap.6Applications should be 6repar6 38030 0 Ratdth unsigi&qstref="Deachadjacxt#Lion="Dochref="on/iostaely dats.L49" class="line" name="L49">  496our o,se6vbusy orld
  546e extens6ive disk statistics hav6ning 6538030 0 ultitxteon/h untationstatsby y
  546ivity. Toools such as sar and ios will6638030 0 a ition/orksss .2 Tref=hould
a h i500may
  166inor dev6ce numbers, and device 6ame. 67nly .txt#Lc3m-- #mentsectome tatdL16" class="line" name="L16">  166leven fi6lds of statistics, each6meani682310 42 Tref=Documf=iotostn/iostats.sectome tatdheset#msfully"L49" class="line" name="L49">  496ll field6 except field 9 are cum6lativ69nly .txt#Lc4m-- #mentmumeisecondthspxt#Lr id="s7" class="line" name="L7">   7the o to zer7 as I/Os complete; all 7thers702310 42 Tref=Documf=iotostn/iostats.mumeisecondthspxt#Lts.="Dotatdth(a"L54" class="line" name="L54">  547verflow 7nd wrap).  Yes, these a7e (32782310 42  meaning from __make_request()Lion=nd_xt#L_request_rapt())"L49" class="line" name="L49">  497native w7rd size) numbers, and o7 a ve72nly .txt#Lc5m-- #mentwri&qstey
  507ay wrap.7Applications should be 7repar732310 42 Tref=Documf=iotostn/iostats.wri&qstey
  497our o,se7vbusy orld
  497e extens7ive disk statistics hav7ning 752310 42 Tref=Documf=iotostn/iostats.sectome wri&tenheset#msfully"L49" class="line" name="L49">  497ivity. T7ools such as sar and io7 will76nly .txt#Lc8m-- #mentmumeisecondthspxt#Lwri&="s7" class="line" name="L7">   7the  work forr you, but in case you aame. 772310 42 Tref=Documf=iotostn/iostats.mumeisecondthspxt#Lts.="Dowri&qst(a"L54" class="line" name="L54">  547leven fi7lds of statistics, each7meani782310 42  meaning from __make_request()Lion=nd_xt#L_request_rapt())"L49" class="line" name="L49">  497ll field7 except field 9 are cum7lativ79nly .txt#Lc9m-- #mentss theurtxt#on/ioL48"grd="L54" class="line" name="L54">  548o to zer8 as I/Os complete; all 8thers802310 42 Treition/hould
#L15" ats.txincrease (id="crene" eion/irequest, eacL54" class="line" name="L54">  548verflow 8nd wrap).  Yes, these a8e (32882310 42 giy threaaharoprixtetL3ructirequest_queueides
  498native w8rd size) numbers, and o8 a ve82nly .txt#L10m-- #mentmumeisecondthspxt#Ldotatiss tL49" class="line" name="L49">  498ay wrap.8Applications should be 8repar832310 42 Tref=hould
iostats.shsox/ioson/ihould
  498our o,se8vbusy orld
  498e extens8ive disk statistics hav8ning 852310 42 Tref=hould
is
iostane" eiontn="Dociostatsrt,ciostey
  498ivity. T8ools such as sar and io8 will862310 42  mly ocumerith
  548 work fo8r you, but in case you 8ame. 872310 42 (hould
<)Liimes.txt#n/iostats.mumeisecondthspxt#Ldotatiss tation/txtL54" class="line" name="L54">  548ls, the ffields are explained hermeani882310 42 raptoupdxtet  408ll field8 except field 9 are cum8lativ892310 42 iostey
   9
  219verflow 9nd wrap).  Yes, these a9e (329 id="L42" class="line" name="L42">  429native w9rd size) numbers, and o9 a ve92nly Toe opensmentatiotatiperts.txion/iottlenecks,=no ion/, eachhuld
refltL54" class="line" name="L54">  549ay wrap.9Applications should be 9repar9d to dodifytati href=cts.txrs.2 Tref=imat;qstiL15"of theinacf=rac;qston/iosL54" class="line" name="L54">  549our o,se9vbusy orld
ion)iostaatiup6="DostaL54" class="line" name="L54">  549e extens9ive disk statistics hav9ning 952310rith
ss thissuediper ocumentat" ats.txequalumentatmadetionstatsby s ..L9" class="line" name="L9">   9
   9
  429ls, the 9fields are explained he9meani98fter the ef="Doa href=cts.txrsostat="DocCPU href="Doakenstatlacki  429 href="Doocumentation/iostats.txtlativ992310alm42" a=non-issue.2 Whenvice name. In
  10Inn 2.4 now,, the information is fountherunt2310aef=summxt# possibon/o 64-bittati hr.txt#L52" id=" varixbleiicsyseacL54" class="line" name="L54">  5410proc/part0itions.  In 2.6, the sam01herun id="summxt#to)on/iostat

4210laces: on0e is in the file /proc/d02herun2nly tserumentafa/iostataet#mstati hr.per-CPU=cts.txrs id=mselve="L49" class="line" name="L49"> 4910he sysfs 0file system, which must 03herun id="L34" class="line" name="L34"> 3410he inform0ation. Throughout this d04herun4nly Dby s vs PcumentatiL34" class="line" name="L34"> 3410s mounted0 on /sys, although of co05herun5stats.txt#L3" id="Ld="L3" class="line" name="L3"> 3 4210nd so sho0uld not differ. 4910 4910ere are e0xamples of these differe09herun92310aats.txostrd="t ocumentreaa ocumentat"ionstatsby xostrd="t ocumentreL11" class="line" name="L11"> 11/pn 2.4 noww, the information is fouund a1 additstath42" sby xhahaenstose aeent;qr.2 e bo mly th unsiim id= y 11/pproc/partiitions. In 2.6, the same1heruormatientatiosby xtly l raref="iL1nontnbo="nstatsby xounsocumentat"tly l a"L54" class="line" name="L54"> 541places: onne is in the file /proc/ddisks1ats, auƊ.2 Catiequet#onxt#L45" id=" se numtats.txt#Lname. In 491the sysfs file system, which must be m1unted ocumentati from iL15"statation/ioTDoa href=tion/*four*a href="DvailxbleL49" class="line" name="L49"> 491the informmation. Throughout this ddocum1nt we&statocumentati o'lma="Does.2 Tref=i"t fref=ng exaor anDocumentwould"L49" class="line" name="L49"> 491is mountedd on /sys, although of coourse11 id="L26" class="line" name="L26"> 261Both /procc/diskstats and sysfs usee the116nly .txt#Lcum-- #menttatdthissuedL26" class="line" name="L26"> 261Bnd so shoould not differ. 491i 161Here are eexamples of these differeent f1192310 42 Tref=Documf=iotostn/iostats.sectome taquested"ionbf=rith from iLi"L54" class="line" name="L54"> 541 4912.4: 2612laces: onee is in the file /proc/diisks1 9550688 Tref=Documf=iotostn/iostats.wri&qstissued"ionstDococumentat"L49" class="line" name="L49"> 491 3 11 9221278 hda1 35486 10 35416 3803.txt#Lc4m-- #mentsectome wri&tenL49" class="line" name="L49"> 491 11/ 491 oth /proc: 421 4462161 784926 9550688 4382310 1424841 31272Notxt#L15" tion/txtxostrd="tDocuranslioed"ionaats.t- ocumentoney 11/ 11/ ere are e"Documentation/iostats.t1xt#L31" id="tatfail6" i 13th 13th.4: 13thlaces: on hda1 35486 38030 380310 38010 4913he sysfs ffile system, which must b 3541" id="L34" class="line" name="L34"> 341On 2.4 yo1u might execute "gr1ep hda Moa ht#L5ificanthDocumf=errtheintion/iby=cts.ttati hr.he same thL34" class="line" name="L34"> 341O 341Ooth /proctage of one over the oth1er is1that tumentatt#L37loth usuationa/staiti < lation/eset#msmentoa h1djacxt#Lrequest,L5" class="line" name="L5"> 5mor1if you ar1e watching a known, smal1l set13terested n/iostats.tatdt/wri&qstissued"canLostsly ralumimes.hparf="iL1nostaL54" class="line" name="L54"> 541be a bett1er choice if you are wat1ching1a largn/iostats.tatdt/wri&qstey 4913ere are el avoid the overhead of 150, 113 id="L10" class="line" name="L10"> 10Ieach snap1shot of your disk statis1tics.14additional 16. 10Ie.4: 421In 2.4, t1he statistics fields are1 thos1 afterkeep rec-liv 421Ihe sysfs example, the first fiel1d of 1tatistics ocumentat"ref="Da/staiti . 421Ihe informaation. Throughout this dop /blockly ttualu mly t. A/irequest, canLostaely daacrosococumentat, stDoccts.txlatdL16" class="line" name="L16"> 161find just1 the eleven fields, begi1nning1with 4ion45, <(48"babon/int#L5ificant)einacf=racy"L49" class="line" name="L49"> 491/proc/dis1kstats, the eleven field1s wil146id="L42" class="line" name="L42"> 421minor dev1ice numbers, and device 1name.1 Each Astats.txt#t#L="L48" class="line" name="L48"> 481eleven fi1elds of statistics, each1 mean1ng exaxt#L3" id="Ld="L3" class="line" name="L3"> 3 10Igo to zer1o as I/Os complete; all 1other15additional ,on/iostef=nottats.txt#by=defaultats.txt#Latatitributtat"thL34" class="line" name="L34"> 341overflow 1and wrap). Yes, these a1re (31-bit oL 421(native w1ord size) numbers, and o1n a v1ry bust#Lat/etc/f2">b"L31" class="line" name="L31"> 311may wrap.1 Applications should be 1prepa15 id="L34" class="line" name="L34"> 341your o,se1rvbusy orld 341yind just1iive disk statistics hav1ening15 id="L26" class="line" name="L26"> 2615proc/dis15stats, the eleven field15 wil156id="L42" class="line" name="L42"> 4215inor dev15ce numbers, and device 15ame.15Each ional ,o="Domeasure disk 5315leven fi15lds of statistics, each15mean15g exaahaeen exaburce for tocumentati 11/5ll field15 except field 9 are cum15lati15 id="ecededre d taken="Documtats.txt#L20" id from iLntatexa for tocumentatiL11" class="line" name="L11"> 11/6o to zer16 as I/Os complete; all 16ther16only (se nfor (5),ll 5416verflow 16nd wrap). Yes, these a16e (316 id="L42" class="line" name="L42"> 4216native w16rd size) numbers, and o16 a v16ostats. rickumbd@us.ibm.comL49" class="line" name="L49"> 4916ay wrap.16Applications should be 16repa16 3803< foeesults" tents">
Treitrigitxt#LXRn45ftwref=ts.txt#49" classhttp://tion/i20"ge.net forjects/lxr">LXRncommunmty3803, stDocextsrine" nllxr@lpre clicatiosubfo#L=r">
lxr.lRedpume L

p/html"