You are currently viewing How to avoid force ejecting mounted volumes in macOS

How to avoid force ejecting mounted volumes in macOS

When using macOS, you certainly know if you’ve opened a Pages file or are editing an email. But, below the surface are files that macOS uses that you don’t see–all the activity required for background processes, Time Machine backups, Spotlight indexing, and other system needs. When you want to eject a mounted volume, like a volume on an external SSD or hard drive, you can run afoul of macOS’s hidden needs.

You can try to eject a volume normally in these ways:

  • Select it in the Finder and press Command-E.
  • Select it in the Finder and choose File > Eject.
  • Control-click/right-click the volume in the Finder and choose Eject “volume name.”

(If you don’t see the volume in the Finder, either choose Go > Computer or press Command-Shift-C, or choose Finder > Settings > General and check all the items under “Show these items on the desktop.”)

If you’re lucky, when you try to eject a volume, you see a message with specific details, such as this one that came up when I tested ejecting the external drive that houses my main Photos library:

macOS couldn't eject drive

If you’re lucky, macOS tells you exactly which apps to quit.

Foundry

Quitting those two apps did let me eject “Photos SSD 2TB.” If there’s something happening at a system level, however, you will see a message worded like this: “The disk [name] wasn’t ejected because one or more programs may be using it. You can try to eject the disk again or click Force Eject to eject it immediately.” Cancel and Force Eject buttons are part of the dialog, and a progress spinner appears next to the phrase “Trying to eject.”

That does not help resolve the situation. Here’s what you can do to narrow down the problem. (And note that Apple uses the term “disk” despite that, in the Finder, you’re always ejecting a volume, as some disks may have multiple mountable volumes on them.)

Close Finder windows

As odd as it seems, sometimes merely having a window open in the Finder that shows the contents of the volume or a folder on it may make the Finder believe that a “program” is using that mounted item. Close the Finder window and try again.

Remove the volume from Spotlight

I’ve found that Spotlight can sometimes seize hold of a volume and mark it as unejectable even when indexing isn’t actively in process on that volume.

You can check if that’s the problem by going to  > System Settings > Siri & Spotlight, scrolling down to the bottom of the view, and clicking Spotlight Privacy. Drag the volume into the window (or click + and navigate to it, then add it), and click Done. This immediately removes the volume from indexing.

Try to eject now. If it works, that was the problem. However, if you want to search items on that volume, you will need to remove it from Spotlight Privacy later.

Check if Time Machine is backing up

If Time Machine is actively backing up the volume, you may be unable to eject it. Check the status of Time Machine either through its system menu or by going to  > System Settings > General > Time Machine. If it’s underway, you can choose Skip This Backup from the Time Machine system menu or click the “x” box next to the active session in the System Settings view and wait for Time Machine to wind down.

You can exclude the volume from Time Machine by using the settings view: click Options, click the + (plus) sign at the bottom of Exclude from Backups, and add the volume while mounted. Click Done.

Head for the Terminal

There’s a tweaky way to dig more deeply using the Terminal. In Terminal, copy and paste the following command after replacing “Name of volume” with your precise volume name, including spaces, and press Return:

lsof | grep ‘/Volumes/Name of volume’

Make sure there are straight single quotes before the / at the front of /Volumes and at the end of the line after your volume name.

The lsof command shows all files in use by apps and system processes; grep is a filter option that, with ‘Volumes’, lets you only see files in use by a mounted drive.

The resulting output is full of technical detail, but reading through it, you may be able to identify which programs are the issue, or what system processes have grabbed hold.

For my external Photos library volume, for instance, I saw dozens of entries, which include these two lines:

mediaanal 38659 glenn txt REG 1,38 32768 42399710 /Volumes/Photos SSD 2TB/Photos Library.photoslibrary/database/Photos.sqlite-shm Adobex20 855 glenn 84u REG 1,38 7134511104 62657146 /Volumes/Photos SSD 2TB/.TemporaryItems/folders.501/TemporaryItems/Adobe Photoshop 2024/Photoshop Temp1442699855

From this, I could have guessed Photos and Adobe Photoshop were active, even if the Finder hadn’t told me. You may be able to figure out from the list what app or apps to quit–or even that you don’t know why a given process is using the volume. In which case…

Force Eject

If you have a Force Eject button available in the dialog noted at the start of this article, you could click that now. However, I’m not a big fan of it: using Force Eject can cause a problem when the open file on the volume being ejected isn’t properly updated and closed. That might corrupt a file that you need without knowing it. I try to save Force Eject for when I know macOS is ridiculous and there’s no issue or it’s a situation in which I don’t have the time to choose the most prudent course, noted next: shutting down or restarting.

Shut down

If none of the above helps, then:

  • For a physically connected external volume, choose  > Shut Down. When your Mac is completely shut down, unplug the SSD or HDD. Press the power button on your Mac to start up.
  • For a “logically” mounted volume, such as a disk image or networked volume, choose  > Restart. On restart, the volume should be unmounted by default. If not, immediately select it and use an eject option listed above, which should now work.

This Mac 911 article is in response to a question submitted by Macworld reader Cliff.

Ask Mac 911

We’ve compiled a list of the questions we get asked most frequently, along with answers and links to columns: read our super FAQ to see if your question is covered. If not, we’re always looking for new problems to solve! Email yours to mac911@macworld.com, including screen captures as appropriate and whether you want your full name used. Not every question will be answered, we don’t reply to email, and we cannot provide direct troubleshooting advice.

Source