The updatedb database on my debian (squeeze) server is quite slow.
- where is the database located
- how can I view its content and find out if there are some paths with useless stuff, that I could add to the prunepaths?
- how can I prune all paths that contain
*/.git/*
,*/.svn/*
and similar? - why don't the files get excluded, I defined in
PRUNEPATHS
?
my /etc/updatedb.conf
looks like this:
...
# filesystems which are pruned from updatedb database
PRUNEFS="NFS nfs nfs4 afs binfmt_misc proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs shfs sysfs cifs lustre_lite tmpfs usbfs udf"
export PRUNEFS
# paths which are pruned from updatedb database
PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /amd /alex /var/spool /sfs /media /var/backups/rsnapshot /var/mod_pagespeed/"
...
EDIT:
- The locate database is in
/var/cache/locate/locatedb
locate /
will list all files and directories in the database (I looked through the results by exporting it in a file:locate />/tmp/locatedb.txt
, download this txt-file and find large amount of useless stuff)
Use
PRUNENAMES
as stated inman updatedb.conf
The use of
PRUNENAMES=".git .hg .svn"
should do the trick (above line is the standard value on Fedora 18).
You are probably using the GNU findutils version of locate, which doesn't support the PRUNENAMES option. Installing mlocate will provide these configuration options:
Now with the mlocate packge you can edit or create /etc/updatedb.conf and add these lines:
Then actualize the database with:
You probably can remove the huge old locate database:
(The mlocate database is stored at
/var/lib/mlocate/mlocate.db
)Check out https://apps.ubuntu.com/cat/applications/mlocate/ for more information about the package.
(I spent a ridiculous amount of time trying to solve a similar issue!)
locate /
will list all files and directories in the database.Although the OP's problem ended up being version/PRUNENAMES, as an alternative/addition to trolling through locate db output, running updatedb manually with the --debug-pruning flag prints the individual pruning decisions to stderr, and is really useful for tracking down pruning problems
For eg stick it into a file (as root in this case):
Sample output:
etc
(Am using mlocate)