mlocate DB Size Problem

I have just had to resolve an issue with the mlocate search tool on a backup server.
The machine is a small (10GB) VM with an iSCSI volume presented to it for data that is backed up. It turns out the mlocate DB had grown to an excessive size (>1GB!) because it had been including this file system in it’s nightly DB refresh.
This meant that the /var file system ended up running out of space, which was causing all kinds of problems:

  • The nightly mlocate DB refresh task could not complete.
  • Emails could not be sent as the spool directory for sendmail could not be written to.
  • Log files could not be written to.
  • Performing a system update with yum was not possible.

My solution was to:

  1. Remove all files from the /var/lib/mlocate directory.
  2. Open the mlocate configuration file, /etc/updatedb.conf and edit the PRUNEPATHS directive; adding the backup file system, /srv to the list of paths that are excluded from being indexed.