How do I tell which processes are writing heavily to disk in CentOS 5?

10,241

Solution 1

So sadly none of the iostat and related packages work in CentOS 5. But I was able to find the culprit slow process by using:

ps auxf | grep ' B'

Which shows all the processes waiting in uniterruptible sleep caused by I/O waiting, so it is likely to be processes doing a lot of I/O.

This was thanks to this ServerFault answer: wa (Waiting for I/O) from top command is big

Also, for those wondering if the I/O is slow because of swapping, take a look at your top output and see what the sum of (free + cached) columns says. Or better use htop, which shows this in a less confusing way.

Solution 2

I also like iotop

Solution 3

collectl may be what you are after. I/O statistics by process, among other things. collectl --top io to print a top-like listing sorted by IO usage, collectl -sZ for collectl native output for the processes subsystem. Adding the --procopts t switch will show threads too.

As Richard Salts mentioned, IOTop will give you a UI with more detailed I/O stats, if you have a window manager and Python then use that. In either case though, if your kernel doesn't support it (2.6.20 or later is a safe bet) then neither program will work.

Share:
10,241
Artem
Author by

Artem

Updated on September 17, 2022

Comments

  • Artem
    Artem almost 2 years

    Our server started getting slow, so I ran iostat on it.

    iostat -dx 5

    Device:         rrqm/s   wrqm/s   r/s   w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
    sda               0.00    89.60 108.40  5.60   880.00   763.20    14.41     2.61   22.87   8.70  99.20
    sdb               0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
    

    So I see that the one disk sda is totally saturated. How do I find which exact processes are causing this? (or is it swapping to that disk?)

    • Artem
      Artem almost 14 years
      On CentOS 5, the kernel is the older one, and so tools like iotop do not work! See my poor man's solution to this below.
  • Artem
    Artem almost 14 years
    I am on CentOS 5.
  • Artem
    Artem almost 14 years
    As you anticipated, sadly, I get "Error: you cannot use --top and IO options with this kernel type 'collectl -h' for help" I am on CentOS 5. What are my options in this case?
  • vnix27
    vnix27 about 13 years
    Its B or D. I think D state show uninterruptable sleep