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

10,309

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:
10,309

Related videos on Youtube

pauldoo
Author by

pauldoo

C# by day, Java by night.

Updated on September 17, 2022

Comments

  • pauldoo
    pauldoo almost 2 years

    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.