I sometime have problem finding which persistent process is not letting me eject a volume (CD/DVD/USB drive). The error message is not very helpful at all:
Try quitting applications
OK, but which one(s)? I often have hard time figuring that out using htop/ top or a combination of ps and grep.
But actually this is what I want:
where Volume_Name is the name of the volume (or an ‘identifying’ part of the name) I want to eject. This gives me the name(s) and process ID(s) of the run-away process(es) as well as the path to the file(s) in use on the volume, Volume_Name.
Now that I know the names I should first try to save the documents and quit the applications involved in the normal way. However, if a particular application does not oblige, I can always kill it (with the risk of potential data loss!) using its process ID (say, 123):
After that, the ejection of the volume should not be difficult at all.
Needless to say, being a Unix utility,
lsof (=“list open files”) may be used on other *nix-based systems as well.