This short blog post will show you how to enable spotlight indexing on a network drive. I have also added the commands to disable spotlight indexing on network drive that’s already indexed.

The first thing you have to do is to make sure you connect your network drive to the network.

I think afp:// is required for indexing to actually work. I’m not 100% certain on that information though. When I try enabling indexing with cifs:// spotlight doesn’t seem to be able to index the drive, even though mdutil states that indexing is enabled. If you have trouble with the index building or not being available, it would be worth trying to enable afp:// mode on your network drive.

To enable spotlight indexing on a network drive type the following command:

mdutil /Volumes/name -i on

To disable the indexing of a connected network drive type the following command:

mdutil /Volumes/name -i off

To check the status of indexing on a connected network drive type the following command:

mdutil /Volumes/name -s
enable spotlight indexing on a network drive

There is also an apple Kb article on how to make spotlight re-index a drive that’s already indexed using the GUI.

To re-index a mounted drive:

  • goto preferences > spotlight > privacy
  • drag a folder or drive into the ‘ignore’ list
  • remove the item you just added.

With the above commands you will be able to search your network drive as you search your computer using spotlight (although you do have to wait for the indexing to finish, which can take a good while the first time – It took 3 hours for mine to finish indexing)

You might like: how to force spotlight to reindex your drive


20 Comments

Angel Perez · April 21, 2012 at 3:47 am

Hey, thanks for the tip, I actually tried it and the status is enabled for indexing, but I’m still not able to find any content from the network drives. Any suggestion?

    zimpower · October 20, 2015 at 8:41 am

    Me too :
    $ mdutil /Volumes/photo -s -v returns:
    /Volumes/photo:
    Indexing enabled.
    Scan base time: 2015-10-20 05:21:57 +0000 (8295 seconds ago), reasoning: ‘(null)’
    But I don’t see files in spotlight when I search. Anyway I can check on indexing progress?

      Armin Groll · February 23, 2016 at 9:23 pm

      Hi, I had the same problem – server was doing spotlight indexing and the client told indexing was on with mdutil /Volumes/myvolume -s

      I think the problem is that MacOs on the server side stores the spotlight index files in the root of the volume – like /Volume/theharddrive/.Spotlight
      If the NAS share does not share the volume root, spotlight will not find the index and hence give no results.

      So: If you want for spotlight to work on the NAS client side of a MacOS NAS Server, the NAS share must share the complete volume, not just a sub folder of it.

        Ascegan · October 2, 2016 at 1:44 pm

        How do you get the NAS share to share the complete volume?

nick · August 13, 2012 at 1:27 pm

Excellent tip! I have been looking for an indexing solution for months now.

Todd · November 5, 2012 at 3:41 pm

I have been looking for a solution for this for a long time. I am not a term app person. I tried it several times and the error I get is that I don’t have the remote volume name correct or maybe the correct path. I am using an external usb drive mounted to an airport extreme. If I mount the volume at get info, I get “afp://Catamaran Marketing Terry II._afpovertcp._tcp.local/Catamaran%20Terry%20II” When I try to use the command line above, I get ”
Catamaran-20:Volumes toddsmith$ mdutil /Volumes/Catamaran Marketing Terry II._afpovertcp._tcp.local/Catamaran%20Terry%20II -i on

Error: invalid path `Marketing’.

Error: invalid path `Terry’.

Error: invalid path `II._afpovertcp._tcp.local/Catamaran%20Terry%20II’

Any Help?

    Mikesch-theCat Findout · November 22, 2012 at 2:50 pm

    Hi Todd,

    please test this: mdutil “/Volumes/Catamaran Marketing Terry II._afpovertcp._tcp.local/Catamaran%20Terry%20II” -i on

    regards
    Stefan

    Matthew Podowski · December 4, 2012 at 9:06 pm

    type mdutil (dont forget a space after) then drag the drive icon from Finder to Terminal. It will put the correct path for you.

MacHouis · July 5, 2013 at 6:19 pm

Thanks a lot, it works very fine :):):). I had to mount the volume (a Synology Ethernet server) in afp to start the Spotlight Indexing… thanks thanks thanks…

Kelloggs · January 7, 2015 at 6:19 pm

Tried with smb on a Synology DS415+, it started the Spotlight Indexing. Great. Thanks.

    Reb Guthrie · January 28, 2016 at 6:54 pm

    I am interested in an update from Kelloggs on his success w/ Spotlight indexing on his Synology NAS. Does it actually / still work? I have tried the mdutil command on a couple of NAS’s (including a Synology) with no luck. It would start to index (mdworker showed up in Activity Monitor etc.) and the status would be Enabled, but searching for items on the NAS via Spotlight – both file name and file content that I know was valid – would have no result. Basically like Angel reported at bottom of this Comments section).

    NAS w/ no Spotlight is a non-starter for me, so I’d love to get this resolved.

MacGeekPaul · October 26, 2015 at 8:17 pm

Hi, just wanted to add, that this works like a charm for me with my Synology.
I use NFS as my preferred connection, and although as you mentioned that it shows as indexing it doesn’t actually do it, however if you enable AFP on the NAS side it will index fine, you don’t need to mount it Mac side, just enable it NAS side.

    Reb Guthrie · January 28, 2016 at 6:54 pm

    I am interested in an update from MacGeekPaul on his success w/ Spotlight indexing on his Synology NAS. Does it actually / still work? I have tried the mdutil command on a couple of NAS’s (including a Synology) with no luck. It would start to index (mdworker showed up in Activity Monitor etc.) and the status would be Enabled, but searching for items on the NAS via Spotlight – both file name and file content that I know was valid – would have no result. Basically like Angel reported at bottom of this Comments section).

    What Synology model do you have?

    NAS w/ no Spotlight is a non-starter for me, so I’d love to get this resolved.

Webturd · October 29, 2015 at 3:23 pm

This method still works! I couldn’t ever figure out the correct way to enter the drive location. I typed “mdutil” and then DRAGGED and DROPPED the folder into the terminal app to give me the exact drive path followed by the “-i on” statement. Spotlight is indexing right now! Thanks so much. :)

jakeblackgoat · April 2, 2016 at 1:13 am

it took me some time to figure out the name for my drive, but the suggestion regarding dropping the drive into terminal was a winner. i took that string, and cut and pasted the command into a note or a text file, and then added the path name for the external drive and voila, my external NAS began to index. it took me a long time just to find this dang article. and its the one that helped, in addition to the previous comments that recommended finding the external drive name, that was brilliant. all brilliant, thank you all.

Marthi Krähem · April 6, 2016 at 10:31 am

Hi Jonathan, thanks so much for sharing this! Unfortunately indexing doesn’t seem to work when using autofs (see http://blog.grapii.com/2015/06/keep-network-drives-mounted-on-mac-os-x-using-autofs/). Whenever I try switching indexing on, I get an error message. The network drives are mounted w/ AFP. Do you have any idea if I can index the mounted drives?

marthiMBP04:~ marthi$ sudo mdutil /Volumes/Macintosh HD/Users/marthi/family/home/ -i on
/Users/marthi/family/home:
Error: unable to perform operation. (-400)
Error: unknown indexing state.

Best wishes,

Marthi

Alsbabe · April 11, 2016 at 4:44 am

Perfect. This worked great. Does anyone know whether this enables spotlight to automatically index after each update or periodically, or do you have to do it every time you make significant updates? I’m using this mainly for the tagging function, as I have a NAS with all my graphic resources on it, and I’m trying to enable the tagging functionality so I can successfully search for files with same tags, ie. backgrounds, illustrations etc. Thanks Jonathon for this excellent snippet of info, which made my life that much easier.

Espen Thilesen · August 17, 2018 at 2:16 pm

It seems to work for me to search my mounted cloud from upper right finder corner. Not with main spotlight.

SK Kim · October 5, 2018 at 3:01 pm

Hello
I’ve tried mdutil /Volumes/MusicLibrary -i on
But it says indexing disabled.
MusicLibrary is a folder name in NAS.
Could you check if it’s right? Thanks a lot!