Background

I want to deploy the NFS service on FreeBSD and make it available to my mac.

Device info

  1. macOS OS version: 10.15.7 ip: 192.168.1.88
    username: puffin
  2. FreeBSD OS version: 13.2-RELEASE ip: 192.168.1.99

Configure NFS

We configure NFS on the FreeBSD with following steps:

setup the /etc/rc.conf

setup the file and add configuration of NFS.

  1. change the file /etc/rc.conf as follows:

    1
    
    vim /etc/rc.conf
    
  2. add following lines:

    1
    2
    3
    4
    5
    
    nfs_server_enable="YES"
    nfs_server_flags="-u -t -n 4"
    rpcbind_enable="YES"
    mountd_flags="-r"
    mountd_enable="YES"
    

setup the /etc/exports

  1. change the file /etc/exports as follows:

    1
    
    vim /etc/exports
    
  2. add following lines:

    ⚠️ the parameter -mapall=puffin should be the username of my mac, and the ip 192.168.1.88 should be the same as the one in my mac.

    1
    
    /mnt/data/nfs -mapall=puffin -alldirs 192.168.1.88
    

Start NFS

Start Service

1
service nfsd start

Reload mountd after change the configuration

1
service mountd reload