GNOME: Indexing with Tracker
Posted on May 16, 2022 • 6 minutes • 1073 words • Other languages: Français
What is Tracker used for ?
Tracker is the file indexing tool for the GNOME desktop environment and therefore for Nautilus (GNOME’s file manager).
Tracker (in version 3) is particularly powerful, not greedy and extremely fast (especially on newer hardware).
Tracker does not just search for a file by name and/or location, it will search the content and metadata . Thus, you can find an mp3 file with the name of the artist, a PDF document with an expression in a paragraph or the author of the document… .
How it works
Tracker uses an index system and this is what allows it to be so instantaneous. It will read its index and search in the metadata and content for matches with your search. This index is updated automatically and in real time as soon as a file is added or modified in an indexed location. The search is therefore always accurate and up to date.
Warning, Tracker is not designed to index millions of small files like those in a large source code. It remains a tool made for a desktop environment and the files related to it. Here is an excerpt from the documentation about it 1 :
When you add or edit files, Tracker Miner FS will update its index. This should be very quick, but if a huge number of files are added then it may cause noticably high CPU and IO usage until the new files have been indexed. This is normal. Tracker is not designed to index directories of source code or video game data. If content like this appears in the locations it is configured to index then you might see unwanted high resource usage.
The case of TAGS in Nautilus
Tracker supports tags, but Nautilus developers have decided (since v3.26) not to support them as before and to use a unique tag: “favorites “. It is therefore through the Tracker tag system that you can bookmark files and folders in Nautilus. If you want to use custom tags, you will have to turn to another file manager or Nautilus hacks.
Tracker via the graphical interface
Through the GUI you will only have access to one setting (the most important one), that of the directories to be included in the Tracker index. To do this, go to the GNOME settings, into the Search category and then at the top you will find Search Location.
The tabs are just predefined locations that you can index or not:
- tab Locations : groups the default locations of the system
- tab Bookmarks : groups the locations you have bookmarked on Nautilus
- tab Other : groups the free locations to index
Finally, it is not very useful but you should know that the locations are also accessible by the variable manager dconf-editor
:
Tracker in command line
With your terminal you will have many more options. I put here some useful commands to make your life easier!
tracker3 daemon -w
: allows to see in real time the changes in the database.tracker3 daemon -t
- kills all running (miner) processes.tracker3 daemon --list-common-statuses
: lists the possible statuses for a tracker miner.tracker3 reset --filesystem
: resets the index. Warning, CPU activity for reconstruction.gsettings list-recursively |grep -i tracker
: list of settings.tracker3 info /home/r4ven/Documents/test.pdf
: list all indexed information on the test.pdf file.tracker3 status /home/r4ven/Documents/test.pdf
: displays the indexing error message for the test.pdf file (if error).tracker3 status
: displays the general state of the index (number of indexed files…) and the list of indexing errors.journalctl --user --unit=tracker-miner-fs-3.service --unit=tracker-extract-3.service --priority=7
: displays tracker errors in the systemd log.
If you want to reset the index, it will automatically rebuild itself after a few seconds. You can then follow the activity with tracker3 daemon -w
:
In my case, my index is composed of 18 740 files and 1844 folders whose indexing (we are talking about content + metadata) takes about 2 minutes (i7-1185@3.0GHz + 16GB RAM + SSD NVMe) without any slowdown on the rest of the system.
Indeed, written in C, tracker3 is very powerful and well thought, tracker3 processes run with a very low priority : nice+19. The RAM usage did not exceed 15MB (out of 16GB) during the reindexing of the 18,000 files and is around 1 to 2MB on a normal activity (excluding the complete reindexing of the system).
Performance issue
You should not have any performance problems with Tracker version 3, however if you do, please consider :
- check the errors:
tracker3 status
- check that there are no large source code directories in a folder to be indexed.
- check the S.M.A.R.T status of your hard disk/SSD. A bad disk with read/write errors will slow down indexing or create errors.
- reset your index:
tracker3 reset --filesystem
. - check the processes.
To help you check processes, tracker3 has several processes, which makes it resilient and prevents the daemon from crashing if a process crashes.
Main processes of tracker3 :
tracker-store
: It takes care of the data management, it is the database management daemon.tracker-miner-fs
: This is the file system crawler that will extract data from files.tracker-extract
: This is the file system crawler that extracts the metadata from each file.tracker-writeback
: Allows to write metadata from the database to a file (specific case).
Security and data
As you can see from my article, tracker3 contains critical and confidential information since it reads and indexes not only the metadata but also the contents of your documents and files. That’s why it is recommended to encrypt the entire content of your PC and not just a directory. Think that it is also possible to index a directory that is available on the network… . Once again, the encryption of your personal or professional PCs is always essential.
- The tracker3 database storage is here:
$HOME/.cache/tracker3
- The log is here:
$HOME/.local/share/tracker/data
If some data is really too critical, think about just taking it out of the indexed directory and reinitalising your index 👍
Disable Tracker
It is always possible to remove tracker3, but this is strongly discouraged by the GNOME documentation because tracker3 is a central dependency in GNOME so you will certainly have side effects.
Instead, you should de-index directories or even disable searching in Files in the GNOME settings in the Search section.