Disable OS X Spotlight indexing for removable medias

The indexing function in OS X called Spotlight does a great job finding things on your workstation. But sometime, you may like to exclude removable medias, such as USB memory sticks from the indexing process.

One way to exclude any media or directory is by adding it to the spotlight privacy tab in the control panel in OS X.

But there is another way for Spotlight to ignore any disk media. Simply create a file „.metadata_never_index“ in the root directory of the disk, e.g.

touch /Volumes/USB-16GB/.metadata_never_index

This console command will create a zero-length file on the disk „USB-16GB“. If you don’t know the name of you disk, just do a „ls -l /Volumes“ to show all mounted drives.