{"id":3274,"date":"2017-01-26T11:35:32","date_gmt":"2017-01-26T11:35:32","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3274"},"modified":"2017-01-26T11:35:32","modified_gmt":"2017-01-26T11:35:32","slug":"disk-io-stats-linux","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/01\/26\/disk-io-stats-linux\/","title":{"rendered":"Disk I\/O Stats in linux"},"content":{"rendered":"<h2>Sysstat<\/h2>\n<p>For disk I\/O trending there are a few options. the sar command from sysstat. By default, it gives output like this:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># sar\nLinux 2.6.32-642.11.1.el6.x86_64 (test.geekdecoder.com)    01\/26\/2017      _x86_64_        (2 CPU)\n\n12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle\n12:10:01 AM     all      0.03      0.00      0.03      0.09      0.00     99.85\n12:20:01 AM     all      0.27      0.00      0.04      0.00      0.00     99.69\n12:30:01 AM     all      0.33      0.00      0.05      0.00      0.00     99.62\n12:40:01 AM     all      1.01      0.00      0.18      1.18      0.00     97.63\n12:50:01 AM     all      0.15      0.00      0.04      0.00      0.00     99.80\n01:00:01 AM     all      0.16      0.00      0.03      0.00      0.00     99.80\n01:10:01 AM     all      0.22      0.00      0.04      0.00      0.00     99.74\n01:20:01 AM     all      0.36      0.00      0.05      0.00      0.00     99.59\n01:30:01 AM     all      0.23      0.00      0.04      0.00      0.00     99.74\n01:40:01 AM     all      0.70      0.00      0.25      6.23      0.00     92.82\n01:50:01 AM     all      0.13      0.00      0.03      0.00      0.00     99.83\n02:00:01 AM     all      0.16      0.00      0.04      0.00      0.00     99.80\n02:10:01 AM     all      0.21      0.00      0.04      0.00      0.00     99.75\n02:20:01 AM     all      0.30      0.00      0.04      0.00      0.00     99.66\n02:30:01 AM     all      0.14      0.00      0.03      0.00      0.00     99.83\n02:40:01 AM     all      0.20      0.00      0.03      0.00      0.00     99.76\n02:50:01 AM     all      0.32      0.00      0.05      0.00      0.00     99.63\n03:00:01 AM     all      0.21      0.00      0.03      0.00      0.00     99.76\n03:10:01 AM     all      0.19      0.00      0.04      0.00      0.00     99.77\n03:20:01 AM     all      0.12      8.44      2.69     10.79      0.00     77.96\n03:30:01 AM     all      0.13      4.52      8.36      0.30      0.00     86.69\n03:40:01 AM     all      0.48      0.00      0.05      0.02      0.00     99.45\n03:50:01 AM     all      0.15      0.00      0.04      0.01      0.00     99.80\n04:00:01 AM     all      0.13      0.00      0.03      0.00      0.00     99.84\n04:10:01 AM     all      0.48      0.00      0.06      0.04      0.00     99.43\n04:20:01 AM     all      0.17      0.00      0.05      0.11      0.00     99.67\n04:30:01 AM     all      0.22      0.00      0.04      0.00      0.00     99.74\n04:40:01 AM     all      0.89      0.00      0.08      0.16      0.00     98.87\n04:50:01 AM     all      0.55      0.00      0.07      0.05      0.00     99.34\n05:00:01 AM     all      0.11      0.00      0.04      0.01      0.00     99.85\n05:10:01 AM     all      0.09      0.00      0.03      0.00      0.00     99.87\n05:20:01 AM     all      0.17      0.00      0.04      0.00      0.00     99.80\n05:30:01 AM     all      0.27      0.00      0.05      0.08      0.00     99.60\n\n<\/pre>\n<h2><\/h2>\n<p><!--more--><\/p>\n<h2>iotop<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># iotop\nTotal DISK READ: 0.00 B\/s | Total DISK WRITE: 0.00 B\/s\n  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO&amp;gt;    COMMAND\n    1 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % init\n    2 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;kthreadd]\n    3 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;migration\/0]\n    4 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;ksoftirqd\/0]\n    5 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;stopper\/0]\n    6 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;watchdog\/0]\n    7 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;migration\/1]\n    8 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;stopper\/1]\n    9 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;ksoftirqd\/1]\n   10 rt\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;watchdog\/1]\n   11 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events\/0]\n   12 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events\/1]\n   13 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events\/0]\n   14 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events\/1]\n   15 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events_long\/0]\n   16 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events_long\/1]\n   17 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events_power_ef]\n   18 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;events_power_ef]\n   19 be\/4 root        0.00 B\/s    0.00 B\/s  0.00 %  0.00 % &#x5B;cgroup]\n<\/pre>\n<p>Use the iotop command with o option to print actual I\/O activity.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># iotop -o\nqTotal DISK READ: 0.00 B\/s | Total DISK WRITE: 0.00 B\/s\n  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO&amp;gt;    COMMAND\n\n\n<\/pre>\n<p>Another option is to use is &#8220;sudo iotop -aoP&#8221;<\/p>\n<p>-a Will show accumulated output<br \/>\n-o Will only output<br \/>\n-P Will only show processes instead of threads<br \/>\nThis program will tell you how much a process has written to disk and read from disk since iotop was started.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo iotop -aoP\n\nTotal DISK READ: 0.00 B\/s | Total DISK WRITE: 0.00 B\/s\n  PID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO&amp;gt;    COMMAND\n  420 be\/3 root          0.00 B     28.00 K  0.00 %  0.00 % &#x5B;jbd2\/dm-0-8]\n 2151 be\/4 apache        0.00 B      4.00 K  0.00 %  0.00 % httpd\n 2155 be\/4 apache        0.00 B      4.00 K  0.00 %  0.00 % httpd\n\n<\/pre>\n<h2>atop<\/h2>\n<p>A great overview over all resources (CPU, memory\/swap, network and disk I\/O) or you can drill down to a single resource and sort processes by how much they consume.<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-3282\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop-1024x739.png\" alt=\"\" width=\"650\" height=\"469\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop-1024x739.png 1024w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop-300x216.png 300w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop-768x554.png 768w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop-1536x1108.png 1536w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/atop.png 1575w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/a><\/p>\n<h2>IOSTAT<\/h2>\n<p>To print individual hard disk I\/O activity, use the iostat command with below option. It will print the output 5 second interval<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># iostat -dx 5\nLinux 2.6.32-642.11.1.el6.x86_64 (webserver.geekdecoder.com)    01\/26\/2017      _x86_64_        (2 CPU)\n\nDevice:         rrqm\/s   wrqm\/s     r\/s     w\/s   rsec\/s   wsec\/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util\nsda               0.39     1.50    1.14    0.22    62.75    13.83    56.01     0.02   13.32    8.92   35.78   4.98   0.68\ndm-0              0.00     0.00    1.49    1.57    62.13    12.54    24.39     0.51  164.39   19.85  302.07   2.21   0.68\ndm-1              0.00     0.00    0.02    0.16     0.19     1.28     8.00     0.00   11.81   13.22   11.60   0.39   0.01\n\nDevice:         rrqm\/s   wrqm\/s     r\/s     w\/s   rsec\/s   wsec\/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util\nsda               0.00     0.00    0.20    0.00     3.20     0.00    16.00     0.01   42.00   42.00    0.00  42.00   0.84\ndm-0              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00\ndm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00\n\nDevice:         rrqm\/s   wrqm\/s     r\/s     w\/s   rsec\/s   wsec\/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util\nsda               0.00     0.40    0.00    0.40     0.00     6.40    16.00     0.00    0.00    0.00    0.00   0.00   0.00\ndm-0              0.00     0.00    0.00    0.80     0.00     6.40     8.00     0.00    0.00    0.00    0.00   0.00   0.00\ndm-1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00\n<\/pre>\n<h2>dstat<\/h2>\n<p>Or, dstat can show totals and statistics per disk and even md-devices (RAID), also can use colors for better overview:<\/p>\n<p><a href=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/dstat.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3276\" src=\"https:\/\/qbytes.cloud\/wp-content\/uploads\/2017\/01\/dstat.png\" alt=\"dstat for disk I\/O in Linux\" width=\"589\" height=\"254\" srcset=\"https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/dstat.png 589w, https:\/\/www.qbytes.cloud\/wp-content\/uploads\/2017\/01\/dstat-300x129.png 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/a><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># dstat\n\n----total-cpu-usage---- -dsk\/total- -net\/total- ---paging-- ---system--\nusr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw\n  0   0  99   0   0   0|  29k 6166B|   0     0 |  79B  545B| 182    64\n  0   0 100   0   0   0|   0     0 |  13k 1213B|   0     0 | 279    47\n  0   0 100   0   0   0|   0     0 |2790B  718B|   0     0 | 110    52\n  0   0 100   0   0   0|   0     0 |  12k  718B|   0     0 | 257    51\n  0   0 100   0   0   0|   0     0 |3124B  718B|   0     0 |  98    52\n  0   0 100   0   0   0|   0     0 |  12k  720B|   0     0 | 247    51\n  0   0 100   0   0   0|   0     0 |2812B  718B|   0     0 | 111    65\n  1   0 100   0   0   0|   0     0 |  12k  718B|   0     0 | 235    45\n  0   0 100   0   0   0|   0     0 |2283B  718B|   0     0 |  82    49\n  0   0 100   0   0   0|   0     0 |  12k  358B|   0     0 | 228    49\n  0   0 100   0   0   0|   0     0 |1686B  358B|   0     0 |  60    45\n  0   0 100   0   0   0|   0     0 |  14k  719B|   0     0 | 288    53\n  0   0 100   0   0   0|   0     0 |3754B  718B|   0     0 | 114    51\n  0   0 100   0   0   0|   0     0 |  12k  456B|   0     0 | 224    41\n  0   0 100   0   0   0|   0     0 |2535B  456B|   0     0 |  71    47\n  0   0 100   0   0   0|   0     0 |  13k  456B|   0     0 | 233    43\n  0   0 100   0   0   0|   0     0 |2368B  358B|   0     0 |  64    43\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sysstat For disk I\/O trending there are a few options. the sar command from sysstat. By default, it gives output like this: # sar Linux 2.6.32-642.11.1.el6.x86_64 (test.geekdecoder.com) 01\/26\/2017 _x86_64_ (2 CPU) 12:00:01 AM CPU %user %nice %system %iowait %steal %idle 12:10:01 AM all 0.03 0.00 0.03 0.09 0.00 99.85 12:20:01 AM all 0.27 0.00 0.04 &#8230; <a title=\"Disk I\/O Stats in linux\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/01\/26\/disk-io-stats-linux\/\" aria-label=\"Read more about Disk I\/O Stats in linux\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[139],"class_list":["post-3274","post","type-post","status-publish","format-standard","hentry","category-administration","tag-linux"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3274"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3274\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}