Who's got files open on /dev/xxx

Who's got files open on /dev/xxx

Post by Sherwood Botsfo » Thu, 15 Oct 1992 09:52:56



A while back someone was looking for a tool to find what  
files were open on a device.

The answer came back: lsof seemed to be the recommended  
choice.

However lsof doesn't handle nfs files.  e.g.  I'm on a  
server; suddenly the disk goes snake.  I want to know what  
process is doing this.

Or;
        I'd like to unmount a partition.  I get a "device  
busy"  How do I find out who has a cwd on that partition?

 
 
 

Who's got files open on /dev/xxx

Post by Peter Van E » Thu, 15 Oct 1992 12:06:45



>A while back someone was looking for a tool to find what  
>files were open on a device.
>The answer came back: lsof seemed to be the recommended  
>choice.
>However lsof doesn't handle nfs files.  e.g.  I'm on a  
>server; suddenly the disk goes snake.  I want to know what  
>process is doing this.

It doesn't? Could have fooled me (unless I misunderstand your question):

csh       11873   vanepp  cwd    DIR    18,   5       6656  84022 /staff2 (catacomb-e2.sfu.ca:/staff2)

This is one line (that happens to be my home directory) from the lsof2B (beta)
version running on a Silicon Graphics machine. /staff2 is NFS mounted from
our Auspex file server. It is possible the non beta lsof doesn't find this
(but then it didn't run on the SGI's either). The same thing works on a Sun.
fuser is another way to find the same thing on the SGI, but it doesn't seem
to work on the Sun.

On the same SGI as above.

fuser catacomb-e2.sfu.ca:/staff2

catacomb-e2.sfu.ca:/staff2:    11873c   12960c   12960   12744c    5098c    5098   12516c   11946c   11946   25274c   12749c   12959c

Peter Van Epp / Operations and Technical Support
Simon Fraser University, Burnaby, B.C. Canada

 
 
 

Who's got files open on /dev/xxx

Post by Barry Margol » Fri, 16 Oct 1992 02:31:15



Quote:>However lsof doesn't handle nfs files.  e.g.  I'm on a  
>server; suddenly the disk goes snake.  I want to know what  
>process is doing this.

Someone else tried to refute this, but apparently missed the clause "I'm on
a server".

Sorry, but the NFS protocol doesn't provide the information for a server to
know which client process is performing each access; there's no processid
in NFS requests.  And kernel-based, stateless NFS servers don't open files,
they just access the files directly for each request (the NFS file handle
includes device and inode information).

When this happens here we use the PD tools nfswatch and/or tcpdump to find
the client machine that's hammering the server.  I then use tcpdump to get
a hex dump of the NFS packets from that client and find the userid.  Then I
use ps on the client machine to look for active processes of that user.

If the author of nfswatch is reading this, I suggest that it provide a mode

--
Barry Margolin
System Manager, Thinking Machines Corp.


 
 
 

Who's got files open on /dev/xxx

Post by Sherwood Botsfo » Fri, 16 Oct 1992 02:25:19


I guess I didn't make myself clear.  
aardvark mounts /dev/sd1a as /home
aardvark exports /home
badger,cougar,et all mount /home.

JRandomUser is working on badgar.  His home directory is  
/home/jru.

If I'm on aardvark, and type
lsof /dev/sd1a
I only get entries for processes running on aardvark.

If I explicitly ask for NFS files
lsof -N
I get all the NFS files that aardvark has open from other  
servers.


writes:

> >A while back someone was looking for a tool to find what  
> >files were open on a device.

> >The answer came back: lsof seemed to be the recommended  
> >choice.

> >However lsof doesn't handle nfs files.  e.g.  I'm on a  
> >server; suddenly the disk goes snake.  I want to know  
what  
> >process is doing this.

> It doesn't? Could have fooled me (unless I misunderstand  
your question):

> csh       11873   vanepp  cwd    DIR    18,   5        

6656  84022 /staff2 (catacomb-e2.sfu.ca:/staff2)
Quote:

> This is one line (that happens to be my home directory)  

from the lsof2B (beta)
Quote:> version running on a Silicon Graphics machine. /staff2 is  
NFS mounted from
> our Auspex file server. It is possible the non beta lsof  
doesn't find this
> (but then it didn't run on the SGI's either). The same  

thing works on a Sun.
Quote:> fuser is another way to find the same thing on the SGI,  
but it doesn't seem
> to work on the Sun.

> On the same SGI as above.

> fuser catacomb-e2.sfu.ca:/staff2

> catacomb-e2.sfu.ca:/staff2:    11873c   12960c   12960    

12744c    5098c    5098   12516c   11946c   11946   25274c    
12749c   12959c

Quote:

> Peter Van Epp / Operations and Technical Support
> Simon Fraser University, Burnaby, B.C. Canada

--
=> Sherwood Botsford                    

=> University of Alberta         Lab Manager, Space Physics  
Group <=        
=> tel:403 492-3713                             fax: 403  
492-4256 <=        
 
 
 

1. Arpresolve error: can't allocate llinfo for xxx.xxx.xxx.xxx

Sounds like arplookup can't allocate an ARP entry for this IP address.  I
don't know which version of FreeBSD that you are running or how you
configured the kernel.  Is the router very busy?  Might try recompiling
the kernel with "maxusers" set to 256 and/or increasing the values of
"NBUF" and "NMBCLUSTERS" in the conf file.

Some diagnostics that you might want to post are "vmstat -m", "netstat -m"
"arp -a", "netstat -nr".  Check how big your ARP table is getting and
how many routing table entries the machine is accumulating.


2. Linux failed with US Robotics E71 setting

3. paging and raid harddisk.

4. Netstat returns IP= xxx.xxx.xxx.xxx.blackjack what's up?

5. Setting a password from a script file

6. question: Who is xxx.xxx.xxx.xxx tell xxx.yyy.yyy.zzz

7. Read man pages (redhat 6.2)

8. These "ICMP redirect from xxx.xxx.xxx.xxx" errors

9. Installation freezing at "Add default route xxx.xxx.xxx.xxx" with NE2000 card

10. kernel: ICMP: xxx.xxx.xxx.xxx: Source route failed

11. Telnet xxx.xxx.xxx.xxx 25

12. ICMP: xxx.xxx.xxx.xxx Source Route Failed ?