How can I find out who is on a filesystem when I can't umount it?

Tom Christiansen tchrist at convex.COM
Fri Mar 1 08:22:53 AEST 1991


>From the keyboard of fredrick at acd.acd.ucar.edu (Tim Fredrick):
:We have a CDROM on our Sun SPARCstation where I constantly have the problem
:where umount yields:
:
:  umount /cdrom
:  /cdrom: Device busy
:
:How can I find out what process is using that filesystem, and is there a
:way to force the umount to happen anyway?  So far I've had to reboot the
:system each time.  --Tim

You can use fuser(missed'em five), ofiles(public domain), or fstat(l^Hbsd).
Of these, the last seems the nicest to use, as it does these things:

    given a partition, find out what's open there
    given a proc, find what files (including pipes etc) it has open
    given a file, find what procs has it open
    give a user, find out what file he has open
    trace down netstat -aA output to a given process
    plus more

You can get fstat from the bsd sources on uunet, but that won't work 
for suns.  I got my sun version from Vic Abell, abe at mace.cc.purdue.edu,
that he posted to comp.sources.something a couple years ago.

This should really go in the FAQ.

--tom
--
"UNIX was not designed to stop you from doing stupid things, because
 that would also stop you from doing clever things." -- Doug Gwyn

 Tom Christiansen                tchrist at convex.com      convex!tchrist



More information about the Comp.unix.questions mailing list