Preventing Spotlight from indexing an NTFS partition

Discussion in 'Windows, Linux & Others on the Mac' started by mrichmon, Jul 13, 2006.

  1. mrichmon macrumors 6502a

    Jun 17, 2003
    I've recently installed Windows on an external USB drive (after modifying the Windows install CD). This works great, except that everytime I connected the external drive to OS X Spotlight would traverse the entire NTFS partition to index it. The traversal would take about 10 minutes during which I could not unmount the drive.

    I needed to find a way to prevent Spotlight from indexing this drive since I don't need to search into my Windows installation.

    At first I tried preventing the NTFS partition from mounting at all. This made sense since the external drive also has a small FAT32 partition for sharing data between Windows and OS X. Using an entry in the /etc/fstab I was able to prevent the NTFS partition from mounting without any difficulty. The drawback with this approach was that the Startup Disk preference panel would not see the Windows installation since the partition wasn't being mounted.

    The Startup Disk preference panel drawback is significant because with Windows installed onto an external drive the only way I have found to boot into Windows is to set the Startup Disk using the preference panel. (And to set the Startup Disk back to OS X using the Startup Disk control panel.) The key combination on boot to boot from an external drive does not trigger a boot into windows as far as I can tell.

    After reversing the fstab entry I found a second approach that prevents Spotlight from indexing the NTFS drive while still mounting the partition thus allowing the Startup Disk preference panel to see the partition.

    The solution is to create a .Spotlight-V100 file on the NTFS partition so that Spotlight thinks it has already indexed the partition but cannot write to the index (since OS X cannot write to an NTFS filesystem). The result is that Spotlight aborts the index creation. The tricky part is that OS X cannot write to NTFS partitions and Windows refuses to let you create a file or directory if the name starts with a '.' character.

    Instead, you can create an empty file in OS X with the correct name then zip up the file and transfer it to a Windows machine (or reboot into Windows) and then unzip the archive into the root of the NTFS partition.

    You can use TextEdit to create an empty file in OS X and then archive the file using the finder, or you can open the Terminal and use the following commands to create the zip file:

    cd ~/Desktop
    touch .Spotlight-V100
    zip .Spotlight-V100
    rm .Spotlight-V100
    Copy the zip file to somewhere that you can access from Windows. Boot into Windows and unzip the zip file into the top level of your NTFS partition. Next time you boot into OS X Spotlight will not index the NTFS partition.
  2. dollarsai macrumors member


    Jul 11, 2006
    Nice find, Tx. I was expecting something like this.
    I would search for "applications" in spotlight and it would show me application data from the Windows partition. Gee!!!
  3. weldon macrumors 6502a


    May 22, 2004
    Denver, CO
    You didn't mention it so I have to ask...

    Did adding the NTFS volume to the privacy list not work? I would think that would be the easiest and most reliable solution if it works with external volumes.
  4. mrichmon thread starter macrumors 6502a

    Jun 17, 2003
    Adding the NTFS volume to the privacy list does not work since you cannot add the Volume to the privacy list. Using mdutil to turn indexing off for the NTFS volume also does not work.

    Using mdutil to turn off indexing results in a change being written to the .Spotlight-V100 index data folder on the volume for which you are disabling indexing. I suspect that altering the privacy list also ends up writing a change to the .Spotlight-V100 index folder on the volume being modified. Since OS X cannot write to NTFS then these changes cannot be recorded on the volume.
  5. CDN macrumors newbie

    Jul 27, 2006
    I've recently encountered the Spotlight indexing problem and attempted the solution provided by mrichmon.

    Here are the exact steps I took:

    1) Copied the code provided by mrichmon into the Terminal, which produced a .zip file on the desktop.
    2) Copied the .zip file to a flash drive
    3) Booted into Windows, and unzipped the .Spotlight-V100 file into the C:/ drive (alongside the Windows folder, etc.)
    4) Rebooted into Mac OS X, and tried a spotlight search for Thunderbird (which is on my Windows partition, but not my OS X partition)

    This search returned the files that are listed on my Windows partition . . . what did I do incorrectly?

  6. MARIKAVSx macrumors newbie

    Aug 6, 2006
    XP spotlight fix

    When the first pass (using mrichmon 's suggestion) didn't work I cleared the spotlight index thinking there would be old stuff left in there. (You have to drag the whole HD, not just any folder like they tell you, into Privacy and then remove it.) When that didn't work either I moved the dot-file itself from the spotlight folder onto the root of Windows (C:\) - Windows didn't object - and figured I had it made. I then re-cleared the spotlight index. On the first search I did I still got the Windows entries, but the second time around (same search word) it worked! So who knows, maybe it would have been sufficient to just run the search twice the first time... Try it, maybe it'll save you some time.
    Take care,

Share This Page