NFS shares on OS X

2

I am trying to connect the NFS version 4 share on my Mac OS X 10.7 with no success:

$ 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

So, there are no problems while connecting with NFS version 3 with following command

$ sudo mount_nfs -o resvport,vers=3 192.168.0.1:/var/teterevkov /Volumes/NFS

On server side I have

$ 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)

The path /var/teterevkov is valid existant path. The linux kernel is with NFS version 4 support and there is the statistic information given by 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% 

So, what wrong with NFS version 4?

user83293

Posted 2012-03-19T11:03:52.137

Reputation:

Answers

3

NFSv4 has a concept of a "virtual" root of the overall exported filesystem. The export mount point with fsid=root will be used as this "virtual" root.

Try adding the fsid=root option into your /etc/exports server configuration file, then reload the list of exported directories again by running exportfs -arv. You may need to restart the nfsd service again for the changes to take effect.

# /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)

Now you can run the same mount command you were trying earlier, execpt you want to now mount the virtual root of the exported filesystem as such:

# sudo mount_nfs -o resvport,vers=4 192.168.0.1:/ /Volumes/NFS

Justin Randall

Posted 2012-03-19T11:03:52.137

Reputation: 131

0

I have found the solution in help.ubuntu.com.

NFSv4 exports exist in a single pseudo filesystem, where the real directories are mounted with the --bind option.

user83293

Posted 2012-03-19T11:03:52.137

Reputation:

3I understand (and can reproduce) the OP's problem. I don't understand this answer. – DrSAR – 2012-07-06T16:55:51.067