# Remote FS doesn't mount on boot if fqdn is in use



## mallniya (Oct 13, 2016)

Hello,

I've been trying to make FreeBSD mount following entry in /etc/fstab on boot:

```
nfs.domain:/spool                /nfspool        nfs     rw,bg,noatime   0 0
```

It doesnt work until I use IP like this:

```
10.6.0.1:/spool                /nfspool        nfs     rw,bg,noatime   0 0
```

`host nfs.domain` gives 10.6.0.1 and `mount -t nfs nfs.domain /spool` works just fine. I'm pretty sure that putting nfs.domain in /etc/hosts will do either.

As said at https://www.freebsd.org/doc/handbook/network-nfs.html there is 
	
	



```
nfs_client_enable="YES"
```
 in my /etc/rc.conf.

There is not much of this in the net, but there is an opinion I stumble upon, that one should use IP addresses always, when it comes to an NFS.
IMHO it's not convenient and seems like a bug for me (or some sort of architectural design, that's not allowing to resolve fqdn to IP while booting). Is there a solution to use fqdn and not IP and have nfs mounted at boot?

Thanks.


----------



## SirDice (Oct 13, 2016)

Try adding the late option. That will cause it to be mounted much later during the boot process. 



mallniya said:


> There is not much of this in the net, but there is an opinion I stumble upon, that one should use IP addresses always, when it comes to an NFS.


I've really only ever used IP addresses. Mainly to prevent issues like this. It should work though, provided name resolving works correctly. It will add a slight delay though, as it needs to resolve the hostname before it's able to mount the filesystem. Are there any errors in /var/log/messages? Something like not being able to resolve or not able to connect?

The nfs_client_enable shouldn't be needed but won't hurt or cause issues. As soon as the system figures out it's an NFS share it needs to mount the appropriate services will get started automatically.


----------



## kpa (Oct 13, 2016)

Put nfs.domain into /etc/hosts and it should work. The problem is that DNS resolution may not be available at the time the system is configuring the NFS mounts.


```
10.6.0.1 nfs.domain nfs
```

Edit: Definitely try the late option as well, this should defer the mounting until DNS is available.


----------



## mallniya (Oct 14, 2016)

No messages related to nfs or name resolution pops up or in /var/run/dmesg.boot or /var/log/messages, but:

```
rpc.umntall: nfs.domain: MOUNTPROG: RPC: Unknown host
Mounting late file systems:mount_nfs: nfs00.profile.rambler.ru: hostname nor servname provided, or not known
.
```
pops in console. I have to use `set console=vidconsole` at boot prompt to see it.
`late` option makes server to end up in single mode while boot and adds the following to the output in console:

```
Mounting /ets/fstab filesystems failed, startup aborted
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
date host init: /bin/sh on /etc/rc terminated abnormally, going to single user mode
```


----------



## SirDice (Oct 14, 2016)

mallniya said:


> `late` option makes server to end up in single mode while boot and adds the following to the output in console:
> 
> ```
> Mounting /ets/fstab filesystems failed, startup aborted
> ...


That probably means you've added it incorrectly. Can you show us how you added it?


----------

