3

I understand by installing dstat, iostat I can get the disk activity stats information. However, now I am hoping to minimize the dependencies as I don't want to force my script users to install additional stuff. So I'm wondering if there is any way to read the disk stats information from somewhere in /proc/? Thanks.

3
+50

You can find disk statistics in two places.

  • /sys/block/<dev>/stat
  • /proc/diskstats

Whereas /proc/diskstats represents the statistics of each single block device including partitions and device mapper devices.
Unfortunately these numbers do not provide per second statistics but a grand total of the single statistics. So you would have to write a script that monitors the figures over a given time, then do the math to get a per second result. This job is done by dstat and iostat. A more comprehensive description of these files can be found in the kernel documentation Documentation/block/stat.txt and Documentation/iostats.txt.

Most users want to install the packages containing iostatas the dependencies aren't too huge. dstat depends on pyhton2 but most distros have python2 installed anyways.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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