Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server (running CentOS 5) and I need to figure out which programs (MySQL, Apache, etc) are doing the most Disk I/O? Is there a command that will allow me to calculate an average over time?

share|improve this question

Something like iotop will help, there are various versions so look at THIS one an google some others too.

share|improve this answer
I'm running a kernel higher than 2.6.20, but I keep getting errors about missing I/O accounting support (CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, CONFIG_TASK_IO_ACCOUNTING). How would I go about adding those variables? – Steven Williams Apr 10 '11 at 2:21

You might try installing the sysstat package and use SAR and iostat. They give better visibility over a range of time if that is what you are looking for.

EDIT: Forgot the link...

share|improve this answer

Whilst sysstat is available for CentOS, the particular package you want doesnt come shipped with CentOS 5.

What you'll need to do is download sysstat from the main page which is here. Configure and compile it. The latest version comes with a program called pidstat. This program will give you what you want. It works much like other *stat utilities like iostat, mpstat and vmstat. Note to pass the -d flag.

You should not install this version, its binary incompatible with the files it creates. Just copy the pidstat program it compiled and stick it in /usr/local/bin instead.

pidstat -d 1 3
Linux (home.localdomain)   04/09/2011  _x86_64_(2 CPU)

07:39:40 PM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command

07:39:41 PM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
07:39:42 PM       888      0.00      4.00      0.00  jbd2/dm-2-8

07:39:42 PM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command

Average:          PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
Average:          888      0.00      1.32      0.00  jbd2/dm-2-8

The output should be pretty self explanatory.

Note that you need to be running a kernel that came with at least CentOS 5.4. Frankly if your not update anyway, there are numerous security reasons to do so and CentOS 5.6 was released very recently.

share|improve this answer

For monitoring IO output activity you can try with iostat, for example a basic usage is :

iostat -x [-d]

-x option displays extended statistics. You definitely want it. -d is optional. It removes CPU utilization to avoid cluttering the output.

Read the man pages for further information.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.