5

I want metrics for how much writing and reading have been done to a folder.

vmstat -d gives metrics at the whole disk level. iotop will give per process rw stats.

But how can I find out how much writing has been done to a folder or file?

5
  • 1
    Can't you compare the outputs of two different du -sx invocations?
    – Bratchley
    Dec 19, 2014 at 23:41
  • 3
  • You may want to clarify what "how much writing" means for you. Difference between the directory sizes before and after writing? Amount of data sent to the underlying block device?
    – peterph
    Dec 20, 2014 at 19:41
  • @don_crissti, one of those answers involved loopback mounting the directory in question - gotta love the simplicity of it.
    – rjt
    Jan 3, 2015 at 17:53
  • @peterph, one movtivation is estimating SSD longevity due to caching proxy server rewrites. Amount of data sent to an underlying block device due to /var/proxy/cache/, but not not /var/log/.
    – rjt
    Jan 3, 2015 at 18:04

1 Answer 1

0

Given the clarification in the comment - the need of knowing how much data is being sent to the underlying block device (e.g. for the purposes of logging activity on SSD) - you'd need to check this in the file system driver and below (which usually is part of the kernel). Note, that just writing to a file doesn't mean the data gets really sent or even written to the device - there usually is lots of caching between the write() system call in user space and the actual bits making it into the wires connecting the hard drive to the controller.

Not the answer you're looking for? Browse other questions tagged .