So you go about your business using your computer and you want to safely remove or unmount a USB drive or SD card and you get the following message:
Windows: “Problem Ejecting USB Mass Storage Device” The device ‘TheNameOfYourDrive’ cannot be stopped now. Try stopping the device again later
OS X: The disk “TheNameOfYourDrive” is in use and could not be ejected”. Try quitting applications and try again.
Windows: the solution is relatively simple: download Unlocker. So when you get the error message just right click > Unlocker > Unlock All
OS X: As the OS X dialog box suggests, you should try quitting applications but you don’t want to just willy-nilly close all applications, just the one causing the problem. To identify the application, open Terminal and type the following:
lsof | grep TheNameOfYourDrive“
It should display the current usages of the drive. The first name on the left is the application that is using the drive. Close that application and try unmount the drive again and it should work.
I used a similar tip to identify why I couldn’t replace my GIMP installation: I tried copying the application into the Applications directory and just got an error message saying that “The operation cannot be completed because the time libexpat-1.5.2.dylib is in use”. Fired up terminal and instead of “
lsof” I used “
ps -e” and saw that there processes using it. I killed those processes with “
kill -9 processID” (process ID is the leftmost/first column in the “
ps -e” output) and was able to copy it without a problem
2 thoughts on “Unlocker / lsof / ps is your friend”
Interesting. I should try that when my Pen Drive acts up again. :)