3

Sometimes, a volume refuses to eject because some program is using them.

Sadly, Finder doesn't give the identity nor gives a way to solve the problem.

So, how do you solve this problem in a clean way, without using a terminal ?

Using the terminal, I may find a way to eject it, but it's not reliable.

sudo lsof | grep volumeName certainly gives some information, but I don't feel like killing random processes in order to unmount a volume. Also, not everybody is willing to run command in a terminal.

I also don't want to force eject the volume. I think we shouldn't have to force the ejection when we didn't initially run the program that locks the volume.

Processes that are frequently involved are: mds and notifyd.

Killing mds does not guarantee that the ejection of the volume will be possible. mds process is respawned after getting killed, and continues preventing the ejection of the drive.

I also noticed that mds can be running and using files, and still not preventing the ejection of the volume, so I'm not even sure that it's mds fault.

3
  • 2
    Running lsof and then killing any troublesome processes actually is the canonical way to solve this problem (and all the tools which allow you to force-eject a drive do this as well), so I'm a bit unclear about what kind of problem you are trying to solve here. Can you please try to frame your question a bit more specifically?
    – nohillside
    Commented Oct 24, 2013 at 18:42
  • @patrix I doubt every Mac user is going to launch a terminal and begin typing in it. Are non technical users forced to do a force eject and possibly corrupt data on the volume ?
    – alecail
    Commented Oct 24, 2013 at 18:58
  • Technically there is no other way, besides waiting for the blocking processes to finish (which may be never) or a system reboot (which will kill the processes as well).
    – nohillside
    Commented Oct 24, 2013 at 19:25

2 Answers 2

1

I've found this solution that has worked reliably several times already today.

The process that, in my case, was responsible for the failure of the ejection was:

SystemUIS (as seen in top in a terminal) which is in fact SystemUIServer.

Here is how to kill it without a terminal: run Activity Monitor, find SystemUIServer (type UI in the top right search field), and stop it with the top left button (stop button).

0

This is an attempt to write a canonical QA for this issue, as per the Meta post: Where is the list of canonical questions stored for Ask Different? I expect it to be periodically edited with the goal of becoming a comprehensive information resource.

There is any number of reasons that you'll encounter this "error." In fact, it's not an error per se, but a warning that something on the mounted volume is in use and should be properly closed before ejecting it.

The the OP's case it was SystemUI as detailed in their answer. It's possible that you'll encounter this exact same scenario, but more than likely, you'll run into something completely different.

What can cause this? Pretty much any (but not limited to) the following conditions of the mounted volume:

  • Merely an open Finder window of the mounted volume
  • A text file opened for editing
  • A PDF opened in preview
  • A Terminal session in which the current directory $PWD is on the mounted volume
  • An "install" script/function that is paused and/or pushed to the background
  • And many more...

So, how do you solve this?

Find out what process has your files

You can use the lsof command to "list open files."

For this example, I have mounted a USB drive called "Music" and I have traversed down a couple of directories. I haven't opened anything or even loaded up a song to be played. Executing the command:

$ sudo lsof | grep Music

gives me the following:

bash      64364            allan  cwd       DIR               1,16       32768     23327 /Volumes/MUSIC/Music Collection/a-ha/Hunting High and Low

This tells me that in bash, there's a "current working directory" (cwd) in this particular folder: /Volumes/MUSIC/Music Collection/a-ha/Hunting High and Low. In other words, I have an open Terminal session with that sub directory selected. Just leave the sub directory and you'll be able to eject the volume.

How do you get the list of mounted volumes?

  • mount (This command all by itself will list the mounted volumes)
  • ls /Volumes
1
  • I think you have the wrong link target for your link to discussion on Meta.
    – Nic
    Commented Mar 9, 2020 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .