Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

rc.local:

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
share|improve this question

migrated from serverfault.com Oct 10 '10 at 8:46

This question came from our site for professional system and network administrators.

1  
Are you aware that by spinning down the drives you're shortening their already short lives? –  John Gardeniers Oct 9 '10 at 11:27
    
@John: do you have a solid reference for that? I've seen it argued both ways. @Znarkus: I guess you're running Linux, from your use of hdparm, but you should state your OS explicitly in your question. –  Gilles Oct 9 '10 at 12:13
    
Most disk wear is from the heat-up/cool-down cycle. The less you do that, the longer it will last. –  Chris S Oct 9 '10 at 15:30
    
@Gilles, I don't know of a reference you can look up but personal experience of nearly 4 decades, as well as an understanding of why the wear takes place, is kind of hard to ignore. –  John Gardeniers Oct 9 '10 at 21:34
    
@John: I've learnt to be wary of this kind of “conventional wisdom” — the same that claims that hard drives should run as cool as possible (which turned out to be false). I've asked for quantitative data in a separate question. –  Gilles Oct 10 '10 at 12:16

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
Thanks for all advices. Can I make ´iotop´ show on what drive the activity is? –  Znarkus Oct 12 '10 at 15:42
    
@Znarkus: I don't think so, but if you've found that a particular process is doing I/O, you can use lsof or strace to find what files it has open or opens. –  Gilles Oct 12 '10 at 17:40

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?

share|improve this answer

have you tried iotop?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.