我尝试连接NFS version 4
我的共享Mac OS X 10.7
但没有成功:
$ pwd
/Volumes
$ mkdir NFS
$ sudo mount_nfs -o resvport,vers=4 192.168.0.1:/var/teterevkov /Volumes/NFS
mount_nfs: can't mount /var/teterevkov from 172.19.51.50 onto /Volumes/NFS: No such file or directory
NFS version 3
因此,使用以下命令连接时没有问题
$ sudo mount_nfs -o resvport,vers=3 192.168.0.1:/var/teterevkov /Volumes/NFS
在服务器端我有
$ uname -a
Linux 2.6.32.24 #19 SMP Tue Mar 13 14:00:24 MSK 2012 x86_64 GNU/Linux
$
$ cat /etc/exports
# /etc/exports: NFS file systems being exported. See exports(5).
/var/teterevkov 192.168.0.2(rw,no_root_squash,no_subtree_check,async)
该路径/var/teterevkov
为有效存在路径。linux
内核有NFS version 4 support
以下统计信息nfsstat -4
:
nfsstat -4
Server rpc stats:
calls badcalls badauth badclnt xdrcall
592097 0 0 0 0
Server nfs v4:
null compound
9 24% 28 75%
Server nfs v4 operations:
op0-unused op1-unused op2-future access close commit
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
create delegpurge delegreturn getattr getfh link
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
lock lockt locku lookup lookup_root nverify
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
open openattr open_conf open_dgrd putfh putpubfh
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
putrootfh read readdir readlink remove rename
10 35% 0 0% 0 0% 0 0% 0 0% 0 0%
renew restorefh savefh secinfo setattr setcltid
0 0% 0 0% 0 0% 0 0% 0 0% 9 32%
setcltidconf verify write rellockowner bc_ctl bind_conn
9 32% 0 0% 0 0% 0 0% 0 0% 0 0%
exchange_id create_ses destroy_ses free_stateid getdirdeleg getdevinfo
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
getdevlist layoutcommit layoutget layoutreturn secinfononam sequence
0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
set_ssv test_stateid want_deleg destroy_clid reclaim_comp
0 0% 0 0% 0 0% 0 0% 0 0%
那么,有什么问题NFS version 4
?
答案1
NFSv4 具有整个导出文件系统的“虚拟”根的概念。带有 fsid=root 的导出挂载点将用作此“虚拟”根。
尝试将该fsid=root
选项添加到您的 /etc/exports 服务器配置文件中,然后通过运行重新加载导出目录列表exportfs -arv
。您可能需要重新启动 nfsd 服务才能使更改生效。
# /etc/exports
# Example for NFSv4: (insecure option for OS X, or use resvport on client)
/srv/nfs4 *(rw,sync,fsid=root,no_subtree_check,insecure)
现在,您可以运行之前尝试过的相同 mount 命令,只不过您现在想要挂载导出的文件系统的虚拟根目录,如下所示:
# sudo mount_nfs -o resvport,vers=4 192.168.0.1:/ /Volumes/NFS
答案2
我已经找到了解决方案帮助中心。
NFSv4 exports exist in a single pseudo filesystem, where the real directories are mounted with the --bind option
。