Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I've set my Raspberry Pi up as an NFS server, but I cannot connect to it with NFS version 4. However, version 3 works. From my Kubuntu 13.04 client:

$ sudo mount -t nfs -o proto=tcp,port=2049,vers=4 192.168.1.91:/export /mnt/pi -v
mount.nfs: timeout set for Tue Sep 17 09:47:26 2013
mount.nfs: trying text-based options 'proto=tcp,port=2049,vers=4,addr=192.168.1.91,clientaddr=192.168.1.7'
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 192.168.1.91:/export
$ sudo mount -t nfs -o proto=tcp,port=2049,vers=3 192.168.1.91:/export /mnt/pi -v
mount.nfs: timeout set for Tue Sep 17 09:47:31 2013
mount.nfs: trying text-based options 'proto=tcp,port=2049,vers=3,addr=192.168.1.91'
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.91 prog 100005 vers 3 prot TCP port 35976

From the server, it seems that NFS version 4 is compiled in the kernel.

$ rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  51953  status
    100024    1   tcp  42383  status
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049
    100227    3   tcp   2049
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049
    100227    3   udp   2049
    100021    1   udp  41873  nlockmgr
    100021    3   udp  41873  nlockmgr
    100021    4   udp  41873  nlockmgr
    100021    1   tcp  35095  nlockmgr
    100021    3   tcp  35095  nlockmgr
    100021    4   tcp  35095  nlockmgr
    100005    1   udp  60943  mountd
    100005    1   tcp  44936  mountd
    100005    2   udp  52342  mountd
    100005    2   tcp  56312  mountd
    100005    3   udp  57888  mountd
    100005    3   tcp  35976  mountd

==EDIT==

Server logs at /var/log/messages are unchanged for both attempts. Server logs at /var/log/syslog are unchanged for unsuccessful v4 attempts, but are appended for successful v3 attempts, as follows.

Sep 17 21:48:27 raspberrypi rpc.mountd[24098]: authenticated mount request from 192.168.1.7:1021 for /export (/export)
Sep 17 22:09:12 raspberrypi rpc.mountd[24098]: authenticated mount request from 192.168.1.7:790 for /export (/export)
Sep 17 22:09:51 raspberrypi rpc.mountd[24098]: authenticated mount request from 192.168.1.7:1002 for /export (/export)

Oddly enough, it seems like the port is changing, despite me specifying 2049?

==EDIT== Contents of server's /etc/export

/export       192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async,crossmnt)
share|improve this question
    
have you tried simple: "sudo mount -t nfs4 192.168.1.91:/export /mnt/pi -v" ? –  lenik Sep 17 '13 at 4:13
    
@lenik, yes, sorry, I should have mentioned. I get similar errors as above, except without proto=tcp,port=2049,vers=4 in the second line. –  Sparhawk Sep 17 '13 at 11:50
    
please update your question with log output of /var/log/messages or /var/log/syslog –  gurcanozturk Sep 17 '13 at 12:02
    
@gurcanozturk from the client or server? (or both?) –  Sparhawk Sep 17 '13 at 12:06
    
@Sparhawk server logs. –  gurcanozturk Sep 17 '13 at 12:10

1 Answer 1

NFS uses IP/Hostname based security so that means you should give permission on NFS server to clients. Permissions should be defined at /etc/exports file. Example /etc/exports file:

# Path          Client IP (options)
/BACKUP/DATA    192.168.1.4(rw,no_root_squash,sync,crossmnt,fsid=1)
/BACKUP/MOVIES  192.168.1.6(rw,no_root_squash,sync,crossmnt,fsid=1)

After editing /etc/exports file you should run 'exportfs -ra' command to re-read exports file by NFS server daemon. Then try to mount;

on client 192.168.21.4;

mount -t nfs -o vers=3 192.168.1.91:/BACKUP/DATA /mnt/pi/DATA -v

on client 192.168.1.6

mount -t nfs -o vers=3 192.168.1.91:/BACKUP/DATA /mnt/pi/MOVIES -v

You should watch your log files and try to understand what happening via tail command like below.

tail -f /var/log/syslog
tail -f /var/log/messages

Log outputs should give clue.

Update:

Since you're saying that it works with NFSv3 not NFSv4, you should do extra things to use NFSv4.

Create a directory to share in /export folder.

mkdir -p /export/myfolder

then bindmount it. (add line below into /etc/fstab file at server)

/foo/myfolder  /exports/myfolder  none    bind

and put this line into /etc/exports file

/exports/myfolder 192.168.1.0/24(rw,sync,insecure,no_subtree_check,nohide)

run 'exportfs -ra' and check your exports with 'exportfs -rv' command.

then try to mount it :

mount -t nfs4 192.168.1.91:/myfolder  /myfolder -o rw

You can add this line into /etc/fstab file at client machine to mount it every boot.

192.168.1.91:/myfolder  /myfolder  nfs4   rw,auto,hard,intr
share|improve this answer
    
I've also added the contents of /etc/export/ to my question. I wasn't really sure what I should have posted, since if works for NFS v3 but not for v4. –  Sparhawk Sep 17 '13 at 12:15
    
Response post–update of answer: which part of those options differs from the way I'm doing it now? Can I not keep the options I wish to use at the moment, e.g. async,crossmnt? –  Sparhawk Sep 18 '13 at 10:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.