When there are no users on my system, I would like the hard disk to spindown to low-power state. I realize that this might not be 100% achievable for a straight 24 hours, but it seems reasonable that the system could remain idle for a few hours at a time when it is not in use.
My system is headless and running a limited number of services. The primary services are: exim4, mythtv-backend, nfs, samba, cups, apt-cacher-ng
Assume that drives are already enabled to go into standby mode. Also, its not acceptable to increase the write-back timeout, since my system is not on a UPS.
hdparm lets you set the spindown time for a drive (how long period of inactivity before the disk goes to standby mode) or put it in standby or to sleep.
/etc/hdparm.conf contains hdparm commands to run automatically at bootup. Here's a snippet from mine:
Not all commands work on all hard drive models, you need to experiment.
laptop-mode works for non-laptops too, it is meant to let the disk(s) sleep as much as possible.
PowerTOP is a utility for tracking down unnecessary background activity.
lesswatts.org has a number of tips on harddrive spindown.
write-back timeout: To the best of my knowledge it is not possible to have the primary disk go idle without a) increasing the write-back timeout and b) disabling syslog sync.
A workaround could perhaps be to have an SSD as the root disk, as they are fairly low on power anyway?
tracking activity: It is possible to debug where disk access is coming from according to the laptop-mode FAQ - see 5 Spinup Debugging.
Quote:
disabling syslogd sync: The laptop-mode FAQ and lesswatts.org refer to
/etc/syslog.conf
.In recent Ubuntu this file does not exist, instead look for
/etc/rsyslog.d/*.conf
.The syntax is the same - prepend every log file with a dash, like this:
This turns off syncing for the syslog deamon, meaning that the logs will be written to disk at
dirty_writeback_centisecs
intervals (every 5 sec by default) instead of every time there is new log entry.If you have sufficient RAM you can move temporary filesystems to memory, using tmpfs. Edit /etc/fstab and add:
mount it with
noatime
more RAM also helps (bigger buffers and caches)
On my laptop I mounted /var/log to a tmpfs ram drive. That gives you far less disk writes but of course any log messages are discarded upon reboot. Something you might not want when you are running services like exim.
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
and in /etc/rc.local
mkdir /var/log/apt