Monitoring disk activity with iotop
The program watches I/O usage information output by the Linux kernel (/proc/pid/io) and displays a table of current I/O usage by processes on the system. Red Hat backported I/O accounting in RHEL 5.4(kernel 2.6.18-164.el5) so the above statement does not apply on Red Hat Enterprise.
Even though I/O accounting was enabled in RHEL 5.4 the kernel is not configured correctly so iotop really works starting with RHEL 5.6 (kernel 2.6.18-238.el5). If /proc/self/io file exist then the I/O accounting is built-in the kernel. Since 2012 iotop is part of the Red Hat Enterprise Linux.
- rchar: The number of bytes which this task has caused to be read from storage.
- wchar: The number of bytes which this task has caused, or shall cause to be written to disk.
- syscr: Attempt to count the number of read I/O operations (system calls such as read and pread).
- syscr: Attempt to count the number of write I/O operations (system calls such as write and pwrite).
- read_bytes: Attempt to count the number of bytes which this process really did cause to be fetched from the storage layer.
- write_bytes: Attempt to count the number of bytes which this process caused to be sent to the storage layer.
- cancelled_write_bytes: Represents the number of bytes which this process caused to not happen, by truncating pagecache.
- Show processes or threads actually doing I/O:
- Turn on non-interactive mode (useful for logging I/O usage over time):
- Set the number of iterations before quitting:
- Add a timestamp on each line (implies –batch):
- Only show processes (by default iotop shows all threads):
- Monitor one or more processes:
iotop -p 2446
- Monitor a specific user:
iotop -u postfix
- Set the delay between iterations in seconds (1 second by default):
iotop -d 5
- Suppress some lines of header (implies - -batch):
Use batch mode, 60 iterations (1 minute) with timestamp, column names are never printed, save all in a file.
Monitor a specific PID for 24 hours:
Use the left and right arrows to change the sorting (the sort field will have a “>”)
|r||reverse the sorting order (“>” change to “<”), default option is I/O.|
|o||toggle the - -only option|
|p||toggle the - -processes option|
|a||toggle the - -accumulated option (shows accumulated I/O since iotop started)|
|i||change the priority of a thread or a process’ thread(s)|