Issue with LOCATE Command

I have multiple USB Drives attached to my desktop. Locate doesn’t seem to find files on these attached drives. Is there a way to for updatedb to include the attached drives.

Do you have the drives mounted?
In order for any software to see files on a drive, it has to be mounted.

I dont know what locate and updateb are? They are not present in my Debian. Which distro are you using?



Hi, :slightly_smiling_face:

I think you´d need to employ the find-command for including attached usb drives.
locate seems to exclude certain paths:

locate is a program that can be used to search for files on the command line.
Here, however, not the entire data directory is searched (as with find), but a database that was previously created.
This is updated regularly so that locate always shows the correct locations where the files are located and thus new files and data movements are recorded.

The advantage of this method is that searching the database is very fast and the search results are available almost immediately.
However, one must note that the directories (and their subdirectories) /tmp, /var/spool and /media are not indexed by default, since the contents of these directories are constantly changing.

(translated from locate › Wiki › ).

Looking at my system an attached thumb drive is located like this:


… so basically under /media, which is excluded from the indexing process.

To cater for such scenarios I´ve once written a simple script making use of the find-command with the help of which I can quickly find anything I want on the thumb drives.

If you´re interested I may post it any time. :wink:

Many greetings from Rosika. :slightly_smiling_face:


Thanks for your suggestion. I have found my solution by viewing “updatedb.conf” and then modifying it. Now it works as I want it to since I have permanently attached USB hard drives.

PRUNE_BIND_MOUNTS=“no” I changed the original from “yes” to “no”
PRUNEPATHS="/tmp /var/spool /var/lib/os-prober /var/lib/ceph" Removed “/media” from prunepaths.
PRUNEFS="NFS afs autofs binfmt_misc ceph cgroup cgroup2 cifs coda configfs curlftpfs debugfs devfs >

1 Like

My drives are permanently mounted, they get mounted at boot thanks to being included in fstab. ubdatedb is a root command to force an update to the database that is used by the locate command. I am quite surprised that debian doesn’t include the database and the locate command.

After righting the above I did a quick google search, it seems to me that these commands do exist in Debian: updatedb(1) — locate — Debian stretch — Debian Manpages

I modified updatedb.conf, removed the restriction on prune bind mounts and deleted the exception to the media directory. Now everything works perfectly for me.


Hi, :wave:

thanks for your detailed description of how you solved the problem.
That´s very interesting indeed.
I didn´t know the settings for locate could be modified. I didn´t bother investigating as I reverted to the find command for the attached usb-sticks.

Well, I´ve learnt something new again. :wink:

Thanks again and many greetings.
Rosika :slightly_smiling_face:

1 Like

Glad you found it helpful.
If you don’t mind me asking where are you from, I’m in Tampa Florida USA

1 Like

Hi again, :wave:

well, sure. No problem. :wink:
I´m in Southern Germany; to be more exact in the land of Baden-Württemberg.
I only wish the weather could be a more stable (sunnier and drier). :smile:
Fortunately that´s something of less importance within the realms of the Internet.

Many greetings from Rosika :slightly_smiling_face:

1 Like

My wife and I had a planned Viking River tour from Amsterdam to Budapest but thanks to Covid we have postponed it into 2023. Hopefully by then we can take the trip without worry of covid and any more Russian hostilities. We are in our 70’s and don’t need that type of excitement in our remaining years :wink:


Hi, :wave:

That´s great. Budapest is a beautiful city (although all the others on your tour certainly are as well :smiley:).
I visited Budapest a few times in the past, therefore my “knowledge”.

All the best to you and your wife.
Many greetings from Rosika :slightly_smiling_face:

1 Like