Centos, NFS setup, access from MacOS

Server side (7 (Core)), within Virtualbox 6.0.22:

$ sudo yum install nfs-utils nfs4-acl-tools portmap
## Leave the default nfs.cfg file untouched (actually all commented out)
$ sudo vi /etc/exports
## with this line:
/workspace_guest/02.code 172.20.0.1(rw,sync,insecure,all_squash,anonuid=1000,anongid=1000)
## vs: (rw,sync,no_root_squash,insecure)
## Then update:
$ sudo exportfs -r
$ sudo exportfs -s
/workspace_guest/02.code  172.20.0.1(sync,wdelay,hide,no_subtree_check,anonuid=1000,anongid=1000,sec=sys,rw,insecure,root_squash,all_squash)
## May need to check if nfs.services is up
$ systemctl status nfs
$ sudo firewall-cmd --permanent --add-service mountd
$ sudo firewall-cmd --permanent --add-service nfs
$ sudo firewall-cmd --permanent --add-service rpc-bind
$ sudo firewall-cmd --reload
## be noted there is rpcbind.service but no rpc-bind.service

Client side (macOS Catalina Version 10.15.6), which is the Host of the VM:

Follow this post to use auto_nfs/auto_master pair and use trick to get mounted under /Volumes:

/System/Volumes/Data/../Data/Volumes/C76/02.code -fstype=nfs,noowners,nosuid,nolockd,noatime,resvport,soft,retrans=30,bg,rw,tcp,nfc,rsize=8192,wsize=8192 nfs://172.20.0.100:/workspace_guest/02.code
/-                      auto_nfs

Then refresh:

$ sudo automount -cv

Be noted the auto_master file sometimes could be flushed on macOS then this “auto_nfs” line will be gone!

More options for configuration:

This example and NFS options.

Trouble-shootings:

Check supported nfs versions:

## server:
$ sudo cat /proc/fs/nfsd/versions
-2 +3 +4 +4.1 +4.2
## client:
$ rpcinfo -p 172.20.0.100 | grep -e proto -e nfs
   program vers proto   port
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    3   tcp   2049  nfs_acl
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    3   udp   2049  nfs_acl

Quick check the advertised on both (server and client) sides:

## server:
$ showmount -e
## client:
$ showmount -e 172.20.0.100

Quickly verifying mount from MacOS:

$ sudo mount -t nfs -o resvport,rw,noowners 172.20.0.100:/workspace_guest/02.code /Volumes/C76/02.code
$ df -H
mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,locallocks,rdirplus,readahead=128 your.qumulo.ip:/share /path/to/mountpoint

Firewall?

## Server:
$ sudo systemctl stop firewalld

More issues:

Q: $ showmount -e 172.20.0.100
showmount: Cannot retrieve info from host: 172.20.0.100: RPC failed:: RPC: Unable to send; errno = Bad file descriptor
A: Firewall issue. Try to temporarily stop server firewalld. (Assume you can ping that server firstly. At least the Cisco AnyConnect is very disruptive in this.)

Q: $ sudo ls -lart /System/Volumes/Data/nfs
nfs server 172.20.0.100:/workspace_guest/nfs_share: not responding
ls: /System/Volumes/Data/nfs: Device not configured
Or: ls: : No such file or directory
A: Use option “resvport” instead of “noresvport”

Q: $ sudo automount -cv
automount: /System/Volumes/Data/home updated (/home -> /System/Volumes/Data/home)
automount: /System/Volumes/Data/../Data/Volumes/workspace_guest: can’t set hidden
automount: mount /System/Volumes/Data/Volumes/workspace_guest: Operation not permitted
automount: /Volumes/workspace_guest unmounted
Or: ls: : Permission denied
A: Cannot mount workspace_guest directly which is mounted in guest.

Q: On client side only root could make changes
$ rm /Volumes/C76/02.code/d
override rw-r–r–  ywu/staff for /Volumes/C76/02.code/d? y
rm: /Volumes/C76/02.code/d: Permission denied
A: Use anonuid/anongid pair in /etc/exports on server then the noowner in client. “noowner” takes effects regardless of the anonuid/anongid settings. In this post it’s explained on the server side as “all_squash will map all UIDs and GIDs to the anonymous user, and anonuid and anongid set the UID and GID of the anonymous user.”. I’d think on the client side “noowner” is to apply the current user/group as the “anonymous”.

/workspace_guest/02.code 172.20.0.1(rw,sync,insecure,all_squash,anonuid=1000,anongid=1000)
$ sudo mount -t nfs -o resvport,rw,noowners 172.20.0.100:/workspace_guest/02.code /Volumes/C76/02.code

Q: Always be prompted when deleting a file (not when creating)
$ rm /Volumes/C76/02.code/d
override rw-r–r–  ywu/staff for /Volumes/C76/02.code/d? y
A: remove the “noacl” option in mount cmd line.

Q: Catalina change?

Known issues in MacOS NFS

Be careful of v4 in MacOS

Using other clients

AFP could be the next one to try.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s