19

I have a 2TB external drive I use for Time Machine. At random intervals, it will decide to spin up and my entire UI freezes until it's finished. This is incredibly annoying.

It appears that this is due to Spotlight indexing. They suggest adding the Backup drive to Spotlight's blacklist, so I did:

fffffffuuuuuuuuu

Am I stuck having to live with constant beach ball attacks?

Update: I've already tried mdutil. It doesn't work.

$ sudo mdutil -E -i off /Volumes/Backup/Backups.backupdb/
Password:
/Volumes/Backup/Backups.backupdb:
    Indexing enabled.

If it's impossible to disable indexing, I would settle for making the backup drive never spin down.

5
  • "Your entire UI freezes" doesn't sound right. It's true that anything that accesses the drive will have to wait for it to spin up, but the Spotlight indexer is a background process which the UI shouldn't be waiting for. Is it possible that there is something other than Spotlight which is using the drive?
    – Kevin Reid
    Commented Dec 3, 2011 at 17:52
  • @Kevin I agree, it makes no sense. But it isn't limited to any particular app, and frequently occurs when doing something that has nothing to do with the backup drive whatsoever. The drive simply decides at random intervals that it needs to spin up, and whatever I am doing freezes until it completes. Commented Dec 6, 2011 at 1:41
  • Did you (or anyone else) ever find a solution to this problem?
    – Hemm
    Commented Oct 16, 2014 at 19:02
  • @Hemm no, I had to resort to ejecting the drive when I wasn't backing up to keep it from freezing my UI. Pretty lame. Commented Oct 19, 2014 at 3:25
  • see also superuser.com/questions/325005/… (but it looks like that it is just not possible to disable indexing on Backups.backupdb ?!) Commented Sep 24, 2017 at 15:32

6 Answers 6

6

Create an empty file on the root of that drive, named .metadata_never_index. This Mac OS X Hints article says more.

4
  • 2
    Did you try it? Because mdutil says Backups.backupdb is still being indexed. Commented Oct 29, 2011 at 0:15
  • Yes. On a flash drive, a camera flash-card and two .dmgs. It works on all of them.
    – JRobert
    Commented Oct 30, 2011 at 0:15
  • 1
    it appears that Time Machine backups are a special case. Commented Oct 31, 2011 at 18:34
  • sudo touch /Volumes/<external disk>/.metadata_never_index (after disabling indexing for the disk as a whole) in fact made my time machine progress beyond the few kilobytes it was stuck four hours before. Even though when doing sudo lsof | grep <external disk>' I still see processes mds` and mds_store having open files on the external disk in .Spotlight-V100/Store-V2... Commented Sep 24, 2017 at 16:00
5

Apply it to the volume, not a directory:

sudo mdutil -i off /Volumes/TimeMachine/

Substitute TimeMachine with the name of your backup volume, of course. For example...

Johns-iMac:~ john$ sudo mdutil -i off /Volumes/Time15/
Password:
/Volumes/Time15:
2015-10-27 12:37:18.436 mdutil[56686:26121199] mdutil disabling Spotlight: /Volumes/Time15 -> kMDConfigSearchLevelFSSearchOnly
    Indexing and searching disabled.

Which does leave the subdirectory reporting as "enabled", but (until proven wrong I understand) the setting at the volume level will override.

1
  • I tried it and got "Error: unknown indexing state" Commented Sep 23, 2022 at 20:26
5

I finally found you cannot disable Spotlight to index Backups.backupdb.

Apple Support. OS X El Capitan: Spotlight preferences

If you add a Time Machine backup disk to the privacy list, you will continue to see messages that Spotlight is indexing your backup disk. This indexing is necessary for Time Machine to function properly and can’t be disabled. Spotlight does exclude from searches any items you store on your backup disk that are not part of a Time Machine backup.

2

Do it from Terminal via sudo (info courtesy this page):

sudo mdutil -a -i off

You'll also need to supply your admin password.

Similarly, to turn back on:

sudo mdutil -a -i on

Note: Set the items for Spotlight to show at Prefs > Spotlight

4
  • 2
    You probably should include a command for turning it back on.
    – daviesgeek
    Commented Oct 28, 2011 at 21:14
  • 4
    mdutil also refuses to turn off Time Machine indexing. Commented Oct 28, 2011 at 21:15
  • @daviesgeek, good point - I thought it would be reasonably obvious (and was covered in the article)
    – JW8
    Commented Oct 28, 2011 at 21:18
  • You shouldn't turn spotlight off for your main drive unless you know the consequences, such as App Store upgrades will never work again, email searches won't work (if using Apple Mail), etc. Spotlight is a real nuisance but required by the OS for a number of things.
    – kakubei
    Commented Sep 10, 2013 at 14:49
2

Time machine requires spotlight indexing activity, but the contents will not pollute search results. If the goal is to remove redundant search results for a non-Time Machine drive (a CarbonCopyCloner backup for example) then the volume can be simply added to the privacy list under Spotlight preferences.

(The details of the original question indicate it is about Time Machine, but I include this case for those who find this question by the title.)

0

Here's the man page for mdutil:

mdutil(1)                 BSD General Commands Manual                

NAME
     mdutil -- manage the metadata stores used by Spotlight

SYNOPSIS
     mdutil [-pEsav] [-i on | off] mountPoint ...

DESCRIPTION
     The mdutil command is useful for managing the metadata stores for mounted volumes.

     The following options are available:

     -p  Spotlight caches indexes of some network devices locally.  This option requests that a local
         caches be flushed to the appropriate network device.

     -E  This flag will cause each local store for the volumes indicated to be erased.  The stores will
         be rebuilt if appropriate.

     -i on | off
         Sets the indexing status for the provided volumes to on or off.  Note that indexing may be
         delayed due to low disk space or other conditions.

     -s  Display the indexing status of the listed volumes.

     -a  Apply command to all volumes.

     -v  Print verbose information when available.

I would use:

mdutil -E -i off [the mountpoint for your backup drive]
1
  • 4
    I've already stated that mdutil leaves Backups.backupdb enabled no matter what. Did you try it? Commented Oct 29, 2011 at 0:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .