From MyWiki

Jump to: navigation, search


I see lots of frustration using NFS4 with Linux. NFS4 has some definite benefits but it's not for everyone. Note that a lot of the confusion comes from the need to mix NFS4 and previous versions. Below is what has worked for me, and assumes that all clients are capable of using NFS4.

In this example, we'd like to share two directories, /export/share and /export/home. Users on the server should mount using a loopback bind. Users on clients will use NFS4.

On the server, create the following directories to use as mountpoints:-


Symbolically link /export to /.nfs4/export.

Server config files:-

Add something like

/dev/VolGroup00/home    /.nfs4/export/home      ext3    defaults        1 3
/dev/VolGroup00/share   /.nfs4/export/share     ext3    defaults        1 4

The first line is critical for this to work.

/.nfs4		 *(fsid=0,crossmnt)
/.nfs4/export/home     *(rw,mp,root_squash,insecure,no_subtree_check)
/.nfs4/export/share    *(rw,mp,root_squash,insecure,no_subtree_check)

Automount maps used by both client and server. Note that LDAP is used to share these maps. Your mileage may vary.

The first line is not a mistake.

/net         /etc/auto.net
/home      /etc/auto.home

Use both types of wild cards to keep both Debian/Ubuntu and Redhat/Centos happy.

*     -fstype=nfs4,hard,intr,rw sun:/export/home/&
/      -fstype=nfs4,hard,intr,rw sun:/export/home/&

ReadyNAS that only works well with NFS3 or lower so it needs an explicit entry. Note that this needs to be manually modified for each new export that will be visible under /net.

readynas    -fstype=nfs,hard,intr,nodev,rw,nosuid 	/c/backup readynas:/c/backup \
                 	/c/home_user1 readynas:/c/home_user1 \
                 	/c/install readynas:/c/install
*          -fstype=nfs4,rw,hard,intr,nosuid,nodev &:/
/           -fstype=nfs4,rw,hard,intr,nosuid,nodev &:/

Note that the /etc/auto.net script distributed with most versions of NFS becomes redundant.

Output from mount commands:


/dev/mapper/VolGroup00-home on /.nfs4/export/home type ext3 (rw)
/dev/mapper/VolGroup00-share on /.nfs4/export/share type ext3 (rw)
/.nfs4/export/home/user1 on /home/user1 type none (rw,bind)


server:/export/home/user1 on /home/user1 type nfs4 (rw,hard,intr,addr=

Keywords: CentOS CentOS4 CentOS5 Redhat RHEL5 RHEL4 NFS4 NFSv4