Operating System - HP-UX
1834665 Members
2356 Online
110069 Solutions
New Discussion

/var/statmon/sm directory

 
SOLVED
Go to solution

/var/statmon/sm directory

Hello,

I am trying to find out what /var/statmon directory and subdirs sm, sm.bak are related to. Anyone knows and can explain?

thanks,
/Marius
hi
2 REPLIES 2
S.K. Chan
Honored Contributor
Solution

Re: /var/statmon/sm directory

In a nutshell this directory is used by NFS file locking mechanism particularly rpc.lockd and rpc.statd daemons between the NFS server and clients. In order to understand it fully, you got to understand how the network lock manager works. These sequences of events happening when a NFS client opens a NFS mounted file highlights how /var/statmon is used for this purpose (take note steps 3,8 & 17)
1- Application on client requests a lock on an NFS mounted file & contacts local kernel.
2- Kernel forwards request to local lockd.
3- Client lockd contacts local statd that it's going to perform NFS file locking and statd should add this client to the list of systems it monitors. Statd does this by creating a file in /var/statmon/sm directory.
4- Statd replies to lockd that it has added the client to its list of monitored systems.
5- Client lockd contacts server's portmap "which port number is your lockd running on?"
6- Server portmap replies with the port number.
7- Client lockd sends lock REQUEST to server lockd.
8- Server lockd contacts local statd that client system is going to perform NFS file locking with this server. The server statd add NFS client to /var/statmon/sm.
9 - Server statd replies to server lockd "step 8 done!"
10- Server lockd forward lock request to kernel.
11- Server kernel performs lock request and replies to lockd with the status.
12- Server lockd contacts client portmap "which port number is your lockd running on?"
13- Client portmap replies with the port number.
14- Server lockd sends the lock RESULT back to client lockd.
15- Client lockd forwards result back to kernel.
16- Client kernel forwards result back to requesting application.
17- When NFS server rebooted (or rpc.lockd/statd killed & restarted) the statd daemon will go through a recovery process to try rebuild the queue of locks the server was managing. The recovery process will do this :-
a) Server statd moves all files in /var/statmon/sm into /var/statmon/sm.bak
b) One at a time server statd will attempt to contact client statd whose hostname matches the name of the file in /var/statmon/sm.bak
c) If successful, the file is removed from /var/statmon/sm.bak
d) Statd on client will contact its local lockd and explain that the server crashes and the client must reclaim any locks it had with that server prior to the crash.

Re: /var/statmon/sm directory

Thanks a lot. 10 points.
/Marius
hi