- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Monitor Disk IO in a Linux System
Abstract
Disk monitoring is an important task to perform while maintaining a linux system. Essentially, getting data back from the disk costs time. As a result, the disk I/O subsystem is considered the slowest part and can slow down the whole system.
Checking disc performance is crucial as a result. We must determine which process is waiting for the I/O request to complete and determine whether there is a bottleneck and what is causing it. To examine the disc I/O performance in Linux systems, we'll learn how to use tools like iostat, iotop..
iotop installation in Linux
It is readily simple to install with the aid of a package manager because the package is present in the repositories of all Linux distributions.
Iotop can be installed using the DNF Command on Fedora and RHEL/CentOS 8 systems.
$ sudo dnf install iotop
Iotop can be installed on Debian/Ubuntu systems using the APT-GET Command or the APT Command.
$ sudo apt install iotop
Iotop can be installed on RHEL/CentOS 6/7 systems using the YUM Command
$ sudo yum install iotop
Using the iotop command to monitor disc I/O
The iotop command offers a wide range of options for checking various disc I/O statistics.
To view the current I/O utilization for each process or thread, run the iotop command without any parameters.
$ sudo iotop
Output
Total DISK READ : 18.27 K/s | Total DISK WRITE : 0.00 B/s 0.00 B DISK READ: 18.27 K/s | Actual DISK WRITE: 14.61 K/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 509 be/3 root 0.00 B/s 0.00 B/s 0.00 % 3.91 % [jbd2/dm-0-8] 247269 be/4 0.00 B/s 0.00 B/s 0.00 % 0.21 % kworker/0:2] 2507 be/4 nwd 18.2 B/s 0.00 B/s 3.57 % 0.00 % gnome-terminal 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % systemd --switch 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] 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 % [rcu_tasks_kthre] 11 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_tasks_rude_] 12 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_tasks_trace] 13 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0] 14 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_sched]
iostat installation in Linux
Iostat can be installed using the DNF Command on Fedora and RHEL/CentOS 8 systems.
$ sudo dnf install sysstat
Iostat can be installed on Debian/Ubuntu systems using the APT-GET Command or the APT Command.
$ sudo apt install sysstat
Iostat can be installed on RHEL/CentOS 6/7 systems using the YUM Command
$ sudo yum install sysstat
Using the iostat command to monitor disc I/O
The iostat command offers a wide range of options for checking various CPU and disc I/O statistics.
To view the whole system statistics, run the iostat command without any arguments.
$ iostat
Output
Linux 4.19.32-1-MANJARO Thursday 18 April 2022 _x86_64_ (8 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 29.45 0.02 16.47 0.12 0.00 53.94 Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd nvme0n1 6.68 126.95 124.97 0.00 58420014 57507206 0 sda 0.18 6.77 80.24 0.00 3115036 36924764 0 loop0 0.00 0.00 0.00 0.00 2160 0 0 loop1 0.00 0.00 0.00 0.00 1093 0 0 loop2 0.00 0.00 0.00 0.00 1077 0 0 sda 3.14 63.31 38.14 0.00 19772796 11911070 0 scd0 0.00 0.00 0.00 0.00 1 0 0 zram0 7.74 9.36 21.58 0.00 2924188 6738944 0
Conclusion
In this article, we learnt how to examine disc I/O performance using the iostat and iotop. We also talked about using the iotop command to view disc read and write activity broken down by process.
There are several other commands i.e., vmstat and sar commands which can be used to monitor disk in I/O in a Linux system. I hope you find these examples of the commands useful and that it's easy to learn and use Linux.