[Techtalk] updatedb hard drive thrashing
akkana at shallowsky.com
Sun Jun 22 18:52:34 EST 2003
ed orphan wrote:
> I'm running Red Hat 7.3 and every so often, while I have KDE going,
> the hard drive starts to work very very hard. [ ... ] a
> program called updatedb. [ ... ]
> have to do a shutdown and re-boot to make it stop thrashing the hard
> drive. Does anyone else have this problem? Any information on
> updatedb would be most welcome!
Oh, no, you shouldn't have to reboot!
First, to stop updatedb, as root, type this:
That should kill the current run.
Second: Redhat is very aggressive about running updatedb. It's
really annoying to have it run every day. Especially on a laptop.
Here's why it runs so often, and how to change that:
It runs from a daemon called cron, which is responsible for doing
housekeeping tasks on a regular basis. Redhat organizes its cron
scripts in a nice easy-to-understand way: go to /etc and you'll
see four directories: cron.hourly, cron.daily, cron.weekly, and
The updatedb script which is pestering you is running from
/etc/cron.daily/slocate.cron. There is another script which also
runs daily and makes your disk whir, called makewhatis.cron, which
you also might see from time to time. (The other scripts in cron.daily
probably won't bother you, though I occasionally hear people complain
about logrotate. I'd recommend leaving that one alone, though, if it's
not bothering you.)
So how do you make one of these scripts stop bothering you? Easy!
Just move it from daily to weekly, or even monthly, by moving the
mv /etc/cron.daily/slocate.cron /etc/cron.weekly
(and the same for makewhatis or anything else that's bothering you).
Note that this means that once a week/month, it will still run.
If you find it still bothers you, you can turn it off completely
by just removing the file. But then, if you want to be able to use
"locate" or the gui find tools, you'd better run updatedb by hand
every now and then. (Debian systems don't run updatedb for you, so
you have to run it by hand, or set up a cron script yourself.)
You can also fine-tune cron, to make scripts run at particular
times. For instance, if you know you're never at your machine at
2:30am on Wednesday mornings and 12:30pm on Sunday afternoons, you
can make updatedb run at those times. But that's a little harder
than just using the directories; "man cron" will tell you all about it.
More information about the Techtalk