What is keeping my disks awake?

Posted on


I have configured my hard drives to go to sleep after 1 minute of inactivity. This used to work very well; the server was almost always dead silent. But recently the drives are more often awake.

Can I check what is keeping them from going to sleep? This is a home server.


hdparm -M 128 -S 60 /dev/sda
hdparm -S 60 /dev/sdb

Update: The server is running Ubuntu 10.04. The OS, with /tmp and /var/, is on an SSD, while sda and sdb are only used for storage/backup.

Update 2: From my sysctl.conf:

vm.swappiness = 1
vm.vfs_cache_pressure = 50
vm.dirty_writeback_centisecs = 1500
vm.dirty_ratio = 20
vm.dirty_backgrounds_ratio = 10


This isn’t really an answer to the question you ask, but may help with the underlying issue. One tool I know of is iotop, but it might not help to catch brief activity from a process.

Getting hard drives to sleep when idle can be difficult, because there are so many potential sources of activity. Just because you think your system is doing nothing doesn’t mean something isn’t writing in the background. Here are a few common culprits:

  • Journal flushing. Linux flushes the ext3 (or ext4) journal at regular intervals whether it needs flushing or not. This can be tuned with the commit mount option.
  • System logs. Under a default configuration, some system logs are flushed whenever a line is written. Cron jobs are habitual offenders because they trigger an auth log entry. You’ll want a - before all log file names in /etc/syslog.conf.

If you really want your disks to spin down, check out noflushd. It really works (or at least it used to, it hasn’t been maintained much lately and might have issues with contemporary kernels). But beware that it’s a hack, and it’s really heavy-handed: it simply stops the kernel from writing until either the cache is full or the disk wakes up anyway for a read.

If you’re looking for silence, a technique that helps a lot is to suspend the disks from elastics instead of mounting it directly. This won’t help reduce power consumption, but unless you have ≥10krpm drives (which require a screamer of a fan anyway), the CPU and motherboard are probably the main power drains even when idle.

Make sure you’ve turned off any verbose logging. If you have machines that are sending out broadcasts on particular ports that are logged by your firewall rules, you’ll easily get an entry enough that the drive won’t spin down. HP Printers and Windows machines are notorious for sending out broadcasts to check for other machines on the local network and most firewall rules log those requests.

Check the services you have running to see if any might be logging to their own files. Do you have fam running? swappiness set high and enough services that you’re constantly shuffling things from ram to swap? cron jobs?

have you tried iotop?

Leave a Reply

Your email address will not be published. Required fields are marked *