[KLUG Members] determining what is using a resource

Adam Williams members@kalamazoolinux.org
21 Mar 2002 07:30:42 -0500


>>I have had times when I am trying to accomplish
>>something (like unmounting a drive or running a
>>program that needs to use the sound card) and I get an
>>error that something is using the device
>>/dev/thedevicename.  How can I determine what process
>>on the computer is using the device so that I can get
>>it to release?  
>To find what files are being used in a directory so you can unmount 
>it, you can use use the "fuser -m /mnt/dir" command to list all the
>processes that have open files in that directory tree.  (then stop 
>or kill the processes)  "fuser" has other useful options too, see
>the man page.
>As far as other device files, you'll have to be more specific.

See ftp://ftp.kalamazoolinux.org/pub/pdf/debugging2001.pdf for
information on fuser and its cousins.  We have lots of good stuff on our
Past Presentations page - http://www.kalamazoolinux.org/presentations/

If you use a drive mount applett (in GNOME) it does make it harder to
screw these things up,  or else one often mounts while su-ed or su-s
while on the removable device and leaves a shell with its PWD on that
device behind,etc..  Closing all the terminal windows is a good way to
be able to unmount a stuck device (for me at least) because it is easy
to leave a process behind.