Trouble ejecting external drives

So for the past few months, almost every time I try to eject a drive that I mounted on my desktop, I get an error that the disk cannot be ejected because it is “in use”. This was never a problem in the past, but it occurs consistently now. When I check on which program is using it (there really should be an easy way to find this out and I am disappointed Apple has not built something into the OS to give more info and to give you a clean option), it invariably seems to be Spotlight. Even after I wait for minutes to hours, it still will not eject without doing a Force Eject. Is there a problem with the Spotlight indexing that this is happening? Would rebuilding the index help? Has anyone else noticed this? Just the term “Force Eject” makes me nervous and there should be a way to eject the disk without “potential damage”.

2 Likes

What to do when a volume can’t be ejected or unmounted – The Eclectic Light Company might help.

2 Likes

Force-eject will close all file handles. If an app is writing to the device, the file it is writing may end up corrupt. But the file system itself won’t be corrupted, so all other files will be fine. And if the app(s) in question are only reading files, it won’t matter at all.

If this is a volume that you don’t want Spotlight to index (e.g. a thumb drive), you may want to use the mdutil utility to disable indexing on a volume and then delete the index database from that volume.

Some examples:

  • Check the indexing status of a volume:

    $ mdutil -s /Volumes/Cruzer/
    /System/Volumes/Data/Volumes/Cruzer:
        Indexing enabled. 
    
  • Disable indexing on a volume:

    $ mdutil -i off /Volumes/Cruzer/
    /System/Volumes/Data/Volumes/Cruzer:
    2025-01-31 18:46:16.318 mdutil[9791:81415079] mdutil disabling Spotlight: /System/Volumes/Data/Volumes/Cruzer -> kMDConfigSearchLevelFSSearchOnly
        Indexing disabled.
    
    $ mdutil -s /Volumes/Cruzer/
    /System/Volumes/Data/Volumes/Cruzer:
        Indexing disabled.
    

    When indexing is disabled, that status is persistent, so you can eject and re-insert the volume. But don’t delete the hiddend .Spotlight-V100, because that directory contains a .plist file which is where the indexing configuration is stored.

  • Delete the local store of the index on a volume. This will cause the index to be rebuilt if indexing is enabled, but will leave it deleted if it is disabled:

    $ mdutil -E /Volumes/Cruzer/
    /System/Volumes/Data/Volumes/Cruzer:
    2025-01-31 18:49:21.754 mdutil[9820:81417639] mdutil disabling Spotlight: /System/Volumes/Data/Volumes/Cruzer -> kMDConfigSearchLevelFSSearchOnly
        Indexing disabled.
    

Type man mdutil for the full documentation.

4 Likes

But I shouldn’t have to do this just to Mount/Unmount an external disk. I never had to tweak around the system before, or turn of Spotlight Indexes on them. And shouldn’t Spotlight finish indexing if I let it sit there awhile? If no one else is seeing this, there may be something wrong with my system.

2 Likes

I’ve been seeing this often (cannot eject disk because it is “in use”, so have to use Force Quit) when trying to eject an external disk that I use for CCC backups (any of 3 disks used in rotation. I"ve been using Force Quit without any bad effects.

1 Like

I have seen the same problem on an external SSD that I have been using for CCC backup. (The disk was ‘in use’ by ‘kernel’) Then I used Disk Utility to reformat the external SSD, and re-created CCC backup on it from scratch. Since then, no problem any more. (I was using macOS 15.2 at that time.)

1 Like

Agreed, but I think the advice given is in hopes that forcing a re-index of the disk might solve the problem (i.e., one-and-done, if it works). If you don’t want to use mdutil (per @Shamino’s comments), Apple has another way that’s pretty simple, and just takes a sec. May not work, but very little investment of time to find out:

2 Likes

You’re 100% correct. I simply meant to show how you can turn off Spotlight indexing if that is what is keeping the volume from unmounting.

The fact that Spotlight is (apparently) blocking volume-eject under certain circumstances is still a bug that should be fixed, but I can’t do anything about that.

1 Like

Relaunching Finder via its dock context menu (or from the Force Quit window) is my go-to solution for this problem.

3 Likes

For the benefit of those few people more confused than I am, getting the Relaunch command apparently requires holding the option key when summoning the contextual menu. (In my limited investigation, the Relaunch command was the bottom command.)

It’s also available from the force quit window if you highlight Finder.

Is that any different (from the drive’s point of view) from a Force Eject? I assume both don’t close any operations and force the unmount. Or is closing the Finder and restarting it better?

Yes, quite different.

Forcing an eject is unsafe, because the handles could be from anywhere other than Finder, and so comes with a warning saying similar. You’ll also probably never know what was holding on to the disk.

Relaunching Finder causes any file handles only it has to the disk to be released safely. The disk itself is not ejected as part of this process. (Also, you don’t need to close Finder windows before relaunching, in fact it’s better not to, so all windows will be restored in place).

Of course after relaunching Finder you’ll still need to wait for, or instantiate, the final eject. But you can feel all warm and fuzzy knowing that it was definitely Finder preventing the eject. No guesswork involved. Repeatable and verifiable.

10 Likes

I’ve been seeing this issue quite regularly for quite a few years; but for me, certain external disks are much more likely than others to experience this problem. It is an especially annoying problem because, in the vast majority of cases, I am only viewing the contents of the disk or copying new files to the disk. Most recently, I have started having trouble ejecting my Time Machine disk, which I only mount to make manual backups. This problem is at the very top of my list of persistent Finder bugs that are probably never going to change. Normally, I log out and log back in to fix the problem, but force-quitting might be a little faster (if it works).

Thanks for mentioning that. Although I haven’t needed it for the subject of the current discussion, I don’t think I’ve ever intentionally used control-click or option-control-click on the Finder icon (or other app icons) in the Dock. Very handy!

1 Like

You can also option click app menus at the top of the screen to get alternate and hidden items. Finder has a bunch.

1 Like

Adding to the above tips…

Force Quit is also on the :apple_six_colors: menu (now there’s a logo I haven’t seen for a while!). Relaunch Finder is listed from there.

Settings/Spotlight/Search Privacy (a button at the bottom of the window) allows you to add an external drive to the list of folders/drives that Spotlight excludes from its searches.

Restarting your Mac worked for me when I used to get this problem regularly. Recently for no apparent reason the problem has disappeared.

This is one of the most annoying behaviors I have had to deal with on my iMac, which is a 2019 model running the latest version of the Mac operating system. This issue has been going on for a couple of years. I have turned off Spotlight indexing for the volumes in question and yet this invariably happens every time I try to eject an external volume.

You can add for example cmd-shift-q to quit Finder here:
Settings > Keyboard > Keyboard Shortcuts… > App Shortcuts > Finder

If it’s not yet there, just hit +, choose Finder from the list, enter “Quit Finder” as Menu title, and cmd-shift-q (or whatever you prefer) for the Keyboard shortcut. Then save by clicking Done. Now it should show under Finder.

I chose cmd-shift-q instead of the usual cmd-q to prevent accidental quitting (I rarely want to quit Finder).