Why Spotlight Blocks Disk Ejection (And How to Fix It)
Spotlight indexing is one of the most common reasons you can't eject an external drive. Here's how to deal with it.
You try to eject your external drive and macOS refuses. You check Activity Monitor and see processes named mds or mds_stores accessing your drive. Congratulations, you’ve met Spotlight indexing.
This is probably the most common reason external drives won’t eject on Mac. Spotlight wants to index everything so you can search it later, and it doesn’t care that you need to leave for a meeting in two minutes.
What Spotlight is actually doing
Spotlight’s indexing system runs through several background processes. The main one is mds (metadata server), which coordinates the whole operation. Then there’s mds_stores, which handles the actual storage of indexed metadata. You might also see mdworker or mdworker_shared doing the heavy lifting of reading and categorizing your files.
When you connect an external drive, Spotlight treats it like a new territory to explore. It starts scanning every file, extracting metadata, and building a searchable index. This happens automatically unless you’ve explicitly told Spotlight to leave that drive alone.
The problem is that Spotlight keeps file handles open while it works. As long as those handles exist, macOS considers the drive “in use” and won’t let you eject it.
How to check if Spotlight is the culprit
Open Activity Monitor (search for it in Spotlight, ironically) and look for these process names: mds, mds_stores, mdworker, or mdworker_shared. If any of them show your external drive’s name in the process info, Spotlight is your blocker.
You can also check from Terminal. Run this command, replacing the drive name with yours:
lsof /Volumes/YourDriveName
If you see mds-related processes in the output, Spotlight is holding onto your drive.
The quick fix: disable indexing temporarily
The fastest solution is to turn off Spotlight indexing for that specific volume:
sudo mdutil -i off /Volumes/YourDriveName
You’ll need to enter your password. After the command completes, Spotlight releases the drive and you should be able to eject normally.
When you reconnect the drive later and want indexing back:
sudo mdutil -i on /Volumes/YourDriveName
The permanent fix: exclude the drive entirely
If you never want Spotlight to index a particular external drive, you can add it to the privacy list.
Open System Settings, go to Siri and Spotlight (or just Spotlight on older macOS versions), then click “Spotlight Privacy” at the bottom. Drag your external drive into this list or click the plus button to add it.
Drives on this list are completely ignored by Spotlight. You won’t be able to search their contents from the Spotlight menu, but they’ll eject instantly every time.
There’s also a trick using a hidden file. Create an empty file named .metadata_never_index in the root of your external drive:
touch /Volumes/YourDriveName/.metadata_never_index
Spotlight checks for this file and skips indexing any volume that has it. This is useful for drives you share between multiple Macs, since the setting follows the drive rather than being stored on each computer.
When Spotlight won’t let go
Sometimes Spotlight gets stuck. You’ve disabled indexing, but the processes still won’t release the drive. In Activity Monitor, you can select the offending mds process and click the X button to force quit it.
Be aware that force-quitting system processes can cause temporary weirdness. Spotlight will restart itself automatically, but you might see brief slowdowns or need to wait a moment before everything settles.
If the drive still won’t eject after killing the Spotlight processes, something else is also holding it open. Run the lsof command again to see what remains.
Why this keeps happening
Every time you connect an external drive, Spotlight starts indexing it fresh unless you’ve excluded it. Even drives you’ve used before will get re-indexed if their index becomes outdated or corrupted.
macOS updates can also reset Spotlight’s privacy settings. Some users have reported that after upgrading to a new macOS version, drives they had previously excluded were suddenly being indexed again. Worth checking your Spotlight Privacy list after major updates.
A simpler approach
Hunting through Activity Monitor and Terminal every time you want to unplug a drive gets old fast. Ejecta shows you exactly which processes are blocking ejection and lets you quit them with one click. For Spotlight specifically, it identifies the relevant mds processes and handles them cleanly, so you’re not guessing which one to kill or worrying about system stability.
The underlying problem (Spotlight aggressively indexing external drives) isn’t going away anytime soon. But dealing with it doesn’t have to be a research project every time you need to leave with your drive.
Tired of drive ejection issues?
Ejecta shows you exactly what's blocking your drive and lets you fix it with one click.
Get Ejecta for $14.99