Im looking for some small script or application which could log the time when a non-system disk wakes up.

I cannot identify which application or script wakes up my non-system drive (which has to be asleep until I work with it). I have already set the noatime flag, tried to use powertop and iotop to determine which application could prevent it from going to sleep - but with no result.

So my plan is to set this drive asleep (hdparm -Y) and see at what time it gets regularly woken up.

Thanks for any advice.

5 Answers 5


In order to find out what files are being accessed (which may help narrow down the process responsible), you can try using inotifywatch which can be set up to recursively watch directories below a directory you choose. Be sure to read the warnings in the man page regarding using --recursive on a large tree.

When a filesystem event occurs in a directory in that tree, it is recorded and output in a table. You can use --timeout to limit the amount of time that the watch is active.

If the results are consistent, you can run a non-recursive watch on the files in that directory to narrow down the particular file.


As you are on linux, you can use the new fatrace utility, which logs every file access and tells you which process is responsible:


More information here:


It makes use of the linux fanotify API (more details) available since linux kernel 2.6.37.

fatrace isn't packaged by most distributions as of July 2014 (it entered debian testing recently, so should ship in 'jessie'), but is easy to install from source.


See this ubuntu bug report on how to track that down (and a possible cause).

Short answers: auditctl -w /dev/sdX -p rwa and udisks


You can use hdparm -C to get the power mode status of the disk at any time. Here's a script that would give you the times:

while true; do 
  state=`hdparm -C /dev/sda|grep "^ drive"|cut -c 19-`
  echo `date` $state
  sleep 1

Run the script with sudo, as hdparm needs root privileges. You can redirect echo to some file, e.g.:

echo `date` $state >> /tmp/sda_state

and of course change the disk you are monitoring (I used /dev/sda) to what you want and the sleep interval, such as sleep 120 to query every two minutes.

This doesn't give you the process which wakes up the drive, though.

You may have issues with the above due to some bugs:

If you are having issues with hdparm -C waking up your drive, try this instead:

smartctl -i -n standby /dev/sda|grep "^Power mode"

As per man smartctl, when run with -n standby, smartctl should not wake up the drive. Note there are also bugs with this:

so try to see if it works.

  • hdparm -C wakes up the drive as well
    – NumberFour
    Commented Nov 21, 2010 at 0:05
  • I edited to provide an alternative - hope this is going to work for you. Commented Nov 21, 2010 at 1:55
  • Unfortunately the drive still wakes up, I even tried the new version of smartmontools 5.40 but with no result :( Anyway thanks for your advice!
    – NumberFour
    Commented Nov 21, 2010 at 11:46
  • Try trying the latest version of hdparm also. Sorry it didn't work out for you, but it very well might be an issue with the hardware. If you can, try it on some other machine and/or a different OS. Commented Nov 21, 2010 at 15:26

I can't answer to your question but I want to point on you on a detail that might be interesting: several sata hdd have a jumper to set them sleeping by default (the controller has to send a sata command to wake up the disk. [not all controllers can do that]).

Is the jumper already set?


  • I looked into the manual for Seagate drives, but it appears to have only one possible jumper configuration and that's to limit the drive's operation to 1.5Gbps.
    – NumberFour
    Commented Nov 20, 2010 at 13:54
  • what's the model and sn# of the disk?
    – damko
    Commented Nov 20, 2010 at 17:00
  • Barracuda,3QD0CGGM
    – NumberFour
    Commented Nov 21, 2010 at 11:32
  • mmm can't find anything helpfull about the spin-down of that disk. Sorry
    – damko
    Commented Nov 21, 2010 at 13:29

You must log in to answer this question.

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