iotop: How to monitor Disk I/O performance

One Ubuntu Linux machine (on Azure) not sure some times overloaded.

For more detail information, setup iotop to monitor the Disk I/O performance.


$ sudo apt install iotop


$ sudo iotop --only
  • Only show processes or threads actually doing I/O, instead of showing all processes or threads. This can be dynamically toggled by pressing o.

Setup monitoring & Logging
$ sudo iotop -botqqqk --iter=60 | grep -P "\d\d\.\d\d K/s"

06:28:02   427 be/3 root        0.00 K/s   11.77 K/s  0.00 %  0.00 % systemd-journald
06:28:03   353 be/3 root        0.00 K/s   98.26 K/s  0.00 %  6.09 % [jbd2/sda1-8]

[...]
  • Date, TID, PRIO, User, Disk Read, Disk Write, SWAPIN, IO

$ sudo crontab -e

* * * * * /usr/sbin/iotop -botqqqk --iter=60 | grep -P "\d\d\.\d\d K/s"  >> /var/log/ioto


Log Rotation
Edit /etc/logrotate.d/iotop
/var/log/iotop {
  rotate 7
  size 50M
  daily
  compress
  delaycompress
  notifempty
  missingok
}



References



Update