Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



macOS - See what ap...
 
Share:
Notifications
Clear all

[Solved] macOS - See what applications are locking your disk (cannot unmount)

3 Posts
2 Users
1 Reactions
3,533 Views
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2728
Topic starter  

Sometimes your Mac doesn't like to let go of a disk and unmounting somehow fails.

Often this is because some applications is "locking" the disk and refuses to let it go for an unmount.
Now how do we find out what application this is?

First step; determine where the disk is mounted - in Terminal.
Quite often this is a directory in /Volumes/, for example /Volumes/MyDisk.

Next step we use lsof  (list open files) in Terminal, but we do need sudo (admin) rights for that.

sudo lsof /Volumes/MyDisk

This should display a list, for example something like this:

COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mds 180 root 23r DIR 53,2 16384 2 /Volumes/MyDisk
mds 180 root 27r DIR 53,2 16384 2 /Volumes/MyDisk
Finder 11722 hans 51r DIR 53,2 16384 2 /Volumes/MyDisk QuickLook 11732 has 9r REG 52,3 1143491 7862 /Volumes/MyDisk/SomePicture.JPG

Here we see that "mds" and "Finder" are currently accessing your disk.
In this care it's very unlikely that either of these "lock" your disk.

"QuickLook" on the other hand seem to have a file open - and is most likely the case the one locking your disk.

To stop this, you can "kill" that particular task as such - CAUTION when killing a task, unsaved data in the application will be lost!
First determine the PID, the Process ID. So here that would be "11732".
Next kill it:

sudo kill 11732

   
brownelon258 reacted
ReplyQuote
(@brownelon258)
New Member
Joined: 4 years ago
Posts: 1
 

Hi,Thank you so much for sharing this informative and helpful answer. I must say,the way you elobrate the idea is an incredible, I'm really imaze the way that you describe the things. Please keep doin..


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2728
Topic starter  

Thanks brownelon258 😊 - I very much appreciate the feedback, and apologies for the late response.
For some reason I overlooked you post 😔


   
ReplyQuote
Share: