Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am doing an nfs mount of a remotely exported filesystem. My problem is that when connection to the remote host is lost, any application on the client machine that attempts to reference the nfs filesystem (e.g `ls`) hangs for a very long time, at least several minutes. It stays hung until the nfs server comes back online. (I've never had the patience to see if it ever terminates the request with the server offline).
I need for this to NOT behave this way. I would like to get some kind of system error after e.g. 60 seconds or less.
I've tried setting mount options hard,intr, but intr is apparently deprecated.
hard or soft — Specifies whether the program using a file via an NFS connection should stop and wait (hard) for the server to come back online, if the host serving the exported file system is unavailable, or if it should report an error (soft).
If hard is specified, the user cannot terminate the process waiting for the NFS communication to resume unless the intr option is also specified.
If soft is specified, the user can set an additional timeo=<value> option, where <value> specifies the number of seconds to pass before the error is reported.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I think this is the reason that in Linux it is accepted to consider a mounted NFS drive as part of the local filesystem. There is no difference whether a mounted directory resides on the local hard disk or a connected network drive. It simply is guaranteed to be there.
This is opposed to --say-- Windows where "mapped network drives" are considered unreliable. Some applications (and Windows itself of course) simply refuse to perform some actions on a network drive. Even if you have a roaming profile, the profile folder is copied back and forth to the network at every start-up and shutdown. (Real nice if you have over 2GB of IE and Google cache)
But the guaranteed presence of the NFS drive comes with a price: your system hangs when it is not there. And I also think a "soft" mount allows the process to fail when the drive disappeared.
Well, I've been scared to do that because of multiple warnings all over the place including the nfs man page:
Quote:
NB: A so-called "soft" timeout can cause silent data corruption in certain cases. As such, use the soft
option only when client responsiveness is more important than data integrity. Using NFS over TCP or
increasing the value of the retrans option may mitigate some of the risks of using the soft option.
As I read it, the author states that it is not scary in all situations. So, yeah, that is less scary than scary in all situations.
An example where it is extremely scary is a MySQL server which uses an NFS mounted file system. You definitely don't want a table half updated. Note that MySQL transactions are atomic as seen by the client. But a transaction interrupted halfway during a write due to a file system error is different.
OTOH I have a NFS mounted drive where I store lots of data, but never process that data. Like disk images, backups, music and movies. No write action ever except for file copy. It is conceivable I could not care less if this file system is unreachable now and then. And much more irritating if my computer hangs due to such an event.
So you might want to consider for yourself if there is a risk for data corruption when you NFS is soft mounted and you get an I/O error instead of a frozen system.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.