I have built a little NAS-like device on armbian, that uses external harddisks for its file serving purposes. The (hardware) interface only provides a reduced SATA-command set and overrides some APM/AAM/standby functions, but I would like to have a longer interval until standby.

I am succesfully able to keep the drives awake by repeatedly issuing some SATA commands, but I have trouble implementing a certain logic.

I would like to mimic, disk-standby after xx minutes of last activity.

Is there any clever way or monitoring utility that would tell me the last time, when either SMBD, ZFS or ideally the harddrive itself performed some read/write activity?

Something like the interval in ifplugd... Should I get to know "dtrace"?

  • Whether you can do that or not depends on your disks. Your best shot is probably hdparm, but some WD disks need some special utility for that, and messing with standby the wrong way is known to shorten the disks' lives. Oct 1, 2017 at 10:59

1 Answer 1


Perhaps you can just poll the counters of the number of read/write operations on the block device, and do your action when they no longer change. For a block device like sda, the statistics are in /sys/block/sda/stat, and the columns are described in the kernel Documentation/iostats.txt. In particular columns 1 and 5 added together give the total completed i/o operations.


You must log in to answer this question.

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