Operations 6 min read

Master Linux I/O Monitoring: iostat, iotop, and lsof Explained

Learn how to diagnose and alleviate heavy I/O load on Linux systems by using three essential commands—iostat for CPU and disk statistics, iotop for real‑time I/O process ranking, and lsof for listing open files—complete with key options and output interpretation.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Master Linux I/O Monitoring: iostat, iotop, and lsof Explained

Introduce three commonly used Linux I/O commands that are useful for solving excessive I/O pressure.

iostat

Outputs CPU and disk I/O related statistics.

Average‑CPU section %user: percentage of CPU used by user programs %nice: percentage of CPU used by nice‑adjusted processes %sys: percentage of CPU used by the system %iowait: percentage of CPU waiting for I/O %idle: percentage of idle CPU time

Device section tps: I/O requests per second Blk_read/s: blocks read per second Blk_wrtn/s: blocks written per second Blk_read: total blocks read Blk_wrtn: total blocks written

Common parameters -c: display only CPU statistics (mutually exclusive with -d) -d: display only disk statistics (mutually exclusive with -c) -k: show values in kilobytes per second (default unit is blocks) -p device|ALL : show statistics for a specific device or all devices -x: display extended information sec: interval in seconds between displays

iotop

A top‑like tool for monitoring disk I/O usage, showing PID, user, I/O, and command information.

iotop is not included by default; install it (e.g., yum install iotop on CentOS).

Main options -o: display only processes doing I/O -b: batch mode, suitable for logging to a file -n NUM : display NUM iterations (non‑interactive mode) -d SEC : refresh interval in seconds -p PID : monitor a specific process ID -u USER : monitor processes owned by a specific user

lsof

lsof

(list open files) lists files opened by processes; it requires root privileges to access full information.

lsof is not installed by default; install it (e.g., yum install lsof on CentOS).

Output fields COMMAND: process name PID: process identifier USER: process owner FD: file descriptor TYPE: file type (e.g., DIR, REG) DEVICE: device name SIZE: file size NODE: inode number NAME: exact name of the opened file

Common usage examples lsof abc.txt: show processes that have abc.txt open lsof -c abc: show files opened by processes whose command name contains abc lsof -p 1234: list files opened by process ID 1234 lsof -g gid: show processes belonging to group ID gid lsof +d /DIR/: list files opened under directory /DIR/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

System AdministrationiotoplsofiostatI/O Monitoring
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.