# mount NFS share before log on



## net_tech (Sep 23, 2016)

Hello,

Is there a way to automate the mount  of an NFS share during the OS startup, but before the log in?

Currently I am using `mount -v x.x.x.x:/nfsshare /mnt/nfsshare`, which I am guessing needs some tweaking before it could be added to fstab? (not even sure if fstab is where it needs to go)

Thank you


----------



## kpa (Sep 23, 2016)

Put them in fstab(5) but use the late option to defer the mounts until networking and services are fully up.


----------



## net_tech (Sep 23, 2016)

like this ?

```
x.x.x.x:/nfsshare  /nfsshare  nfs rw 2 2  late
```


----------



## net_tech (Sep 23, 2016)

well, adding 
	
	



```
x.x.x.x:/nfsshare  /nfsshare  nfs rw 2 2  late
```
 to fstab prevents BSD from booting, however I was able to remove the code using the recomendation from this thread https://forums.freebsd.org/threads/11348/page-2


----------



## tobik@ (Sep 24, 2016)

net_tech said:


> like this ?


No, late goes after rw. Like this (see fstab(5)):

```
x.x.x.x:/nfsshare  /nfsshare  nfs rw,late 0 0
```
IMHO a nicer way is to set up autofs(5) to mount the share on demand. See https://www.freebsd.org/doc/handbook/network-nfs.html#network-autofs.
It's easy to setup if you keep it simple and use the default /net automounter map. Your share is then accessible in /net/x.x.x.x/nfsshare.


----------

