Monday, July 18, 2022

Invasive Spotlight Indexing

Lloyd Chambers:

The thoughtless design of providing no facility to defer/delay Spotlight indexing is bad enough. But to perform intensive Spotlight indexing when the user is needs the machine to perform well—that is design incompetence to the point of offensive. Ditto for when a CPU and disk-intensive program is running, one that the user wants done as soon as possible.

Spotlight destabilizes the performance of your Mac. You just never know when you can count on things running as they should.

What I’m asking Apple to do is to add something akin to the “Stop this backup” menu item that Time Machine offers. That works great—it will defer the backup for an hour. A “Defer indexing For...” menu command would surprise and delight me.

It’s great to have tools like TimeMachineEditor, but in my opinion there should be a built-in way to restrict both Time Machine and Spotlight to only run during certain hours and to postpone them for a specified amount of time.

Sometimes I want the Mac to be quiet, but I don’t want to turn it off because it’s still doing something important like uploading to a cloud backup. That by itself wouldn’t cause fan noise or much hard drive grinding. But sometimes a Spotlight process decides to go crazy, and then the Mac is loud for hours or even days unless I’m in a position where I can unmount the drive that it happens to be indexing.

I’ve mostly worked around this by disabling Spotlight indexing on all my spinning hard drives. However, it no longer (since APFS?) seems to be possible to exclude Time Machine drives. And, of course, my Time Machine drive has more indexable content than any single drive that I have, so there is a lot of work for Spotlight to do.

As best I can tell, the most invasive indexing is actually caused by something going wrong with the index files. Sampling the processes shows threads like com.apple.metadata.spotlightindex.Compaction that seemingly use lots of CPU and I/O forever. In such cases, I use sudo mdutil -E to delete the Spotlight index. That, of course, triggers many hours of legitimate work for Spotlight to build a new index, but then it’s eventually quiet—until the next time compaction gets stuck.

7 Comments RSS · Twitter

Tudorminator

I use a late 2012 mac mini (quad-core i7) as an always on media and print server, amongst other things. I found out, to my dismay, that it has the same terrible thermal management as the Intel macbook pros (I wonder if it too has a „mobile” processor, because that would explain a lot). The only way I can keep it silent is by disabling the processor's turbo boost. Catalina has obvious performance issues in this mode (a very sluggish finder, for example), but I could never stand the fan noise otherwise.

Once upon a time, the Spotlight (magnifying glass) menu item would indicate when indexing was taking place: a small dot in the centre would slowly throb. That was very useful, because it would explain to the user why the disk is thrashing alluvasudden. Lord knows why Apple took that away.

unless I’m in a position where I can unmount the drive that it happens to be indexing.

Except I cannot unmount a Time Machine disk that’s being indexed. And there is no way to exclude AFPS Time Machine disks from indexing. And of course, as discussed, no way to stop or defer indexing in general.

So there are times when I can’t unplug my Time Machine disk.

Now after going through multiple USB-C hubs, including some expensive brand-name options, and never finding a reliable one, I’ve got my Time Machine disk hooked to one of the two USB-C ports I have. The other has the external display plugged into it, which also supplies power.

Meaning during those cannot-unplug times I have no way of plugging other devices into my Mac.

The only recourse, if I need to this bad enough, is to power down the Mac and disconnect the Time Machine disk while it’s off.

I regret going with AFPS for Time Machine on my latest Mac and will be switching to HFS+ whenever I can be bothered with the hassle.

I've been making daily Time Machine backups to an encrypted APFS hard drive since May last year and I've only had it happen two times that I was unable to unmount the drive without rebooting my MacBook Pro. An additional one or two times it took a couple of minutes until the drive would unmount.

I do, however, unmount the hard drive almost always within the first 5-30 minutes after it completed the first backup of the day, because I, too, find the never-ending Spotlight activity pretty irritating.

Come to think of it, not having the TM APFS drive connected all day also solved another issue for me: When I still had the drive mounted all day doing regular TM backups, it would, after a few days, stop automatically mounting the encrypted APFS drive when I connected it in the morning and instead ask me for its password, but then not accept the password. After a reboot, the drive would mount automatically again, using its password from Keychain. I don't remember ever having had this issue with encrypted HFS+ drives.

>Except I cannot unmount a Time Machine disk that’s being indexed.

Which is why I only do TimeMachine over the network. If push comes to shove you can use a raspberry pi even.

I attach the time machine drive, do a backup, then disconnect it.
I would trust the technology more if there was any documentation at all.

Which is why I only do TimeMachine over the network.

I gave up on that years ago because of the dreaded “Time Machine completed a verification of your backups. To improve reliability, Time Machine must create a new backup for you. [Back Up Later] [Start New Backup]”. With Time Machine backing up to physical external HDs I have at least not had this type of loss of my backups.

Leave a Comment