[comp.sys.hp] How can I tell which users are making a mounted dev "busy"

barbour@spot.colorado.EDU (BARBOUR JIM) (10/19/89)

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.

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.

Any suggestions would be greatly appreciated. You may post or mail responses to:

	barbour@spot.Colorado.EDU

Jim Barbour - Student Systems Administrator - University of Colorado at Boulder

bph@buengc.BU.EDU (Blair P. Houghton) (10/20/89)

In article <12973@boulder.Colorado.EDU> barbour@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!"

barbour@boulder.Colorado.EDU (BARBOUR JIM) (10/20/89)

Thanks for all the responses to my queary about nfs shutdowns.

They have mostly fallen into two (2) catagories.

> Try fuser.

Fuser is a wonderful program, but it doesn't work with nfs mounted file systems.
i.e. I can't specify a device and specifying the root directory of the file
system tells you *ONLY* if there is someone actually using that particular
directory.

> try ofiles.

I haven't run accross an ofiles which will compile on hp-ux.

Someone made a very good reply which said in part:

> If you have root access on the client, you should umount the file system.

s/he is right, however, I can not do that if someone is using the nfs file
system.  I get a message like "umount (2) on /alta: device busy"
so what I want to do is kill of those processes.

Any other suggestions are greatly appreciated.

Jim Barbour -- Student systems administrator HP-UX -- University of Colorado...