Cannot unmount external HDD. Only "force unmount" works

I cannot use the Finder on my external HDD icon -> unmount. It doesn't work, only force unmount.

I think if I force it, some files can be damaged.

I have closed all programs running on it. With sudo lsof|grep ExternalHddName I wanted to find out the processes using this HDD. Nothing was shown.

1. Should I avoid force unmount every time? In meaning of whether id dangerous.

Update

sudo lsof|grep /Volumes/ExternalHddName should be used instead.

If I use diskutil unmount /Volumes/ExternalHddName I become failed to unmount: dissented by PID=199 (/usr/libexec/ApplicationFirewall/socketfilterfw

Im using the online game on the external HDD. Maybe this socketfilterw has something to do with it. But its active even 20 minutes after I have exit this game.

I have used sudo kill 199, after it unmount was possible.

2. Should I every time I want to unmount this external HDD manually find which process use it and than manually kill this process? I would like to do it in one step and without logout from Mac.


Solution 1:

Some online games have "helper apps" that update the game in the background. Try plugging in the drive and then unmount it without running the game. If it does work, then you could make a simple Automator/bash script to unmount the drive (it should consist of the two commands you mentioned above, except that you should use sudo killall <appname> for killing the process locking the drive.