I am the owner of a NAS, running some Linux distribution. It comes with a web administration frontend, where I can manage several services, user rights and also when it should go to sleep. My problem is, for some reason, when the NAS has gone to sleep, the hard drive turns on again after a couple of minutes. Then it will spin for some time, then sleep again. This keeps going on indefinitely.

How can I try to determine the cause for this? I am very new to Linux, but I managed to get root access, and now have a SSH connection.

  • This is very old, but may still have relevant tips. Jan 19, 2012 at 0:36
  • Do you have some analytics /like plugin with the web/frontend interface to NAS box? what are the NAS box details? I am wondering if some systemtap tools can be employed in there to check out the disk activity. systemtap is only available for later versions of Linux kernel. Jan 19, 2012 at 6:16
  • The NAS is a Lacie d2 Network 2. There is no plugin options, but i guess i could load anything into it. It runs a Green Unicorn webserver. The kernel is
    – Andreas
    Jan 19, 2012 at 17:38

4 Answers 4


inotify-tools is a simple way of doing this. There are several examples on their site that would be able to do what you want (see the inotifywatch example for a really basic one).

  • I am currently looking into this. First, i need to compile the source for an ARMv5TE cpu. That might prove to be difficult enough :)
    – Andreas
    Jan 19, 2012 at 17:34

Try running iotop perhaps? I've found it useful in the past.


You need to tell the kernel to inform you of all the reads/writes to disks, then you need to look at that information.


# sync
# echo 1 > /proc/sys/vm/block_dump
# dmesg -c | grep '/dev/sda'

sync flushes all pending writes to disks, so that you'll only see new reads or writes.
dmesg -c shows you the kernel messages, and clears them (otherwise you see the old ones too, each time you run dmesg). grep filters the output of dmesg for activity for the disk you're interested in. Replace /dev/sda with your actual device.

I usually use something like this to spin down the disk, then check for when it spins up again:

# sync
# hdparm -y /dev/sda
# while true; do hdparm -C /dev/sda ; sleep 600 ; done

The while loop checks the disk active/idle status every 10 minutes. When you see it power up, run the dmesg line above to see whodunnit.


Another tip: Use Systemtap, there are bunch of probe scripts on systemtap's site useful enough to find the culprit.

In another case altogether,

If you want to find out which process caused the disk to spin up, you can gather information by setting the flag /proc/sys/vm/block_dump. When this flag is set, Linux reports all disk read and write operations that take place, and all block dirtyings done to files. This makes it possible to debug why a disk needs to spin up, and to increase battery life even more. The output of block_dump is written to the kernel output, and it can be retrieved using "dmesg" or look at your syslog kern facility for the destination of the debug messages. Generally, it should be /var/log/debug . When you use block_dump and your kernel logging level also includes kernel debugging messages, you probably want to turn off klogd, otherwise the output of block_dump will be logged, causing disk activity that is not normally there.

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.