[CentOS] disable autofs timeout

Tue May 11 22:49:48 UTC 2010
Todd Denniston <Todd.Denniston at tsb.cranrdte.navy.mil>

Brian Mathis wrote, On 05/11/2010 10:35 AM:
> On Tue, May 11, 2010 at 10:01 AM, Rudi Ahlers <rudiahlers at gmail.com> wrote:
>> On Sat, May 8, 2010 at 5:12 PM, Brian Mathis <brian.mathis at gmail.com> wrote:
>>> A simple solution would be to setup a cron job that runs every 5
>>> minutes and does
>>>    ls /mount/point > /dev/null
>> How would this fix the problem though? I'm asking cause I sit with the same
>> problem, and haven't figured out yet to tell a remote server what todo if
>> the NFS server is unavailable (be it network problems, maintenance,
>> incorrect password, etc)
>>
>> Rudi Ahlers
> 
> It doesn't fix it -- it's an ugly workaround -- but it works to keep
> them mounted.  I don't know of an elegant solution if the NFS server
> goes away.  I've seen it hang the clients until they timeout.  Maybe
> an NFS expert on the list will be able to provide a better solution.

not an expert, only a user who has been singed a few times.
in the options for the mount I suggest: hard,intr

hard because soft has had some data loss issues for me.
intr because sometimes you need to be able to interrupt a process while a server is down (say to be
able to reboot the client box).

<near rant mode>
BTW, keeping the mount point busy pretty much invalidates the use of autofs IAW the OP, i.e., the
only benefit that you get from autofs at this point is that if the server is down at client boot
then the client will be able to finish booting (which could have been accomplished by using the bg
flag in the fstab (man 5 nfs)).
The OP wrote:
"2) utilize the benefits of autofs so that when an NFS resource becomes
unavailable, the system doesn't hang."


If the file system IS mounted, then the system will hang until you can interrupt processes (why you
need the intr option).
If the file system is not needed then it should be unmounted so it can't hang the client.

A less drastic option for autocompletion issues would be to set a longer timeout, i.e., in
auto.master change the line
from:
/misc  /etc/auto.misc
to:
/misc  /etc/auto.misc --timeout=3600
to get an hour between disuse and unmount (the default is 600 (man auto.master)).



If you really want permanent mounts, then I suggest going back to using fstab with the bg & intr
options and ignore autofs, because it appears autofs only causes trouble for you.

If you want the benefits of autofs (no hung mounts if not mounted during server interruptions, less
net traffic/connections when clients don't need remote file systems), you might be better served by
using a longer timeout and re-reading James Pearson's email.
</near rant mode>

BTW what applications are you having autocompletion issues with?  I have been using autofs for ~15
years and have only had issues with soft mounting causing data corruption.

-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter