How can I tell which users are making a mounted dev "busy"

Blair P. Houghton bph at buengc.BU.EDU
Fri Oct 20 23:33:15 AEST 1989


In article <12973 at boulder.Colorado.EDU> barbour at spot.colorado.EDU (BARBOUR JIM) writes:
>I am trying to write write a program (or script) which will alert persons
>on NFS filesystems served by my machine that the machine is being shut down.
>
>I don't need to worry about which machines are being served since we
>only export to one other machine.

If you did worry (we have from 11 to 14 machines on our NFS, depending
on the gremlin du jour, and baby do we ever worry :-) you'd use the
showmount(8nfs) command.

>However, I have not been able to figure out a way of determining who is
>"using" a given file system.  This could be anything from sitting in an nfs
>directory, to running a program on an nfs directory, to catting a file.

No, you should alert everyone logged onto the client machine.  Any time
after you shut down the server they may try to open something, and then
they're either stuck in "nfs server xxxxx not responding" purgatory, or
skipped right to process-crash hell, depending on how they've mounted
the imported file system.  Either way, it's no fun for them.

wall(1) comes in handy, if you remember to use rwalld(8c) so the
remote machines get the message.

(This is all Ultrix stuff.  I hope hp/ux is close enough that it helps.)

If you have root access to the client, you should also umount(8) the
nfs file's mount on the client, in case someone doesn't get the message,
doesn't understand the message, or wants to mess with their own minds...

Of course, you can't tell who may be sitting in a cwd that's being
imported, so you can't umount, so don't.  You'll just be leaving them
hanging, like they walked off a cliff in a Looney Tunes cartoon.

				--Blair
				  "Beep beep!"



More information about the Comp.unix.questions mailing list