"umount: /mount/path: device is busy" and "Device or resource busy while trying to open ..."

From Helpful
Jump to: navigation, search
These are a bunch of quick jots worth noting down but not complete in any way (and probably won't make it up to well-written text and possibly not even stub status).


Means what it says - programs have open handles to files or directories that come from this device.

This may be a shell, often its current directory or the one it was started from.


To see what's open, You can see which processes have things open, in this example for /mount/path, with a command like:

lsof | grep /mount/path

or

fuser -vm /mount/path

The -m option lists all open files on a filesystem (on the filesystem the file reference is on). The v is for verbose, so that you get process names instead of just IDs.



Linux ≥2.4.11 lets you do a lazy (-l) umount, which only detaches the the filesystem from the mount point, but only does full cleanup once the open handles are actually closed. If something is misbehaving this may easily be never, and you won't help you do an fsck or mount.


For the case of unreachable NFS there is -f (force).


combined with Input/output error can be a bit of a catch-22, depending on the cause, as it may not let you do the thing that frees it up.

If you try to open a device with fdisk that was partition-scanned (present in /dev) and get something like

Unable to open /dev/sdb

...then the device dropped away, either because it was yanked, or e.g. a RAID driver deciding to do so(verify).