John ChaseBlog

How To Exclude Paths from updatedb on Linux

Published March 15, 2026.

About once per day, the hard drives on my Fedora Workstation and Linux Mint machines would suddenly start thrashing for several minutes, then go silent again.

System Monitor showed updatedb to be the culprit. This process automatically runs at regular intervals to update your "plocate database": an index of filenames used by the plocate command to quickly find files on a computer.

This is all well and good, but what if you want to exclude paths from the search index?

I wouldn't over-think it, but there may be obvious locations containing large quantities of files that you want to leave out.

For example: let's say I have a hard drive mounted at /mnt/HDD to store my Timeshift snapshots. This is a mechanical disk that is referencing thousands of new files in every snapshot. Aside from the slow speed of indexing, these files exist only for backup & recovery purposes, and should not be clogging the database -- or my search results!

ℹ️ By default, the database is located at /var/lib/plocate/plocate.db. One of mine was ~250 MB! As a starting point, you may wish to check the size of yours. We will return to this later.

Configuration File

Various articles recommend editing the default configuration file at /etc/updatedb.conf.

We will not be doing that. I generally regard editing system-created configuration files as a "quick and dirty" last resort: it may be fast, but it is also highly prone to accidentally messing up your system -- or suddenly breaking in the future if a system update changes that configuration file!

However, we will inspect its contents in the terminal before proceeding, with:

cat /etc/updatedb.conf

The PRUNEPATHS line in the output shows the list of paths already being excluded -- or "pruned", to use the lingo being implemented here.

This can be useful information. For example: I see on my systems that /media (which is officially designated for "mount points for removable media") is a default exclusion. Thus, I know that any external USB drives being mounted there are already irrelevant to the index.

Systemd Override

What we want to do is create a systemd override that will add an additional "prune path" to updatedb each time it runs. Overrides exist in their own separate files, which contain only the settings that you wish to modify. Thus, nothing should break if the main configuration file gets changed in the future.

Running man updatedb shows us the following useful command-line options:

-e, --add-prunepaths PATHS
       Add entries in white-space-separated list PATHS to PRUNEPATHS.

--add-single-prunepath PATH
       Add  PATH  to  PRUNEPATHS.  Note that this is currently the only way to add a
       path with a space in it.

Our override will add one of these options to the updatedb command each time it is run. In this particular example, either will work because we are just adding a single path (/mnt/HDD). I will use --add-prunepaths, because my path does not contain spaces, and I may wish to add more in the future.

To create the override, run:

sudo systemctl edit plocate-updatedb.service

Then, enter the following lines into the designated white-space area, replacing /mnt/HDD with whatever path(s) you want excluded:

[Service]
ExecStart=
ExecStart=/usr/bin/updatedb --add-prunepaths="/mnt/HDD"

⚠️ While editing, note that:

  1. The first "ExecStart=" line is not an error. It is required to "blank out" the original command before replacing it with another one.

  2. The second ExecStart line in our example here is running /usr/bin/updatedb, but you may see that the original line in your file points to a different executable (such as /usr/sbin/updatedb.plocate on Linux Mint). If so, you can either change the line to match what is used on your system, or simply verify that your distribution has symlinked /usr/bin/updatedb to it.

Once you have finished entering your overrides, save and exit.

If you did everything correctly, you should see a confirmation message similar to the following in your terminal:

Successfully installed edited file '/etc/systemd/system/plocate-updatedb.service.d/override.conf'.

For extra confirmation, you can check the contents of the file:

cat /etc/systemd/system/plocate-updatedb.service.d/override.conf

It should contain only the 3 new lines that you entered, with all other options continuing to be pulled from the main systemd unit file.

Testing Our Changes

The new settings should be picked up when updatedb runs at some point in the future, but it's best to force a refresh now, and ensure they work as intended.

  1. Re-load the systemd manager configuration:

    sudo systemctl daemon-reload
  2. Re-start the service:

    sudo systemctl restart plocate-updatedb.service

    On my systems, this automatically triggers a re-indexing.

  3. After re-indexing is complete, use locate [FILENAME] (or plocate [FILENAME]) to try to locate a file that you know should be excluded.

Obviously the filename being searched for in the final step should not be found -- in which case our pruning of the path was successful!

Measuring Results

If you excluded any paths of consequence, there should be a significant change in the file size of /var/lib/plocate/plocate.db.

Excluding drives from being indexed (particularly slow mechanical ones) has much more to do with reducing annoyance and increasing search efficiency than it does with saving disk space, but the relative "before and after" file sizes will show how much leaner we have made the database.

Just by excluding secondary internal HDDs storing Timeshift snapshots, I had one database file drop from ~250 MB to ~30 MB, and another drop from ~140 MB to ~20 MB!

Other Applications

Of course, the instructions above can be used to exclude any path, not just entire disks -- so if our HDD had more than just Timeshift snapshots on it, we could choose to exclude only that directory (/mnt/HDD/timeshift), and retain the rest.

In another scenario where a user has his Timeshift snapshots on the same disk as his operating system (not an uncommon configuration), he could still benefit from a reduction of index size, and more relevant search results.

This post focuses on Timeshift simply because it is a widely-deployed piece of Linux software that can create millions of extra files, but any large backup repository containing data that doesn't need to be referenced in day-to-day work is a good candidate for exclusion: those created by Deja Dup Backups and restic immediately come to mind.

Additionally, if you use software such as Cryptomator or gocryptfs to keep large quantities of files in encrypted folders with filename encryption turned on, having them indexed is completely useless, as only the ciphertext names are in the database.


You are welcome to e-mail me with constructive comments about this post or page. Please note that while I endeavour to read all messages, sending a reply will be the exception, not the rule.

Copyright © 2026 John Chase. All Rights Reserved.
Legal Copyrights & Disclaimers
National Flag of CanadaRoyal Union Flag