NFS - File system issue on client when server is gone

Hi Guys,

I have a question on a issue that follows us for years, and we have never stopped to think about how to fix.

We have many NFS clients using a NFS server for backup purposes. The clients runs cPanel, and we see that when the NFS server have some problem for any reason, like hardware failure, nfs service is down, network issue or whatever, it happens that the client cannot see the /backup anymore, and if you do a "df -h" the shell is stuck. Other issues are that we cannot create any account on cPanel, the server start to be loaded, Webmail crashes, etc.

My question is, how do I set the fstab on clients to mount the NFS partition in a way that anything that happens to the server, the partition is either unmounted or anything that could not affect the client OS ?

Thank you !
maxihostAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ThomasMcA2Commented:
Try adding _netdev (the 1st character is an underscore/underline) to the Options section of the fstab entries.
0
maxihostAuthor Commented:
Like this ?

189.1.174.XXX:/backup/lvmh4     /backup nfs     _netdev        0 0
0
maxihostAuthor Commented:
I dont think thats what we are looking for.

From https://help.ubuntu.com/community/NFSv4Howto
where the auto option mounts on startup and the _netdev option can be used by scripts to mount the filesystem when the network is available. Under NFSv3 (type nfs) the _netdev option will tell the system to wait to mount until the network is available. With a type of nfs4 this option is ignored, but can be used with mount -O _netdev in scripts later. Currently Ubuntu Server does not come with the scripts needed to auto-mount nfs4 entries in /etc/fstab after the network is up.
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

ThomasMcA2Commented:
Perhaps the "shell is stuck" as you described because the client is still trying to connect to a network device that it does not know is a network device, and _netdev tells the system that it is a network device.

It's worth a try.
0
Seth SimmonsSr. Systems AdministratorCommented:
_netdev is used for startup to ensure the network is up before it tries to mount; this is not the question that was asked

the question is what if something happens after the system is running and ends up with a stale nfs mount - how to recover

a bit difficult to try this automatically; you might be able to check for a stale mount with a script but you would have to run it often to detect it.  if it recovers on it's own then the mount would recover, but the process might not.  doing a umount -l (lazy unmount) on that mount point will remove it safely so df won't hang
0
robocatCommented:
Why not use autofs?

The remote filesystem will only be (auto)mounted when it's being used and unmounted when not used.

If the nfs server becomes unavailable, this will only influence clients that are actually using the nfs mount at that time.
0
maxihostAuthor Commented:
Guys,

I have contacted cPanel and their suggestion was,

My first suggestion would be to put NFS mounts into a dedicated sub-directory below the root directory, for example, using the existing '/mnt' directory then mount the NFS share as '/mnt/backup' there or whatever you want the mount name to be. This will prevent some processes and scripts which perform lstat() calls on the contents of the root directory from hanging on the NFS mount if it were directly mounted to a location in the root directory.

I would also recommend mounting the NFS mount with the 'soft' option, and using the 'retrans' and 'timeo' options to tune the retransmission and I/O time-outs to fit your needs. The 'nfs' manual page (man nfs) provides details about what these options do. Please keep in mind that such NFS mounts are only suitable for purposes such as a backup storage location, not database storage, home directories, etc.

What do you think ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SandyCommented:
Agree with Cpanel's suggestion but i doubt putting _netdev along with this will work.

TY/SA
0
maxihostAuthor Commented:
Found solution contacting cPanel.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.