noflushd is a daemon that changes the way kupdate works. As explained in the Section called Introduction to I/O, the normal behavior of kupdate is to run periodically, flushing updated data to disk. noflushd implements a different algorithm, designed to reduce the need for spinning up the drive. Specifically, noflushd monitors disk activity using the counters in /proc/stat. When it sees no activity for a user defined period of time, it spins down the disk, and stops the kupdate thread. When noflushd notices disk activity (perhaps a process needed to read data from disk, or someone executed the sync command), it restarts kupdate, and waits for another period of inactivity. So every time you access the disk for some other reason, your modified data gets written to disk.
In pseudo-code, it looks something like this
while (disk is spinning) { if (no read activity in last n minutes) { sync buffers spin down disk stop kupdate } else { start kupdate } sleep for a bit } while (disk is not spinning) { if (some disk activity occurred) { start kupdate reset inactivity timer } sleep for a bit }
The upshot of this is that by running noflushd, you can eliminate the hard drive spin-ups caused by periodic flushing of modified data to disk. But remember that the longer your disk remains spun down, the more modified data you stand to lose in the event of a crash.
Caution |
If you've just finished an important piece of work, which you can't afford to lose, run sync to make sure the changes make it to disk. |
To use noflushd, simply install the appropriate package for your system (Debian, RedHat, SuSE, etc). Also, check out the README that is included with noflushd. It gives a more detailed explanation of how noflushd works.
Alas, kupdate isn't the only source of disk spin-ups. In the next section, we consider other programs that may cause your drive to spin up.