Solved how do i skip mounting errors when executing fstab

Hi,

On a client I want to mount NFS folder on a server via /etc/fstab. There are times server is not available. So when the client machine boots it stop at mounting nfs. I have to go to the client console and press Ctl+C to interrupt the mounting process. There are cases I'm not around and need ssh to the client. So, how do I tell the system to quit mounting nfs after some tries and continue the booting?
Here is the nfs mounting entry in /etc/fstab of the client machine:
Code:
192.168.1.151:/nfsshare    /mnt/nfsshare    nfs    rw,soft,intr        0    0
Thanks.
 
A suggestion that may help some, is to add failok to the flags portion. What that option does, is it tells fstab that if it fails to mount, that it is ok and will continue on and not halt the machine. This doesn't mean it will try remounting later on it's own, just won't halt the bootup if it can't mount.

 
Use autofs(5)/automount(8) instead. failok is nice but then there's a risk your application will start running and write to a share that's not mounted. Or some other weird issues might happen because the share failed to mount during boot. Using autofs(5) you can get the NFS share to mount when someone or something tries to access it.
 
A suggestion that may help some, is to add failok to the flags portion. What that option does, is it tells fstab that if it fails to mount, that it is ok and will continue on and not halt the machine. This doesn't mean it will try remounting later on it's own, just won't halt the bootup if it can't mount.


As pointed out by the https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=186032, the faillok option is not honored. The bg option, however, can send the mounting to background, and the boot process continues. Not my desired way, though.
 
Use autofs(5)/automount(8) instead. failok is nice but then there's a risk your application will start running and write to a share that's not mounted. Or some other weird issues might happen because the share failed to mount during boot. Using autofs(5) you can get the NFS share to mount when someone or something tries to access it.

autofs is interesting. Just tried. So, I enable autofs in /etc/rc.conf, add a line in /etc/auto_master:
/mnt/nfsshare /etc/autofs_map

Add a line in /etc/autofs_map:
* -intr,nfsv3 192.168.1.151:/nfsshare/&

Then I create /etc/autofs/include, which is pretty much a copy of include_ldap. Reboot, from %sockstat I can see automountd and autounmountd are listening. Wierd thing(maybe just me) is, I can't see anything in /mnt/nfsshare, but i can %cd to the subdirectories of /mnt/nfsshare. How can I see what is in /mnt/nfsshare when %cd to it and execute %ls?
 
Wierd thing(maybe just me) is, I can't see anything in /mnt/nfsshare, but i can %cd to the subdirectories of /mnt/nfsshare. How can I see what is in /mnt/nfsshare when %cd to it and execute %ls?
This behaviour is by design and documented in auto_master(5):
Code:
A wildcard
     (‘*’) can be used for the key.  It matches every directory that does not
     match other keys.  Those directories will not be visible to the user
     until accessed.
If that is not desired, you'd probably have to create discrete mappings for your shares and avoid the use of the wildcard.
 
You typically use the * and & notations for home directories. For example,

Code:
/rhome /etc/autofs_map

Code:
* -intr,nfsv3 192.168.1.151:/rhome/&

Assuming users have /rhome/myname, anytime a user would login a /rhome/myname would get mounted from 192.168.1.151:/rhome/myname.

For 'static' mounts you use something like this:
Code:
/storage /etc/autofs_map
Code:
nfsshare -intr,nfsv3 192.168.1.151:/nfsshare
Now, anytime someone or something accesses /storage/nfsshare the share 192.168.1.151:/nfsshare gets mounted on it.

It's normal for /storage/nfsshare to not show up until it's mounted.
 
Back
Top