Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I enable spinning down of idle hard disks on a Debian (Lenny) server?

I don't have spindown enabled currently, but if I watch the HD light it flashes every few seconds even though I know the server isn't being used for anything. Presumably the system is updating ext3 journal logs with latest atime values, or some annoying log file is being constantly updated. If I only do the hdparm setting for spindown I presume I will see almost no effect, as the disk will be kept spun up by all this idle activity.

share|improve this question

3 Answers 3

This is a bit tricky. There are actually lots of files that have active writes at any time...mostly logs...

There are some considerations as well. If you spin the drive down too many times, it will die in less than a year. So you'll want to keep a careful eye on how often it does spin up.

First, try enabling laptop mode in /proc/sys/vm/laptop_mode, this will have an effect on how data is written to disk. I don't have all the details on this, but my limited understanding is that it causes the I/O to build up and "wait until the last moment" to write to disk...so small writes tend to sit around in cache for some time.

Next, be sure to set /proc/sys/vm/swappiness to something like 0. Every time you page from VM, you'll generate a disk I/O. Supressing your VM as much as possible will help with this regard. If you can take it to the extreme (you have like 3-4Gb of RAM) you can just disable swap partitions and files altogether, and this issue will go away.

If your drives can still be seen as ATA devices and not SCSI (as SATA is wont to do) then you can use hdparm to set drive idle times.

I've written about this elsewhere, but if you're attempting to reduce I/O, you might need to set up /tmp as a RAM disk. I'm not 100% keen on this but it is a necessary step in getting the system to not write out to disk.

Debian has syslog sending a MARK to the logfile every 20 minutes. This will annoy you (and your hard drive) so you'll need to disable this as well.

More info on how to spin down drives can be found here.

share|improve this answer

I would guess this simply depends on the firmware of the hard disk controller if it supports this feature. Some disks do spin down if there is no activity (e.g. WD Caviar).

share|improve this answer

At first, you should mount your partitions with 'relatime' to optimize ext3's behavior. Then find out what is accessing your disks (logfiles?). I think you're not talking about your root partition or another system disk but rather a optional storage you write to/read from manually?

I use hd-idle to spin down an external USB disk on my HTPC.

HTH,
PEra

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.