MacOS – Unable to re-enable Spotlight on Volume

macosspotlight

I've been trying to debug a "Waiting for index to be ready" issue with my Time Machine volume, and one piece of advice that I've encountered is re-creating the Spotlight index on the volume.

To do this I ran the following commands (as sudo):

mdutil -i off /Volumes/Backup
rm -R /Volumes/Backup/.Spotlight-V100

However, I'm now trying to re-enable Spotlight with the reverse of the first command, but this is what I'm getting:

mdutil -v -i on /Volumes/Backup
/Volumes/Backup:
    Indexing and searching disabled.

It simply doesn't want to do it, and I can't figure out why. I've tried manually recreating the .Spotlight-V100 with ownership set to root:wheel and mode set to 700 (exactly as the folder on other volumes is configured), and while mdutil has now created a VolumeConfiguration.plist file, it still won't enable indexing.

I can't find anywhere to get more information; the -v option of mdutil doesn't give any additional output, and nothing extra seems to be logged anywhere. There doesn't appear to be any physical problem, as the drive is new and reporting no I/O errors or other issues; aside from the "waiting for index" slow-down, Time Machine is otherwise working perfectly and I can view the contents of its backups without any problems.

Anyway, are there any other steps that can be followed to force Spotlight to re-index the drive, or find out why it's failing to do-so?

Best Answer

There are typically user immutable flags set on Time Machine backup volumes so that even root can't directly chown or chmod. You can look at these with:

ls -laeO /Volumes/*
ls -laeO /Volumes/Backup/Backups.backupdb/


Mac:~ me$ ls -laeO /Volumes/Backup/Backups.backupdb/
total 0
drwxr-xr-x@  7 root  wheel  -  238 Mar  3 04:40 .
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown
drwxrwxr-x  20 root  wheel  -  748 Mar 25 12:29 ..
drwxr-xr-x   3 root  wheel  -  102 Mar 27 12:04 .RecoverySets
drwx------   7 root  wheel  -  238 Mar  6 10:47 .spotlight_repair
drwx------   2 root  wheel  -   68 Mar 27 14:28 .spotlight_temp
drwxr-xr-x@ 40 root  wheel  - 1360 Mar 27 18:31 Mac
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

Cross reference with diskutil list to double check your mount points and volume names. My experience is that since Time Machine requires spotlight to make hard links is that if you tamper with the stores where those databases are resident on the filesystem you can't put "humpty dumpty" back together again and should archive off the snapshot backups you need using Finder/rsync or by making a dmg of those instants and then wiping the drive to start with new slate of .dotfiles and .dotdirectories with associated stores.

Clearly, someone with internal knowledge of how Time Machine and spotlight self check might step up and explain things, but I've not seen this level of detail publicly documented by Apple so far. I'd start at http://pondini.org/OSX/Home.html if you haven't checked there for any community knowledge on the innards of Time Machine + Spotlight