1.2 NFS Server Conf in Rhel7
1.2 NFS Server Conf in Rhel7
Network File System (NFS): Is a nfs server client protocol used for sharing
files and directories between Linux / Unix to Unix/Linux systems vise versa. It
is a popular distributed filesystem protocol that enables users to mount remote
directories on their server. NFS enables you to mount a remote share locally.
NFS was developed by Sun Micro Systems in the year 1984
RHEL7 provides the support for NFS versions 3, 4.0, and 4.1(latest version)
NFS default port number is 2049
NFS share we can mount Manually, Automatically using AutoFS
2
Features:
Server Profile:
3
NFS server side configuration
Step 2 : Start the NFS services and enable the services to work even after reboots
4
RPCBIND
The rpcbind utility maps RPC services to the ports on which they listen. RPC
processes notify rpcbind when they start, registering the ports they are listening on
and the RPC program numbers they expect to serve. The client system then
contacts rpcbind on the server with a particular RPC program number. The rpcbind
service redirects the client to the proper port number so it can communicate with
the requested service.
Because RPC-based services rely on rpcbind to make all connections with incoming
client requests, rpcbind must be available before any of these services start.
rpcinfo -p
5
rpcbind : The rpcbind server converts RPC program numbers into universal
addresses.
nfs-lock / rpc-statd : NFS file locking. Implement file lock recovery when an
NFS server crashes and reboots.
nfs-idmap : It translates user and group ids into names, and to translate user
and group names
into ids
6
Important Configuration Files:
You would be working mainly on below configuration files, to setup NFS server
and Clients.
sync : all changes to the according filesystem are immediately flushed to disk;
the respective write operations are being waited for.
7
Important Configuration Files:
no_root_squash : By default, any file request made by user root on the client
machine is treated as by user nobody on the server. (Exactly which UID the
request is mapped to depends on the UID of user “nobody” on the server, not the
client.) If no_root_squash is selected, then root on the client machine will have the
same level of access to the files on the system as root on the server.
/etc/fstab : This file is used to control what file systems including NFS directories
are mounted when the system boots.
/etc/sysconfig/nfs : This file is used to control which ports the required RPC
services run on.
8
Few Commands
9
Soft Mounting in NFS
Suppose you have once process on your client machine, say for example, an
Apache web server is accessing a mounted share and files in it. But due to some
problem on the NFS server, the request made by Apache for a file on the NFS
share cannot be completed. In this case the NFS client will reply to the process
(Apache in our case), with an error message.
Most of the processes will accept the error. But it all depends on how the process is
designed to handle these errors. Sometimes it can cause unwanted behavior and
even can corrupt the files.
10
Hard Mounting in NFS
Hard mounting works a little different than soft mounting. If a process that requires a file from
the nfs share, cant access it due to some problem at the nfs server, the process will wait (kind
of get's hang) till the nfs server becomes proper and completes its request. And the process
will resume from the point where it was stopped when NFS server responds back properly.
The process that is waiting for the operation to get completed, cannot be interrupted. Yeah
sure you can kill the process with a kill -9 command, and can also be interrupted with the help
of an option called intr.
A hard mounting can be done by adding the options as shown below in fstab.
11
END of this Course Module.
Thanks
12