NFS server on Mac OS X
 
If you ditch into Mac OS X you easily find that under Aqua there is BSD system underneath.
It comes with all the goods a proper Unix system should have.
Running NFS (Network File System) on Mac OS X is very easy.
If you read /System/Library/StartupItems/NFS/NFS script it clearly says what should be run,
in which order. First of all you need portmapper(8), nfsd(8), mountd(8), rpc.lockd(8) and
rpc.statd(8) deamons running. Quite a lot, ain’t it? You can run them one by one or via NFS script but it’s much easier to create /etc/exports file and reboot the system.
At the startup, when /etc/exports is found, the NFS server is run.
 
To create a share, edit /etc/exports file. It does not exist by default so create it first:
    # vi /etc/exports
and add:
    /Users/gregory/tftp -ro -mapall=nobody
I export /Users/gregory/tftp directory, read only filesystem, map EUID to nobody.
 
Save the file and reboot.
 
To check if RPC is working properly issue
 
 root# rpcinfo -p
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp   1019  status
    100024    1   tcp   1015  status
    100021    0   udp   1008  nlockmgr
    100021    1   udp   1008  nlockmgr
    100021    3   udp   1008  nlockmgr
    100021    4   udp   1008  nlockmgr
    100021    0   tcp   1014  nlockmgr
    100021    1   tcp   1014  nlockmgr
    100021    3   tcp   1014  nlockmgr
    100021    4   tcp   1014  nlockmgr
    100005    1   udp    989  mountd
    100005    3   udp    989  mountd
    100005    1   tcp   1012  mountd
    100005    3   tcp   1012  mountd
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
 
To check what is exported by localhost, issue:
 
root# showmount -e localhost
Exports list on localhost:
/Users/gregory/tftp                 Everyone
 
To mount a share from a client issue:
root# mount -t nfs 192.168.0.101:/Users/gregory/tftp /Volumes/nfs
 
 
 
Greg’s blog
Saturday, May 12, 2007