NFS (v4) Shares on CentOS 6

Posted by jason on Jan. 30, 2012, 12:39 p.m.
Tags: arch centos linux sysadmin

Here's a few I had to do while trying to set up read-write NFS shares between a CentOS 6 NFS server and an Arch Linux client. The Arch Wiki NFSv4 page was a huge help.

Set up NFS domain

Edit /etc/idmapd.conf on both the client and the server, and put a line like this in both:

Domain = mydomain

Set up NFS exports on the server

You need to have an "NFS root" set up. To do this, add a first entry with "fsid=0", like so:

/export 192.168.0.0/24(rw,fsid=0,no_subtree_check,async,no_root_squash)

Next, add entries for the actual directories you want to export. For read-write access, use anonuid and anongid, like so:

/export/jason 192.168.0.0/24(rw,all_squash,async,anonuid=500,anongid=500)

You need to put the actual user / group IDs here. Find them by looking at /etc/passwd. I put the owner of /export/jason's UID and GID here.

For some reason, I had to put "all_squash" here--"no_root_squash" doesn't work for me.

Error: "mount disagrees with the fstab"

I got this error when trying to umount the directory on the client. The fix was to add a trailing "/" to the first part of the NFS entries in /etc/fstab--that is, I changed "host:/export/jason" to "host:/export/jason/". Got that solution from here.


0 comments