How to save iotop’s output for a specific period of time

io

I am trying to discern what processes are making huge Read/Writes on my server disk. I know I can use

iotop -ao

but is there a way I can save iotop's output for a specific period of time to study later?

Best Answer

This isn't strictly answering your question, but you might find atop more useful. It can run as a daemon and write to a binary log file. The file contains all data necessary to reproduce what would have been seen had atop been run 'live'.

To run atop as a daemon, you could kick it off as

/usr/bin/atop -a -w /var/log/atop.log 60

to write a snapshot to the log every 60 seconds. Later you can see what was going on at a specific time by doing e.g.

atop -r /var/log/atop.log -b 10:00

to start at 10am. You can then step backwards and forwards throught the log to see how system activity developed.

To address your specific question of disk activity, pressing d while in atop will sort processes by their total disk activity at that point in time, and in the summary at the top of the screen you'll be able to see aggregated per-device statistics.