# NFSv4 mount problems



## getopt (Oct 3, 2014)

On the nfs-server with /etc/exports

```
#cat /etc/exports
V4: / -sec=sys -network xxx.xxx.xxx/24
/FreeBSD/src -sec=sys -ro -alldirs -network xxx.xxx.xxx/24
/FreeBSD/obj -sec=sys -alldirs -network xxx.xxx.xxx/24
```
I do 

```
#rpcbind -h xxx.xxx.xxx.95
#mountd -h xxx.xxx.xxx.95 -p 866 -Sl
#nfsuserd
#nfsd -h xxx.xxx.xxx.95 -t
```
With these results:

```
#sockstat -4l | grep -E 'nfs|mount|rpc'
root     nfsd       21769 5  tcp4   xxx.xxx.xxx.95:2049     *:*
root     nfsuserd   21768 3  udp4   *:833                 *:*
root     nfsuserd   21767 3  udp4   *:833                 *:*
root     nfsuserd   21766 3  udp4   *:833                 *:*
root     nfsuserd   21765 3  udp4   *:833                 *:*
root     nfsuserd   21763 3  udp4   *:833                 *:*
root     mountd     21761 5  udp4   127.0.0.1:866         *:*
root     mountd     21761 6  udp4   xxx.xxx.xxx.95:866      *:*
root     mountd     21761 7  tcp4   127.0.0.1:866         *:*
root     mountd     21761 8  tcp4   xxx.xxx.xxx.95:866      *:*
root     rpcbind    21759 6  udp4   127.0.0.1:111         *:*
root     rpcbind    21759 7  udp4   xxx.xxx.xxx.95:111      *:*
root     rpcbind    21759 8  udp4   *:773                 *:*
root     rpcbind    21759 9  tcp4   127.0.0.1:111         *:*
root     rpcbind    21759 10 tcp4   xxx.xxx.xxx.95:111      *:*
```
On the nfs-client:

```
#showmount -e xxx.xxx.xxx.95
Exports list on xxx.xxx.xxx.95:
/FreeBSD/src                      xxx.xxx.xxx.0
/FreeBSD/obj                      xxx.xxx.xxx.0

#mount -t nfs -o nfsv3 xxx.xxx.xxx.95:/FreeBSD/src /FreeBSD/src/
#mount -p | grep src
xxx.xxx.xxx.95:/FreeBSD/src /FreeBSD/src          nfs     rw              0 0
```
NFSv3 works.
But NFSv4 does not work:

```
#umount /FreeBSD/src/
#mount -t newnfs -o nfsv3 xxx.xxx.xxx.95:/FreeBSD/src /FreeBSD/src/
mount: xxx.xxx.xxx.95:/FreeBSD/src: Operation not supported by device
#mount -t nfs -o nfsv4 xxx.xxx.xxx.95:/FreeBSD/src /FreeBSD/src/
[tcp] xxx.xxx.xxx.95:/FreeBSD/src: NFSPROC_NULL: RPC: Program/version mismatch; low version = 2, high version = 3
[tcp] xxx.xxx.xxx.95:/FreeBSD/src: NFSPROC_NULL: RPC: Program/version mismatch; low version = 2, high version = 3
^C
#freebsd-version
10.0-RELEASE-p9
```


```
#rpcinfo xxx.xxx.xxx.95
   program version netid     address                service    owner
    100000    4    tcp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    3    tcp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    2    tcp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    4    udp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    3    udp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    2    udp       xxx.xxx.xxx.95.0.111     rpcbind    superuser
    100000    4    local     /var/run/rpcbind.sock  rpcbind    superuser
    100000    3    local     /var/run/rpcbind.sock  rpcbind    superuser
    100000    2    local     /var/run/rpcbind.sock  rpcbind    superuser
    100005    1    udp       0.0.0.0.3.98           mountd     superuser
    100005    3    udp       0.0.0.0.3.98           mountd     superuser
    100005    1    tcp       0.0.0.0.3.98           mountd     superuser
    100005    3    tcp       0.0.0.0.3.98           mountd     superuser
    100003    2    tcp       0.0.0.0.8.1            nfs        superuser
    100003    3    tcp       0.0.0.0.8.1            nfs        superuser
```

1. I am not sure if  /etc/exports is correct.
2. How can the running NFS-Version of the server be determined?
3. Why does `mount –t newnfs` not work?
4. Why does RPC shout Program/version mismatch?


----------



## junovitch@ (Oct 4, 2014)

getopt said:
			
		

> 1. I am not sure if  /etc/exports is correct.


Kind of vague by the man page describes checking it.  See the exports() man page.


> The mountd(8) utility can be made to re-read the exports file by sending
> it a hangup signal as follows:
> 
> /etc/rc.d/mountd reload
> ...





			
				getopt said:
			
		

> 2. How can the running NFS-Version of the server be determined?


`sysctl -a | grep vfs.nfsd.server`



			
				getopt said:
			
		

> 3. Why does `mount –t newnfs` not work?


I think it's either nfs or oldnfs.



			
				getopt said:
			
		

> 4. Why does RPC shout Program/version mismatch?


Do you also have the following line in your rc.conf() to enable NFSv4?

```
nfsv4_server_enable="YES"
```


----------



## junovitch@ (Oct 4, 2014)

*Re: [Solved] NFSv4 mount problems*

What rules did you end up needing on the client?  Did you need to muck around with scrub rules?  The pf.conf man page describes specific guidelines because NFS expects certain fragment handling that pf can interfere with.


----------



## junovitch@ (Oct 5, 2014)

I'm not sure about the mountd portion.  It might be something specific to FreeBSD's implementation as /etc/rc.d/nfsd forces running it.  After searching around some Red Hat docs talk about it still being required just not used for anything over the wire.  The same might apply here.  NFSv4 does get around needing rpc.statd and rpc.lockd.  Where I use it I don't enable those services and set the minimum version to NFSv4.  See if your clients show up connected with NFSv4 with an `nfsdumpstate`.


----------

