0% found this document useful (0 votes)
147 views12 pages

1.2 NFS Server Conf in Rhel7

NFS is a distributed file system protocol that allows users to mount remote directories on their local system as if they were local. It enables file sharing between Linux/Unix systems. Key points: - NFS was developed by Sun Microsystems in 1984 and is supported in RHEL7. - It provides centralized management of files so all users can access the same data. - The NFS server exports shares that clients can mount locally using ports like 2049 by default. - Configuration involves installing NFS packages, starting services like nfs-server, and editing files like /etc/exports to control shared folders.

Uploaded by

gidum2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views12 pages

1.2 NFS Server Conf in Rhel7

NFS is a distributed file system protocol that allows users to mount remote directories on their local system as if they were local. It enables file sharing between Linux/Unix systems. Key points: - NFS was developed by Sun Microsystems in 1984 and is supported in RHEL7. - It provides centralized management of files so all users can access the same data. - The NFS server exports shares that clients can mount locally using ports like 2049 by default. - Configuration involves installing NFS packages, starting services like nfs-server, and editing files like /etc/exports to control shared folders.

Uploaded by

gidum2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Shikhar Verma 1

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:

Centralized Management of Files


Everyone can access same data
Secured with Firewalls and Kerberos
Reduce Storage Cost and Easy to use

Server Profile:

Packages: nfs-utils rpcbind


Daemon Name: nfs-service
Port Number: 2049
Config file path: /etc/exports, /etc/sysconfig/nfs

3
NFS server side configuration

Step 1 :Install nfs packages through yum command.

# yum install nfs-utils rpcbind libnfsidmap

Step 2 : Start the NFS services and enable the services to work even after reboots

systemctl start rpcbind


systemctl enable rpcbind
systemctl start nfs-server
systemctl enable nfs-server
systemctl start nfs-lock
```systemctl start nfs-idmap

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-server : It enables the clients to access NFS shares.

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.

/etc/exports : It is a main configuration file, controls which file systems are


exported to remote hosts and specifies options.

rw : Writable permission to shared folder

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

exportfs -v : Displays a list of shares files and export options on a server


exportfs -a : Exports all directories listed in /etc/exports
exportfs -u : Unexport one or more directories
exportfs -r : Reexport all directories after modifying /etc/exports

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.

A soft mount can be done by the following method.


192.168.0.105:/data /mnt nfs rw,soft 00

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.

192.168.0.105:/data /mnt nfs rw,hard,intr 00

11
END of this Course Module.

Thanks
12

You might also like