Photos media library on external hard drive

Solution 1:

$ launchctl kill -TERM gui/$UID/com.apple.photoanalysisd

This command will stop the current instance of the photoanalysis daemon. Afterwards it is possible to eject the hard drive without any problems.

Solution 2:

just type in the following command:

kill [PID of photoanal] (in your case the PID was "608")

That should terminate the photoanal process

mds is part of spotlight, it stands for "metadata server" I believe. It might be indexing your drive so I don't know how dangerous it is the terminate it as well.

Once you have terminated all processes using your drive you can then easily eject it (the following command should return nothing: lsof | grep 'name of your drive').

My photos library has been on my external drive for over 1 year and I have only recently started to experience the same issue that you described. This is what solved it for me. (I'm running macOS 10.13)