This is an article I found at http://www.idevelopment.info/data/Unix/General_UNIX/GENERAL_Troubleshootingthedeviceisbusy.shtml documenting how to user the fuser command.
--- begin article ---
by Jeff Hunter, Sr. Database Administrator
Before attempting to dismount a filesystem, it must be inactive. If "any user" has one of the filesystem's directories as their current directory or has any file within the filesystem open, you will receive an error message, like the one below, when attempting to unmount the filesystem:
# umount /dev/dsk/c0t2d0s7
umount: /dev/dsk/c0t2d0s7: device is busy
Well, the fuser command to the rescue. The fuser command may be used to determine which files or directories within a filesystem are currently in use and to identify the processes and users that are using them. fuser is available on all major flavors of UNIX with the exception of Digital UNIX.
The fuser command can take two types of arguments:
normal filename: You can pass a normal filename or directory to the fuser command. In this case, it reports on that file or directory alone.
special disk: You can also pass in a special disk name as an argument to fuser. In this case, it reports on all files and directories within the corresponding filesystem.
You can use the -u option to the fuser statement to display the user ID's as well as PID's in its output.
Lets look at a few examples. The following command will display all processes and their associated users that are using files/directories on a specified disk on a Sun Solaris system:
# fuser -u /dev/dsk/c0t2d0s7
/dev/dsk/c0t2d0s7: 1313co(oracle) 1223c(root)
In the above example, there are two processes using the filesystem mounted on /dev/dsk/c0t2d0s7 (which in my example is the /db filesystem) at the time of running the command. The User ID's are root, and oracle. The c being printed after the PIDs indicate that this is their current directory.
You can use the -k option to kill all processes using the specified file or filesystem. In the following example, the UNIX PIDs 1313 and 1223 will be killed:
# fuser -k /dev/dsk/c0t2d0s7
/dev/dsk/c0t2d0s7: 1313co 1223c
In Linux, you can use the -m option to allow you to specify the filesystem by name. On Solaris and IRIX, the -c option performs the same task.
--- end article ---