Linux: Which process is causing "device busy" when doing umount?
Solution 1
Look at the lsof command (list open files) -- it can tell you which processes are holding what open. Sometimes it's tricky but often something as simple as sudo lsof | grep (your device name here)
could do it for you.
Solution 2
Just in case... sometimes happens that you are calling umount from the terminal, and your current directory belongs to the mounted filesystem.
Solution 3
You should use the fuser command.
Eg. fuser /dev/cdrom
will return the pid(s) of the process using /dev/cdrom
.
If you are trying to unmount, you can kill theses process using the -k
switch (see man fuser
).
Solution 4
Check for open loop devices mapped to a file on the filesystem with "losetup -a". They wont show up with either lsof or fuser.
Solution 5
Also check /etc/exports
. If you are exporting paths within the mountpoint via NFS, it will give this error when trying to unmount and nothing will show up in fuser
or lsof
.
flybywire
Updated on July 03, 2020Comments
-
flybywire about 4 years
Linux: Which process is causing "device busy" when doing umount?