I have a webserver being idle most the time. This causes the main hard drive to spin down after a few minutes, all the other hard drives are already spun down. This is a wanted behavior, since I want the system to be as much power-saving as possible.

Unfortunately, the main hard drive spins up again after a few seconds, causing a lot of wear on the hard drive mechanics. This happens reliably all around the clock, even if noone is accessing the web server. Is there a way to log the drive's spin up events, and maybe the source?

And is it possible to create an automatic ramfs cache or something similiar? I guess that it's the same file that gets accessed repeatedly, and it would be great if one could allocate an area in memory as a cache where files that are accessed get copied into, so they don't have to be fetched from disk and therefore the disk doesn't need to spin up. Thanks in advance!

  • Have you looked into using smartctl? Jan 11, 2018 at 15:25
  • I have looked into smartctl, yes, but I don't know how to diagnose the issue using that. I could of course pull the spin up count from smartctl frequently, but there must be a smarter method...? I'll have a look into fatrace!
    – LukeLR
    Jan 11, 2018 at 15:46

2 Answers 2


fatrace was written specifically for this. It monitors access to files on the filesystem.

This usually works well. You should understand that in theory, you can have bugs in storage software that work on a lower level, i.e. directly accessing the block device or inside the kernel.

I sync first & let the hard drive idle... but you will want to spin it down manually with hdparm... then any audible disk activity can be attributed to either writes or uncached reads shown by fatrace. The spindown is necessary because otherwise it's difficult to know whether a read was cached or not. if you use sudo, that writes logs, so open a root shell (sudo -i) to run sync and hdparm and fatrace from.

so they don't have to be fetched from disk and therefore the disk doesn't need to spin up

this is such a great idea (for performance) it's basically already implemented as described, it's called the page cache.

but it is very common to have log files, or possibly databases, that are being written at frequent intervals, causing a situation like you describe.


There's a possibility that you may not like this answer, but there's a really easy solution:

Replace the disk with an SSD.

They use less power both while active and while idle than traditional hard drives, and resuming from an idle state has near zero impact on their life expectancy.

Given that the disk in question is your main disk, it's very likely that doing this will also improve the system's overall performance (or at least cut boot up times).

  • Yes, I already considered this as a long-time solution, but I need a solution now, until I find the money to buy a SSD. :)
    – LukeLR
    Jan 12, 2018 at 23:35

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.