"Workspace" is an encrypted dmg where I keep my code. I don't usually unmout it but I need to take a backup and it's refusing to let me unmount:
mark@mark-macbook-air /Volumes$ lsof | grep Workspace
mark@mark-macbook-air /Volumes$ lsof Workspace
mark@mark-macbook-air /Volumes$ hdiutil detach /Volumes/Workspace
hdiutil: couldn't unmount "disk1" - Resource busy
mark@mark-macbook-air /Volumes$ hdiutil unmount /Volumes/Workspace
hdiutil: unmount: "/Volumes/Workspace" failed to unmount due to error 49168.
hdiutil: unmount failed - Resource busy
mark@mark-macbook-air /Volumes$ ls
Macintosh HD@ Workspace/
If I try unmounting via the Finder:
"The disk “Workspace” couldn’t be ejected because “Terminal” is using it.".
I only have one terminal window open. It seems I could just close the terminal but since I'm pretty sure it's not using it so I ran sudo lsof
and saw several "mds" and one "login". MDS is part of spotlight so I disabled spotlight indexing on the volume. That killed a few processes. I'm now down to just two:
mark@mark-macbook-air /Volumes$ sudo lsof /Volumes/Workspace/
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
login 653 root cwd DIR 1,5 850 29 /Volumes/Workspace/src/projectname
mds 2106 root 5r DIR 1,5 476 2 /Volumes/Workspace
My question is why on earth would login
be using my drive? Is this bad? What should I do?\
Edit: Login seems to have left the drive alone but I still can't unmount due to mds.
Best Answer
You can use following command to force unmount it:
Use detach command can help to unmount and then eject the disk if you want.
If the above command reports following error message:
It means the path is incorrect, you can use
/Volumes/Workspace/*
instead.