Umount – device is busy

mount

Sometimes when I want to umount a device, e.g.

sudo umount /dev/loop0

I will get the message

umount: /mnt: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

I usually solve this issue by closing a console window (in my case xfce4-terminal) and then umount.

What does this problem mean? Is there some smarter solution?

Best Answer

It means that some process has a working directory or an open file handle underneath the mount point. The best thing to do is to end the offending process, change its working directory or close the file handle before unmounting.

There is an alternative on Linux though. Using umount -l calls a "lazy" unmount. The filesystem will still be mounted but you won't be able to see or use it, except for processes that are already using it. When the offending program exits (through whatever means) the system will "finish" unmounting the filesystem.

Related Question