How to unmount a locked volume?

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.


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).