I’ve talked to a few friends that own Mac’s and they’ve all ran into the same “The volume can’t be ejected because it’s currently in use” problem when attempting to eject an external hard drive. I did a little online searching and came up with a solution. I’m not sure if it’s the best solution, but it solved my problem.
FIrst, I ran into an Apple Support page which stated that it may be a spotlight indexing problem.
So I went ahead and removed the hidden spotlight files from my external.
$ sudo rm -rf /Volumes/MyBook/.Spotlight-V100*
Then, I went into Spotlight preferences under the Privacy tab and added my External drive to the “Prevent Spotlight from searching these locations” section. Thinking that this would stop Spotlight from indexing the external, as there is no need to index a hard drive that is constantly being connected/disconnected (IMHO). I also did this because I thought Spotlight was the reason why I couldn’t eject the drive. I also learned from thejackol.com that the Mac will forget any external drive preference within Spotlight when disconnected. So here’s the solution to that problem.
“To avoid Spotlight from indexing an entire volume, create an empty file named .metadata_never_index in the root folder of the volume. If your volume is called MYDATA, for example, open up Terminal and type:
$ touch /Volumes/MYDADA/.metadata_never_index
Spotlight should now skip indexing this volume – as long as this file exists.”
Anyhow, after doing so I was still unable to eject the disk properly. Yeah, I know, why am I telling you all this crap if it didn’t work? So you can learn, that’s why.
I then opened the Terminal application to check what files are using the external drive.
$ lsof /Volumes/MyBook/ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Finder 258 tommye 29r DIR 14,6 68 261851 /Volumes/MyBook/.Trashes/37721 Finder 258 tommye 30r DIR 14,6 2244 83672 /Volumes/MyBook/Pictures/Wallpapers Finder 258 tommye 38r DIR 14,6 3060 165630 /Volumes/MyBook/Videos/Other Finder 258 tommye 39r DIR 14,6 5100 70920 /Volumes/MyBook/Pictures/2011/2011-1014 Finder 258 tommye 40r DIR 14,6 952 165501 /Volumes/MyBook/Videos/Movies Finder 258 tommye 63r DIR 14,6 136 166000 /Volumes/MyBook/Videos/Tommy Elmesewdy Finder 258 tommye 76r DIR 14,6 340 178928 /Volumes/MyBook/World/Desktop Finder 258 tommye 79r DIR 14,6 16796 81587 /Volumes/MyBook/Pictures/Random ...
I noticed a bunch of files that I had previously copied over to my local drive still being accessed by the Finder application for some reason (the copy had already finished).
All I had to do was kill PID 258, which was Finder.
$ kill 258Finder will basically re-launch after you kill it and then you should be able to eject your external drive properly.


