Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Adjust locate to include mounted HFS+ volumes UNIX
I noticed that locate doesn't include mounted HFS+ volumes (those visible under /Volumes). Here's how to adjust that situation:
  1. Save the current shell script that updates the locate database:
     % sudo cp -p /usr/libexec/locate.updatedb \
    /usr/libexec/locate.updatedb.orig
  2. Update the shell script to include the mounted HFS+ volumes (use the name of your favorite editor in place of "edit", mine is bbedit):
     % sudo edit /usr/libexec/locate.updatedb
  3. Locate the find command (about 2/3 down towards the end of the file) and change -fstype devfs to -fstype devfs -o -fstype hfs (i.e., add the hfs filesystem type to the find command).

  4. Save the updated /usr/libexec/locate.updatedb

  5. Update the locate database (manually):
     % sudo /usr/libexec/locate.updatedb
The locate command (see: man locate) will now include the files from your locally mounted HFS+ volumes. If you want to revert back to the original locate DB update strategy, just type:
 % sudo cp -p /usr/libexec/locate.updatedb.orig \
/usr/libexec/locate.updatedb
Hope this helps.

[Editor's note: I broke the copy commands onto two lines using the backslash, so they should work if copied and pasted (they did when I tested), but if they don't, enter them as one line...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[3,245 views]  

Adjust locate to include mounted HFS+ volumes | 0 comments | Create New Account
Click here to return to the 'Adjust locate to include mounted HFS+ volumes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.