Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wb0gaz

macrumors newbie
Original poster
Jan 7, 2014
2
1
I use USB drives to move large (multi-gigabyte) raw data files to/from mavericks system. I wish to prevent spotlight from ever trying to index any external drive (that is, as a permanent policy for my system), as the indexing is not useful.

I looked at spotlight in system configuration but could not see how to specify "any external drive".

How can I proceed?
 
I use USB drives to move large (multi-gigabyte) raw data files to/from mavericks system. I wish to prevent spotlight from ever trying to index any external drive (that is, as a permanent policy for my system), as the indexing is not useful.

I looked at spotlight in system configuration but could not see how to specify "any external drive".

How can I proceed?

In the Privacy Pane of Spotlight in System Preference click the Add button or drag the disk into the empty box to prevent Spotlight from searching it
 
Thank you for the fast reply ---

I understand I can drag a given external drive into spotlight privacy dialog pane, however, I wish to set up a rule pre-emptively for *any* external drive, so I don't need to do this step each time (as there are many drives involved.)

Thank you again!
 
  • Like
Reactions: OS/4
As far as I know there is no easy way to do this.

Only thing I can think of is

1) monitor /Volumes using folder actions
2) when something connects add /Volumes/(name)/.Spotlight-V100/VolumeConfiguration.plist [only if it doesn't exist]
3) then using either a template VolumeConfiguration.plist or the command defaults write edit the file you just made to include this
Code:
<key>Exclusions</key>
<array>
	<string>/</string>
</array>

I think the command for defaults write is something like

Code:
defaults write /Volumes/(folder_name_here)/.Spotlight-V100/VolumeConfiguration.plist Exclusions -array-add '{"/"}'

All in all it's probably more hassle than it's worth unless we're talking hundreds of usb devices or you just want to learn some basic bash/applescript.
 
Last edited:

Hmm yeah .metadata_never_index sound easier assuming you just drop it in the root of the mounted drive.

Not really too sure about the workings of folder actions but if you can run a bash script and pass the items as arguments you could just have something like:

Code:
for f in $@; do
  if [[ ! -e "$f"/.metadata_never_index ]]; then
    touch "$f"/.metadata_never_index
  fi
done

You might also have to add in a check to make sure it's not your internal drive.
 
Just want to add that I found this post very helpful, especially https://discussions.apple.com/thread/5486948 - thanks!

I had an issue with one of my USB sticks being abysmally slow to copy files to - write speeds of less than 0.5MB/s - and just couldn't figure it out, because the same USB stick worked fine on Ubuntu or Windows.

It seems such a "gotcha" for Mac newbies - it took me quite a while to realise what was happening: Every time I was plugging in the stick, Spotlight tried to index it, and because I was too impatient, it never finished, which also explained why sometimes it just wouldn't want to eject and I ended up forcing it. ...really frustrating until I added the USB stick to the Spotlight > Privacy list of things to exclude from indexing - then it started to behave fine and the USB write data rate improved hugely and were/are comparable to using the USB stick on other platforms.

Like the OP, I think it would be nice if there was a setting to just _never_ index any USB sticks, but I'll settle for adding
.metadata_never_index to the root dir of each USB stick I use, which still seems more convenient than having to add it to the Spotlight preferences, or at least going there to check whether I've already added it or not.
 
Code:
defaults write /Volumes/(folder_name_here)/.Spotlight-V100/VolumeConfiguration.plist Exclusions -array-add '{"/"}'

I am wondering if anything like this might work to exclude from spotlight indexing all files with a given extension, say *.dat. Would you think the VolumeConfiguration.plist can work for this type of exclusion?

Or do you know of another better way to instruct spotlight to ignore certain file types?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.