MacOS mdfind/mdutil issue and updatedb command : how to index all the files on my /Volume (root /)

A simple question : on Linux, updatedb command which is launched a second time seems not to reindex all the hard disk.

On MacOS Catalina (or maybe for previous), it seems that the command sudo /usr/libexec/locate.updatedb reindexes all.

Is there an option for locate.updatedb to only update what's new ?

I thought about doing : sudo /usr/libexec/locate.updatedb -u but I am not sure.

mdfind is a great tool but has got no transparency about its dameons mds : I said this since suddenly on my MacOS, mdfind stopped finding recent files, and it was very frustrating. Moreover, it takes a long time to index all the Volume (several days in my case, 2TB HD).

So I wonder if locate.updatedb command that updates from what is already existing is possible ?

On Linux systems, where updatedb is performed, this command is very quick because the whole database is no reindexed.

I just want not to reindex all the /Volume at each time I launch locate.updatedb on MaOS.

UPDATE 1:

I have killed all mds and processes relaled to mdutil and mdfind. Then, I launched yesteray a :

mdutil -E / :

here what I get when I do a ps aux | grep mds :

$ psu | grep mds root 9607 0.0 0.9 11835260 285804 ?? Ss 9:20PM 2:14.29 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mds_stores root 9606 0.0 0.2 6866808 71984 ?? Ss 9:20PM 5:27.05 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds .

I don't understand why it doesn't return all files which normally should be found : example with mdfind -name README, it only return a partial of the expected result (nothing is displayed into my $HOME).

Moreover, the loop glass on right top indicates that indexing is fully carried out but from my opinion, this is too fast, I have 1.2TB of data of index : is it normal, what do you think about this ?

Any suggestion/explanation is welcome.


Solution 1:

The updatedb program on macOS is a very different program than the updatedb program on Linux. In contrast to the Linux program, the macOS program does not attempt to reuse existing database data about directories that haven't changed.

There's no option for the macOS program that will make it behave like the Linux program.