Operating System - Linux
1820475 Members
2926 Online
109624 Solutions
New Discussion юеВ

How to check NFS mount connectivity?

 
yyghp
Super Advisor

How to check NFS mount connectivity?

I have NFS mount point connecting to the NFS server. I noticed that such NFS link is not stable enough for production usage, I would like to write a cron job to monitor the connectivity of such NFS mount point.
How to check it? What kind of command is good for this verification?
And if the NFS connection is broken, how to set the "Timeout", because it may hang the process. For example, if the NFS link is dead, and I use "bdf" or "ll" command, it will hang that session.
Thanks a lot!
4 REPLIES 4
Ivan Ferreira
Honored Contributor

Re: How to check NFS mount connectivity?

If you link is unreliable, use udp instead of tcp for mounting nfs directories. You can use rpcinfo -p remotehost to check the status of the nfs services, you should see rpc.mountd and rpc.nfsd. If the link is dead, not sure if the command will ever timeout, I used to use df -t fstype to check the file systems that are not nfs. The ls command will hang, you should force the umount if possible.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Sergejs Svitnevs
Honored Contributor

Re: How to check NFS mount connectivity?

I suggest you to use "soft" mount option in the fstab file. When a mount is a soft mount, an NFS request returns an error if it cannot be satisfied (for example, the server is down), then quits.

Regards
Muthukumar_5
Honored Contributor

Re: How to check NFS mount connectivity?

You will get NFS related errors in system logs. You can write a script to monitor the system log with string nfs (care ignore) will help.

mount -p will show the statistics as well.

--
Muthu
Easy to suggest when don't know about the problem!
Vipulinux
Respected Contributor

Re: How to check NFS mount connectivity?

Hi

You can also increase the number of nfs sessions on the server to make it more reliable.

Cheers