我已将 Raspberry Pi 设置为 NFS 服务器,但无法使用 NFS 版本 4 连接到它。但是,版本 3 可以工作。来自我的 Kubuntu 13.04 客户端:
$ 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
从服务器来看,内核中似乎编译了NFS版本4。
$ 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
/var/log/messages
两次尝试的服务器日志均未更改。对于不成功的 v4 尝试,服务器日志/var/log/syslog
不会发生变化,但对于成功的 v3 尝试会附加服务器日志,如下所示。
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)
奇怪的是,尽管我指定了 2049,但端口似乎正在更改?
服务器的内容/etc/export
/export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async,crossmnt)
注意,这最初发布于Raspberry Pi Stackexchange 站点两周前,但我在这里尝试,因为我还没有得到像样的回应。如果我在这里得到好的回应,我会删除另一个。
==编辑==
/etc/default/nfs-common
服务器上的内容:
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=
# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
STATDOPTS=
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=no