Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.7 and a Linux kernel ≥ 2.6.20 with the TASK_DELAY_ACCT CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on.
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.
[root@c5vm01 ~]# cat /proc/self/io rchar: 1900 wchar: 0 syscr: 7 syscw: 0 read_bytes: 0 write_bytes: 0 cancelled_write_bytes: 0
- 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.
yum install iotop python python-ctypes
- 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.
iotop -o -b -n 60 -t -qqq > iotop.out
Monitor a specific PID for 24 hours:
iotop -o -p 1155 -b -n 86400 -t -qqq > iotop.out &
- use the left and right arrows to change the sorting (the sort field will have a ">")
- r to reverse the sorting order (">" change to "<"), default option is I/O.
- o to toggle the - -only option
- p to toggle the - -processes option
- a to toggle the - -accumulated option (shows accumulated I/O since iotop started)
- i to change the priority of a thread or a process' thread(s)
- q to quit