NFSv4NFSv4, Network File System version 4, is the new version of NFS (for setting up the older NFSv3, see Nfs) with new features like strong authentication and integrity via Kerberos and SPKM-3, improved performance, safe file caching, lock migration, UTF-8, ACLs and better support for Windows file sharing semantics. This article covers installing and configuring NFSv4. InstallingBoth client and servers require the nfs-utils package. Install nfs-utils with pacman. ConfiguringServerThe server configuration is very thorough. ExportsFirst, we will need to edit our exports in A typical NFSv4 export would look like this: /export 192.168.0.12(rw,fsid=0,no_subtree_check,async,no_root_squash) /export/music 192.168.0.12(rw,no_subtree_check,async,no_root_squash)
For exporting directories outside the NFS root, see below. Exporting directories outside your NFS rootTo do this, you will need to use bind mounts. For example, to bind # mount --bind /home/john /export/john Then, /export 192.168.0.12(rw,fsid=0,no_subtree_check,async,no_root_squash) /export/music 192.168.0.12(rw,no_subtree_check,async,no_root_squash) /export/john 192.168.0.12(rw,no_subtree_check,async,no_root_squash,nohide) The /home/john /export/john none bind 0 0 ID mappingThen, [General] Verbosity = 1 Pipefs-Directory = /var/lib/nfs/rpc_pipefs Domain = [Mapping] Nobody-User = nobody Nobody-Group = nobody Starting the serverTo start the NFS server, just do: # rc.d start rpcbind nfs-common nfs-server If you want to tweak the configuration, feel free to edit ClientThe client configuration is more simple. Client ID mapping
[General] Verbosity = 1 Pipefs-Directory = /var/lib/nfs/rpc_pipefs Domain = [Mapping] Nobody-User = nobody Nobody-Group = nobody [Translation] Method = nsswitch Mounting the partitions on the clientOn the client, to mount the NFSv4 partition: Make sure that nfs module is loaded. (lsmod | grep nfs). If not execute the next command "modprobe nfs" # /etc/rc.d/rpcbind start # /etc/rc.d/nfs-common start # mount -t nfs4 server:/ /mnt/server/ # mount -t nfs4 server:/music /mnt/music/ # mount -t nfs4 server:/john /mnt/john Replacing 'server' with the hostname or IP address of your NFS server and of course 'server', 'music' and 'john' with the names of whatever directories you exported on the server. If you want the NFS volumes to mount automatically on bootup, add them to server: /mnt/server nfs4 async,user 0 0 Remember to add netfs in the daemons array at /etc/rc.conf in order to mount nfs volumes at boot. Client & Server: Time SynchronizationIn order for NFS to function properly, both server and client must have closely matching time values. If the clocks on the clients differ from the server too much, then basic functions like file copy operations may hang for a very long time leaving the system unusable until they resume. The clocks do not have to match to micro/nano second accuracies, but ideally they should be within 1 second of each other. The NTP system is recommended to sync both the server and the clients to the highly accurate NTP servers available on the Internet. For a small system like a home network, the ntpdate utility may be used to sync both servers and clients to the same time. For a larger installation, it may be desirable to install an OpenNTP server (see NTP) onto the same machine acting as the NFS server, and then all clients on the network would sync time values from the server. This has the advantage of lowering the stress on the external NTP servers, and in assuring that the NFS clients will use the exact time that the NFS server has, even if the NFS server experiences some drift. Troubleshootingmessages.log contains "nfsdopenone: Opening /proc/net/rpc/nfs4.nametoid/channel failed: errno 2 (No such file or directory)"Add exportfs: /etc/exports:2: syntax error: bad option listDelete all space from the option list in mount.nfs4: No such deviceCheck that you have loaded the lsmod | grep nfs and if previous returns empty or only nfsd-stuff, do modprobe nfs mount.nfs4: access denied by server while mountingCheck that the permissions on your client's folder are correct. Try using 755. Permissions issuesIf you find that you cannot set the permissions on files properly, make sure the user/group you are chowning are on both the client and server.
If that does not help, try modifying these lines in # /etc/conf.d/nfs-common.conf # Do you want to start the statd daemon? It is not needed for NFSv4. NEED_STATD="no" # Do you want to start the idmapd daemon? It is only needed for NFSv4. NEED_IDMAPD="yes" Restart the nfs-common daemon for the changes to take effect. I restarted all the other daemons as well, just to be sure. Group/gid Permissions issuesIf NFS shares mount fine, and are fully accessible to the owner, but not to group members; check the number of groups that user belongs to. NFS has a limit of 16 on the number of groups a user can belong to. If you have users with more then this, you need to enable the /etc/conf.d/nfs-server.conf # Options for rpc.mountd. # If you have a port-based firewall, you might want to set up # a fixed port here using the --port option. # See rpc.mountd(8) for more details. MOUNTD_OPTS="--manage-gids" |
|