Last update: 28 Sept 2007
For those of you who try to umount a device (let's say a cdrom), and get the message “umount: /mnt/XXX: device is busy” (where XXX is your mounting point), here is the solution: fuser
So, for your cdrom mounted in /mnt/cdrom
fuser -muv /mnt/cdrom
What every option says?
-v Verbose mode. Processes are shown in a ps-like style. The fields PID, USER and COMMAND are similar to ps. ACCESS shows how the process accesses the file. If the access is by the kernel (e.g. in the case of a mount point, a swap file, etc.), kernel is shown instead of the PID.
-m name specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed to name/. to use any file system that might be mounted on that directory.
-u Append the user name of the process owner to each PID.
After that, you can see that nasty PID and kill it easily.
Another useful command can be lsof
lsof - list of open files. It shows information in a structure like COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME. Combined with grep, it can points you in the right direction for blocked /mnt/cdrom
lsof | grep cdrom bash 3098 cristian cwd DIR 3,0 106 9728 /mnt/cdrom/support