Can I do something about it? I'm running out of disk space.


On one of my systems that acts as a backup server, mlocate.db hit 9GB. The solution was to exclude the backup directories from locate, since I had no need to search them.

I did this by adding the backup directory to PRUNEPATHS in /etc/updatedb.conf.

Running sudo updatedb then reduced it to 1.6MB (and saves a huge amount of time indexing all of those files).

  • Perfect, thank you. Just went from 800MB to 100MB, but more importantly, the updatedb command can complete very quickly now, whereas before it was taking days. (Note, however, that it only runs when the computer is not on battery, and it uses low priority IO, according to the script at /etc/cron.daily/mlocate.)
    – mlissner
    Apr 19 '18 at 18:06
  • Wow 9 GB down to 1.6 MB! May 23 '18 at 2:17

If you have lots and lots of files on your machine, you may want to consider pruning some paths from the database. You can do this in /etc/updatedb.conf under PRUNEPATHS. You can also prune file systems (like nfs, if you so desire).


800MB sounds pretty much. My /var/lib/mlocate/mlocate.db is about 8MB only (fresh install on 10.04 release date). You can safely delete it, if you run sudo updatedb, it'll be recreated.

  • thanks, that worked. After running sudo updatedb it is now 620MB. edit: oops I read that wrong. 620MB would mean it didn't work (I thought I read KB on my file output).
    – evencoil
    Jan 28 '11 at 15:17
  • How many files do you have? What is your disk size?
    – Lekensteyn
    Jan 28 '11 at 20:57
  • 1
    Is it really that big? Size in MB: 'du -m /var/lib/mlocate/mlocate.db'
    – user8290
    Jan 28 '11 at 21:12
  • Also both du and ls have an -h flag ` : -h, --human-readable` print sizes in human readable format (e.g., 1K 234M 2G)
    – belacqua
    Jan 28 '11 at 22:02
  • It is really that big...I do have a lot of very small files (related to some data work) across several hard drives, so maybe that is why. edit: I also keep many backups...Is there a way to exclude directories from the indexer? Probably indexing these backups is the big problem.
    – evencoil
    Jan 30 '11 at 12:28

Its a database of all files in your root directory. It is used by locate utility. if you delete this file locate will no longer work.

  • is it really supposed to be that large?
    – evencoil
    Jan 28 '11 at 14:04
  • It should not be that big. Most probably you have lots of files in your home directory. You can erase it and then let the update run again.
    – user4124
    Jan 28 '11 at 14:43
  • if I erase it will it be recreated automatically at some point?
    – evencoil
    Jan 28 '11 at 15:20
  • it will be recreated when you run "updatedb" command
    – binW
    Jan 28 '11 at 16:45
  • it seems to also be recreated as a daily task?
    – evencoil
    Jan 30 '11 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.