Tuesday, 6 January 2015

Setting up an NFS mount in REDHAT

Before going to the procedure we need to first understand the usefulness of NFS mount.

NFS mounts help to share a directory between several servers. As a result of this we can save disk space, as the real directory is only in the master server, and others (clients) can connect to it over the network.

Now, in our scenario we will have a master server with IP address:  192.168.150.28

A client server which has the IP address: 192.168.150.34

Now I want to mount a directory named "/sftp" to the client server via NFS.


PROCEDURE:
-------------------

Install packages via yum as below:
------
yum install nfs-utils nfs-utils-lib 
------

edit the file  /etc/exports
-------
/sftp 192.168.150.34(rw,sync,no_root_squash,no_all_squash)
--------

chkconfig nfs on 
service rpcbind start
service nfs start


Now, run the below command to export the directory
----
exportfs -a
----

CONFIGURATIONS ON CLIENT SIDE:
===============

Install the following packages in client machine:
-------
yum install nfs-utils nfs-utils-lib 
-------

Once that is done,  create a directory "/mnt/sftp" to which NFS shared files can be found.
-----
mkdir -p /mnt/sftp

mount -t nfs 192.168.150.28:/sftp /mnt/sftp
-----

Now, enter the details in /etc/fstab of client
------
192.168.150.28:/sftp /sftp  nfs  defaults 0 0
-------

Now, see df -h, you will be able to see the details of NFS mount.

NOTE: When you have several clients, you will have to edit the "/etc/exports" as below:
--------
/sftp client1(rw,sync,no_root_squash,no_all_squash  client2(rw,sync,no_root_squash,no_all_squash)
--------

No comments:

Post a comment

Note: only a member of this blog may post a comment.