Archive for December, 2011

I spent some time googling around this afternoon, and kept reading that iotop requires kernel 2.6.20 and python 2.6, and therefore was a bit of a challenge to get running on RHEL/CENTOS 5.X. However, the requirements are actually pretty basic, and easy to get running on a somewhat recent update of RHEL 5.

Redhat has backported the per process IO accounting feature to the 2.6.18-144 kernel. So if /proc/self/io exists, and you get results from /proc/<PID #>/io then iotop will work.

[root@gateway /]# cat /proc/self/io
rchar: 1900
wchar: 0
syscr: 7
syscw: 0
read_bytes: 0
write_bytes: 0
cancelled_write_bytes: 0

[root@gateway /]# cat /proc/3227/io
rchar: 25970197
wchar: 26186855
syscr: 4859727
syscw: 2516047
read_bytes: 3854336
write_bytes: 47595520
cancelled_write_bytes: 274432
[root@gateway self]#

 

Basic Steps for setting up iotop on RHEL 5.7 (And probably older versions as well, though I haven’t tested).

Update Kernel to 2.6.8-144 or higher.

yum update kernel

Install epel repository – There are plenty of instructions out there, but it will look something like this for x64 RHEL:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Then you just need Python 2.4, python-ctypes, and iotop packages:

yum install python python-ctypes iotop

Thats it! Pretty easy huh?

 

Update 12/27/2011:

I had a case where iotop wouldn’t run on a linux 3.1 kernel, I believe because of mprotect() (Not sure though). In either case, I discovered that htop gets you most of what iotop will get you , plus a lot more. Its a pretty neat tool. I suggest checking it out.  You still need a kernel that has IO statistics in /proc (as mentioned above).