OS X determine which application is accessing a HDD and preventing ejection?

Solution 1:

Try sudo lsof | grep /Volumes/External, where "External" would be the name of your external drive. Are you hosting any services' data off of that drive?

Solution 2:

lsof - List of open files

At your command promt just type sudo lsof to see a list of open files and their location and process id so that you can kill the process.

To refine it a little bit you could use sudo lsof | grep hard drive name.

Once you have the pid sudo kill -9 pid to kill the naughty process.


Solution 3:

Easy way, the freeware "What's Keeping Me": http://www.hamsoftengineering.com/products/wkm/wkm.html