NFSv4 quick start
Providing you understand what you are doing, use this brief walk-through to set up an NFSv4 server on Ubuntu (with no authentication security). Then mount the share on an Ubuntu client. It has been tested on Ubuntu 10.04 Lucid Lynx.
Install the required packages...
# apt-get install nfs-kernel-server
NFSv4 exports exist in a single pseudo filesystem, where the real directories are mounted with the --bind option.
- Let's say we want to export our users' home directories in /home/users. First we create the export filesystem:
# mkdir -p /export/users
important that /export and /export/users have 777 permissions as we
will be accessing the NFS share from the client without LDAP/NIS
authentication. This will not apply if using authentication (see
below). Now mount the real users directory with:
# mount --bind /home/users /export/users
- To save us from retyping this after every reboot we add the following line to /etc/fstab
/home/users /export/users none bind 0 0
There are three configuration files that relate to an NFSv4 server: /etc/default/nfs-kernel-server, /etc/default/nfs-common and /etc/exports.
- Those config files in our example would look like this: In /etc/default/nfs-kernel-server we set:
NEED_SVCGSSD=no # no is default
- because we are not activating NFSv4 security this time. For Ubuntu 11.10 and earlier, we set the following in /etc/default/nfs-common to get UID/GID mappings from names:
NEED_IDMAPD=yes # only needed for Ubuntu 11.10 and earlier
In order for the ID names to be automatically mapped, both the client and server require the /etc/idmapd.conf file to have the same contents with the correct domain names. Furthermore, this file should have the following lines in the Mapping section:
[Mapping] Nobody-User = nobody Nobody-Group = nogroupHowever, the client may have different requirements for the Nobody-User and Nobody-Group. For example on RedHat variants, it's nfsnobody for both. cat /etc/passwd and cat /etc/group should show the "nobody" accounts.
This way, server and client do not need the users to share same UID/GUID.
For those who use LDAP-based authentication, add the following lines to your client's idmapd.conf:
[Translation] Method = nsswitch
This will cause idmapd to know to look at nsswitch.conf to determine where it should look for credential information (and if you have LDAP authentication already working, nsswitch shouldn't require further explanation).
To export our directories to a local network 192.168.1.0/24 we add the following two lines to /etc/exports
/export 192.168.1.0/24(rw,fsid=0,insecure,no_subtree_check,async) /export/users 192.168.1.0/24(rw,nohide,insecure,no_subtree_check,async)
Last part launch:
Now connecto to with the vsphere client. Click on host and then on configuration.
Click on staorage (left side) and then click on Add storage.
now select network File system and then click on next:
insert NFS server IP address. The shared folder name (/export/users) and give the
datastorage a name. Click next.
Click on finish.
New datastorage appears.