How can I get an nfs mount in fstab to use the bg option to mount a server when it eventually comes up

9,224

I think what you really want to use is auto mounting. Auto mounts only mount when they are needed and dismount when inactive. They also "solve" the problem you are seeing as long as you don't try to access the remote mount until the server is up.

See the Ubuntu Community Docs on Autofs for more information on setting it up.

Share:
9,224

Related videos on Youtube

Oxwivi
Author by

Oxwivi

Updated on September 17, 2022

Comments

  • Oxwivi
    Oxwivi 9 months

    I've got an NFS server and several NFS clients, if I reboot the server, then when the client comes up (if the server is unavailable), I can get it to either skip the NFS mount or prompt me to ask how to continue.

    However in man nfs it talks about a bg option, which should fork the mount to the background and retry the connection periodically (dmesg says every 90 seconds). When I try that, the client skips the non-existent server, but never seems to retry the connection when the server does come up.

    How can I make it work? This is my fstab setting:

    server:/var/www /var/www nfs rsize=8192,wsize=8192,timeo=14,intr,bg,retry=100,nobootwait 0 0
    

    Any ideas?

    • João Pinto
      João Pinto over 12 years
      Probably mountall, the utility which takes care of mounting the partitions during boot, does not handle "bg" as it should. Better file a bug report for it.
  • carlitos081
    carlitos081 over 12 years
    Unfortunately I looked at that, but it won't fit our needs. The Client in question is an apache server, which will be under considerable load. The mount concerned is /var/www which has several websites and their compatriot data directories and a number of the sites have Scripts which run periodically. What I don't want is another sleeping process using up valuable resources, when all I need is a single folder mounting, I also don't want to have to create symlinks to /net on multiple machines, so that I can 'see' otherwise unmounted folders.
  • jwernerny
    jwernerny over 12 years
    I'm not sure why you would need symlinks to /net. Autofs can be setup for auto-mounting anywhere. For example, I auto-mount several shared drives to common points on the Linux boxes on my network: one goes to /mnt/public, another to /var/lib/mythtv/recordings, another to /var/lib/mythtv/videos, etc... These are all defined in auto.data. I never use /net unless I am doing a temporary or one-time mount. As for load, I am not convinced that this will cause that much of an increase, but YMMV. It's old tech from the days when 256Meg was a lot of RAM.