cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar









Etc


Reference














.

os:linux:performance:disk



Disk I/O on Linux Performance (sar, bwm-ng)

Linux Command for Disk IO

sar -b

root@ubuntu20:~# sar -b 1
Linux 5.4.0-65-generic (ubuntu20)       03/04/2021      _x86_64_        (2 CPU)

09:11:45 AM       tps      rtps      wtps      dtps   bread/s   bwrtn/s   bdscd/s
09:11:46 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:47 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:48 AM      2.00      0.00      2.00      0.00      0.00     64.00      0.00
09:11:49 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:50 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:51 AM      2.00      0.00      2.00      0.00      0.00     16.00      0.00
09:11:52 AM      6.00      4.00      2.00      0.00     40.00     24.00      0.00
09:11:53 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:54 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
09:11:55 AM      0.00      0.00      0.00      0.00      0.00      0.00      0.00
^C

Average:         1.00      0.40      0.60      0.00      4.00     10.40      0.00
root@ubuntu20:~#


iostat

root@ubuntu20:~# iostat -xtk  1

03/04/2021 09:12:48 AM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.50    0.00    0.00   99.50

Device            r/s     rkB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wkB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dkB/s   drqm/s  %drqm d_await dareq-sz  aqu-sz  %util
loop0            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop1            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop2            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop3            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop4            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop5            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
loop6            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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
scd0             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      0.00     0.00   0.00    0.00     0.00    0.00   0.00
vda              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      0.00     0.00   0.00    0.00     0.00    0.00   0.00

^C
root@ubuntu20:~#


iotop for check the process using i/o

root@ubuntu20:~# iotop

Total DISK READ:       386.75 K/s | Total DISK WRITE:        19.34 K/s
Current DISK READ:     386.75 K/s | Current DISK WRITE:       7.74 K/s
    TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND
    831 be/4 www-data  286.20 K/s    0.00 B/s  0.00 %  0.29 % php-fpm: pool www
    832 be/4 www-data  100.56 K/s    0.00 B/s  0.00 %  0.21 % php-fpm: pool www
  82613 be/4 www-data    0.00 B/s   19.34 K/s  0.00 %  0.00 % nginx: worker process
      1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % init maybe-ubiquity
      2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
      3 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_gp]
      4 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_par_gp]
      6 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/0:0H-kblockd]
      9 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [mm_percpu_wq]
     10 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
     11 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_sched]
     12 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
     13 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [idle_inject/0]
     14 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [cpuhp/0]
     15 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [cpuhp/1]


dstat -tr

root@ubuntu20:~# dstat -tr
----system---- --io/total-
     time     | read  writ
04-03 09:15:55|1.53  1.52
04-03 09:15:56|1.00     0
04-03 09:15:57|   0  2.00
04-03 09:15:58|   0     0
04-03 09:15:59|   0     0
04-03 09:16:00|1.00  1.00
04-03 09:16:01|3.00     0
04-03 09:16:02|   0     0
04-03 09:16:03|39.0  4.00 ^C
root@ubuntu20:~#

dstat (read, write, sum)

root@ubuntu20:~#  dstat -tr | awk -F '|' 'NR>2{split($2,arr," ");sum=arr[1]+arr[2];print $0,sum}'
04-03 09:16:56|1.53  1.52  3.05
04-03 09:16:57|   0     0  0
04-03 09:16:58|   0     0  0
04-03 09:16:59|   0     0  0
04-03 09:17:00|   0     0  0
04-03 09:17:01|   0     0  0
04-03 09:17:02|2.00     0  2
04-03 09:17:03|   0     0  0
04-03 09:17:04|   0  3.00  3
04-03 09:17:05|1.00     0  1
04-03 09:17:06|   0  2.00  2
04-03 09:17:07|   0     0  0
04-03 09:17:08|   0     0  0
04-03 09:17:09|   0     0  0
04-03 09:17:10|   0     0  0
04-03 09:17:11|   0     0  0
04-03 09:17:12|   0  2.00  2
04-03 09:17:13|4.00     0  4
04-03 09:17:14|   0     0  0







os/linux/performance/disk.txt ยท Last modified: 2021/03/04 by admin

Page Tools