13

Having gone through the /etc/cron.daily directory I noticed that there is only the mlocate.cron file in comparison to what I have seen on other material where they cite slocate.cron. Is there a difference between these and their respective commands and if so what are they?

1 Answer 1

16

https://fedorahosted.org/mlocate/ explains that mlocate merges databases at each update, which offers a performance speedup since it can skip previously examined files.

They are competing implementations, but mlocate is designed to be backwards compatible with slocate and is slowly replacing it.

9
  • Thanks. When you say that mlocate merges databases at each update, what does this mean exactly? Jul 23, 2011 at 1:40
  • 4
    @Peanuts, looking at the link provided by Stephanie, it seems that mlocate (which makes a database of file locations) reuses a previous database each time it runs, so any new information is merged with the old information, to save time and give a performance speedup.
    – pavium
    Jul 23, 2011 at 2:26
  • @pavium - So would this mean that I would have multiple mlocate.cron files? Jul 23, 2011 at 4:44
  • 1
    @peanuts, no, the databases are merged:- the new data generated when the mlocate.cron runs is merged with the old data from the last time it ran. It doesn't mean we need multiple mlocate.cron files.
    – pavium
    Jul 23, 2011 at 4:56
  • 1
    To be exact, what mlocate does is compare every directory's mtime in the database with the same directory on the filesystem. For any changed directory, mlocate will walk it and any new subdirectory tree behind it, otherwise it just copies the database content for that directory onto the new DB (a temporary file that gets moved over at the end). This can significantly speed up the process on large filesystems; I've personally seen mlocate updates taking only a few hours vs. many days for a brand new database. Jan 28, 2016 at 1:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .