There's more...

While the iotop data is not actually part of the statistics gathered automatically by the sysstat package, we can log the data for posterity anyway. Follow these steps as a root-level user to log the iostat data:

  1. Create a file named iotop at /etc/cron.d/ and fill it with this line:
        * * * * * root iotop -boat -qqq -d 5 -n 2 >> /var/log/iotop 
  1. Reload the configuration files of the cron service with this command:
        sudo service cron reload

By adding the -a parameter, iotop will log the cumulative total of the I/O used between the readings, instead of the I/O per second. We use the -d argument to add a 5 second delay between two readings, as specified by the -n parameter. Together, this means that we get a 5 second sample ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.