I have a somewhat interesting setup: A server with multiple remote NFS servers mounted in a folder, with that folder then being re-exported over Samba. Think of it as a share proxy, keeping all the shared folders in one place.

My issue though is that whenever one of the mounts goes down (server restarted, service restarted, external hard drive that the server was exporting removed, etc) any attempt to read the mount blocks forever. This also means that running ls in that directory freezes and users connecting over Samba also freeze. This has also caused a few times one of my cron jobs to block which almost crashed the server because it had hundreds of blocked processes. This is getting very annoying as I usually have to bring up a terminal that isn't waiting for ls to finish (can't cancel it), run for i in *; do sudo umount -l -f $i; done;, hope that it works, fix the issue, then remount everything.

Is there a way to mount an NFS share with the stipulation that if the connection fails for whatever reason (preferably with a retry period) then the mount un-mount's itself or at least doesn't block?

  • Can you post /etc/fstab?
    – Karlson
    Feb 17, 2012 at 18:55

1 Answer 1


Normally when mounting NFS it's a good idea to have flags set similar to this:

   bg      If  the  first  NFS  mount  attempt times out, retry the mount in the 
           background.  After a mount operation is backgrounded, all subsequent mounts
           on the same NFS  server  will  be  backgrounded immediately, without first
           attempting the mount.  A missing mount point is treated as a timeout, to
           allow for nested NFS mounts.
   soft    If  an  NFS  file operation has a major timeout then report an I/O error
           to the calling program.  The default is to continue retrying NFS file
           operations indefinitely.
   intr    If  an  NFS  file  operation  has  a major timeout and it is hard mounted,
           then allow signals to interupt the file operation and cause it to return
           EINTR to the calling program.  The default is to not allow file operations
           to be interrupted.

You can in addition set:


which should allow the NFS mount to timeout and make the directory inaccessible if the NFS server drops the connection rather then waiting in retries.

Take a look at this link for more information about NFS mount options

  • using only bg,intr,soft still leaves a hang of 120 seconds in Fedora 20. But adding timeo=5,retrans=5,actimeo=10,retry=5 makes it nice and quick. Thanks! Jun 19, 2014 at 18:17
  • 6
    "The intr / nointr mount option is deprecated after kernel 2.6.25. Only SIGKILL can interrupt a pending NFS operation on these kernels, and if specified, this mount option is ignored to provide backwards compatibility with older kernels." "This option is provided for backward compatibility. It is ignored after kernel 2.6.25." May 2, 2016 at 23:46
  • 1
    @DavidC.Bishop where is that quote from? Can you give a link? Thanks.
    – a06e
    Oct 4, 2016 at 18:06
  • 3
    @becko: The SIGKILL quote is from the nfs man page (just search down for 'nointr'). The newer versions, such as the one on my system now simply read "This option is provided for backward compatibility. It is ignored after kernel 2.6.25." linky. Oct 9, 2016 at 1:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .