# How to setup timeout for nfs shares? [SOLVED]

## phoenix_me

I have some nfs shares, it takes forever on boot time when nfs server is unavailable. How can I setup in fstab (or in startup scripts) timeout for mount and unmount operation for nfs shares?

----------

## Plague.CZ

http://www.faqs.org/docs/linux_network/x-087-2-nfs.mountd.html

I believe that you want to use option "soft" to use a soft-mount (i.e. if no server available, just ignore the problem instead of waiting for it to come alive - which is good when having a system mounted externally). The timeout is by default low enoug, but the hard-mount by default made me a hard day  :Smile: 

----------

## drescherjm

I recommend "soft" mounts as well. I ended up doing that for all systems here at work because of an even worse problem. I mean if the nfs server goes down any machine that has it mounted would refuse to reboot or shutdown.

----------

## phoenix_me

You're right I was not able to reboot my machine with 'hard'. So I changed my fstab to 'soft'.

According to nfs (5) man:

soft - an NFS file operation has a major timeout then report an I/O error to the calling program.

But it doesn't tell you exactly how much take a 'major timeout' - is it 15 seconds or 2 minutes?, moreover it doesn't seems to be adjustable.

----------

## drescherjm

There are  timeo=n and retrans=n 

There is also retry=n

 *Quote:*   

> The  number of minutes that the mount(8) command retries
> 
>  an NFS mount operation in the foreground  or  background
> 
>  before  giving up.  If this option is not specified, the
> ...

 

To me it looks like retry is the only one you need. Although its resolution is in minutes.

----------

## Plague.CZ

Ummm, have you read the link?

 *Quote:*   

> timeo=n
> 
> This sets the time (in tenths of a second) the NFS client will wait for a request to complete. The default value is 7 (0.7 seconds). What happens after a timeout depends on whether you use the hard or soft option.

 

Because I used this (set to 30) on my machine...

----------

## phoenix_me

 *Plague.CZ wrote:*   

> Ummm, have you read the link?
> 
>  *Quote:*   timeo=n
> 
> This sets the time (in tenths of a second) the NFS client will wait for a request to complete. The default value is 7 (0.7 seconds). What happens after a timeout depends on whether you use the hard or soft option. 
> ...

 

I was reading this - but my understanding of "wait for a request to complete" was - wait if read/write request was sent (after mount was completed), and not a mount/umount command.

My networh shares take longer to mount than 0.7sec and I never have a timeout. So this proobably not for mount/umount commands.

----------

## phoenix_me

 *drescherjm wrote:*   

> There are  timeo=n and retrans=n 
> 
> There is also retry=n
> 
>  *Quote:*   The  number of minutes that the mount( command retries
> ...

 

It seems like you are right - probably I was skiped reading the description of this option because 'retry' match for me rather 'how many times' rather than 'how long'. 

I will try it - thanks.

----------

## phoenix_me

One more questions - little bit different but....

Gentoo (when booting) is waiting until nfs shares are mounted and then is executing the other init.d scripts, how can I mount nfs shares as bacground process?, so other init.d scripts can execute without waiting for nfs shares to be mounted.

----------

## drescherjm

rc_parallel="YES"

in your 

 /etc/rc.conf

Assuming you are using openrc and baselayout2

----------

## phoenix_me

 *drescherjm wrote:*   

> rc_parallel="YES"
> 
> in your 
> 
>  /etc/rc.conf
> ...

 

Thanks - I did a changes in rc.conf. I'll see the effect during next reboot.

----------

