Disabling Spotlight on External Drives
Monday, May 28th, 2007I’ve become a huge fan of Google Desktop for Mac for desktop search. The search results are much better ordered, and presented with enough context to be extremely useful. It really is what I expected from Spotlight when it was first announced.
An especially nice aspect of Google Desktop is its integration with Spotlight preferences. Rather than make you specify which directories to ignore in their own GUI, they just use whatever you have set for Spotlight privacy settings. Similarly, Google uses the Spotlight import plugins (via calls to mdimport) rather than reinvent the wheel.
One problem with the Spotlight privacy settings panel is that if you add an external disk, and then later disconnect it, it forgets your settings the next time you reconnect. This is a big annoyance with my external Firewire backup disk which I deliberately keep disconnected from my computer, except when backing up. If I start a backup task and then go to sleep, when I get up in the morning, I find that Spotlight (and Google Desktop) have indexed both my main disk and the backup. Search results get cluttered up with duplicates that I don’t want to see.
Forcing a disk to be permanently unindexed seems to require either a shell prompt, or a $9.95 shareware tool (which probably just runs the command for you). The magic command line utility is mdutil and the two commands are:
sudo mdutil -i off /Volumes/ExternalRover/
sudo mdutil -E /Volumes/ExternalRover/
The first command disables indexing on my external drive (called “ExternalRover”), and the second command deletes the Spotlight index associated with the disk. Note that you can use the second command (-E) on / to force your Spotlight index to be regenerated if Spotlight seems to be acting strangely. Unfortunately, forcing Google Desktop to reindex seems to require uninstalling and reinstalling it.
(Tip thanks to this discussion over at macosxhints.com)
