I have an external hard drive. I often eject it. I noticed that around 80% of the time I need to force eject the hard drive instead of manually ejecting it. I ran this command to see what was using my disk, preventing me from ejecting it:
sudo lsof -xf +d /Volumes/myHardDrive/
The only process that usually comes up is
mds. Now, I've searched this up on multiple websites and it seems this process is solely related to indexing your disk so that you can use it with Spotlight.
The only issue is that I've disabled Spotlight for my hard drive (in System Preferences > Spotlight > Privacy.
mds shouldn't be causing any problems, but it does.