how to see which files are open?

Paul S. Sawyer paul at unhtel.uucp
Fri Feb 23 14:32:00 AEST 1990


> I found myself wanting to umount a filesystem which as far as I could
> see no one was in (nor in another directory under it) but nevertheless,
> every time I tried to umount it I got "Device busy".  This was
> frustrating.  There must be a way to see what processes have which
> files open but nothing sprang to my eye when I did a 'man -k' of "files",
> "open", and "table".  Will someone please tell me what it is?  Please post
> (this is said in hopes of keeping the responses in the hundreds instead
> of the thousands).  Thanks!

On System V, it's /etc/fuser - - I don't know if there is a BSD equivalent.

You must be able to read /dev/kmem and /dev/mem, which means user root or 
group sys (on this system, anyway);  "/etc/fuser -u /dev/dsk/0s1" works, 
while "/etc/fuser -u /usr" does not seem to on this system, even though
TFM seems to indicate that it should.  (SysV.2.1)

A -k option will even kill those processes that are preventing the umount.


> -- 
> cole at unix.sri.com
> {hplabs,rutgers}!sri-unix!cole
-- 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Paul S. Sawyer              uunet!unh!unhtel!paul     paul at unhtel.UUCP
UNH Telecommunications        attmail!psawyer       p_sawyer at UNHH.BITNET
Durham, NH  03824-3523      VOX: 603-862-3262         FAX: 603-862-2030



More information about the Comp.unix mailing list