See also the existing page, IdentifyWhichProcessesAccessDisk
To find out which process spins up your disk, do this:
My disk spins up all the time and I have no clue what causes this. Can I debug this?
Yes, you can. But first, check that you have modified your syslog.conf to not sync. How you modify syslog.conf depends on which syslogd is installed. If your '/sbin/syslogd' is a symbolic link to 'busybox' then you really don't have a fully functional syslogd and should follow the 'Busybox syslog.conf' instructions. Everyone else should follow the 'syslog.conf' instructions.
First stop the syslogd with the command '/etc/init.d/syslog stop' Then edit '/etc/syslog.conf' and Change the 'DESTINATION' to 'buffer' Restart the syslogd with the command '/etc/init.d/syslog start'
In /etc/syslog.conf, you have to place a dash (-) before the log file name, e.g. the line kern.* /var/log/kern.log becomes kern.* -/var/log/kern.log. You then have to either 'kill -HUP' on the syslogd process or start and stop the daemon.
Turn on disk activity debugging
Then to debug disk activity, you can do:
echo 1 > /proc/sys/vm/block_dump
(Warning: you must disable syslogd before you do this, or you must make sure that kernel output is not logged. If you forget this, your system may get into a feedback loop, where syslogd causes disk activity, this causes kernel output, and this causes syslogd to do more disk activity, etcetera!)
This enables file/disk activity debugging in the kernel. You can read the output using dmesg. When you're done, disable block dump using
echo 0 > /proc/sys/vm/block_dump
Under debianslug it is easier to accomplish. Simply install laptop-mode-tools
aptitude install laptop-mode-tools
This package contains a set of scripts which monitor your hardisk (it could set several energy saving profiles too but the NSLU2 doesnt support this).
The most interesting script is called lm-profiler. Start it with
and watch it's output. It lets you disable unneeded system services after the scan too if you want.
In OpenDebianSlug you don't get 'lm-profiler' even if you install laptop-mode-tools using apt-get. Do the following in OpenDebianSlug:
tar -xzvf laptop-mode-tools_1.31.tar.gz