force unmount on mac os x 27. Jun 2008

When using Mac OS X you might have encountered this message.

The disk "foobar" is in use and could not be ejected.
Try quitting appplications and try again.

This message may occur even if you have all closed all programs. The guilty party for this behavious may be Leopard’s FSEvents, which sometimes has a lock on a volume. To force the unmount of a volume just open a Terminal and use umount.

sudo umount -f /Volumes/FooBar

According to a commentator, if that doesn’t work you can also try

sudo diskutil umount force /Volumes/FooBar
 

Kommentare (11)

  1. b. About 1 hour later

    On linux machines it is often the case, that you are in the mounted directory when trying to unmount the device. Therefore you have to leave the directory to unmount the device:

    # mount -o loop foo.iso /mnt
    # cd /mnt/bar
    # umount /mnt
    umount: /mnt: device is busy
    

    The man page tells us: -f Force unmount (in case of an unreachable NFS system). (Requires kernel 2.1.116 or later.)

    The -f directive does not work in this case under linux machines. The umount command is still locked. So you have to leave the directory:

    # cd /tmp
    # umount /mnt
    
  2. Stefan About 11 hours later

    This works basically the same way on Mac OS X, but sometimes even changing the directory doesn’t resolve the issue,

    # umount /Volumes/Foobar
    umount: unmount(/Volumes/Foobar): Resource busy
    

    then diskutil comes to the help.

    # diskutil umount /Volumes/Foobar
    Volume Foobar on disk1s10 unmounted
    
  3. Goatse Man 239 days later

    To force the unmount on OS X 10.5 use

    diskutil umount force /Volumes/foobar
    
  4. Stefan 247 days later

    What’s the advantage of using diskutil over plain umount?

  5. mur 344 days later

    the advantage is, that if you cant unmount with anything else you can either take the cable away and hurt external drive or you can unmount with diskutil umount force /Volume/Yourowndisk

  6. Stefan 344 days later

    Okay, so diskutil is mightier than umount on Leopard, right?

  7. Christine Fürst 360 days later

    Hi,

    Thanks a lot for this post. It actually solved my problem!

    Cheers Christine Fürst (Stinie) from Rotterdam (Netherlands)

  8. RnS 484 days later

    Very helpful, thanks!

  9. Donald E. Payne 510 days later

    I found another process that can make a device busy, via the command $ userid root lsof ‘/Volumes/2ndHardrive 1’ COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME fseventsd 76 root 8u REG 14,5 0 1892050 /Volumes/2ndHardrive 1/.fseventsd/000000000038f4c5

    fseventsd is a daemon that watches for changes to a mounted volume, for the benefit of applications like Finder and Spotlight. It keeps a file open on the volume, so it is “busy”.

    Then I read here http://lists.apple.com/archives/Darwin-dev/2008/Sep/msg00039.html that you are not supposed to use the direct command-line tools like “mount” and “umount” on MacOS, and that “DA [Disk Arbitrator] will notify fseventsd to stop looking”. Surprising to me – I thought MacOS X was basically UNIX.

    DA appears to be either a GUI or an API. I want a command line. So I found, via “man -k disk”, the commands “disktool” (deprecated) and “diskutil” as mentioned above. diskutil works when umount fails; I guess it tells fseventsd to stop looking.

Kommentar schreiben

Markdown Syntax