Page 1 of 1

MacOS – See what applications are locking your disk (cannot unmount)

macOS – See what applications are locking your disk (cannot unmount)

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.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Hardware Apple/Mac Hardware macOS – See what applications are locking your disk (cannot unmount)

Viewing 1 post (of 1 total)
  • Author
    Posts
  • 12898

    hans
    Keymaster

    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
Viewing 1 post (of 1 total)



You must be logged in to reply to this topic.