force Spotlight to index network shares

Today I found a very interesting article on MacOSX hints. It’s about Spotlight and how to force it to index network shares.
By default Spotlight ignores NFS/SMB/AFS shares. Of course there are some problems about the whole metadata idea behind spotlight when it comes to network shares.

It’s the idea behind a network shared volume that makes it hard to be indexed by spotlight. First of all more than one user at a time has access to this volume. So at any time there can be changes made to documents on that volume. Secondly the system Spotlight is running is not informed that a document changed…
One feature of Spotlight is, that you do not have to reindex a drive. It just indexes every document when it’s created or changed on the drive. And this is impossible on network volumes. Because there’s no possibility to stay in touch with the documents like it’s on physically attached exclusive used drives (through the file system for example).

So you have to reindex manually from time to time to use Spotlight on network volumes. So here’s what to do to force Spotlight to index network volumes:

Open a Terminal and enter:

sudo mdutil /Volumes/… -i on

Great hint! Unfortunatly you have to reenable the indexing everytime you mount the drive…that’s once a week for me… so not a big problem but not perfect anyway.

UPDATE: Unfortunately Spotlight just seems to index the network volume but it does not search through this index ;-( Thats disappointing!

Source: MacOSX hints

3 thoughts on “force Spotlight to index network shares

  1. The only way to do network mounts gracefully is if the server does the indexing and makes it available to all clients. The server only builds the index once and then the server updates the index with each write whether local or remote. Clilents get read access to the index, but no write access. You don’t have to worry about locking or anything.

    I suspect Tiger Servers do this automatically, but I don’t know. My NFS servers are linux based.

  2. Sure you can search with spotlight using the index: just open a finder window, select the drive you want to search and then enter your search frase. It is using the index then.

Comments are closed.