Wednesday 4 July 2018

NFS SERVER SETUP


NFS, stands for Network File System, is a server-client protocol used for sharing files between linux/unix to unix/linux systems. It allows you to mount your local file systems over a network and remote hosts to interact with them as they are mounted locally on the same system. You can then directly access any of the files on that remote share.

Benefits of NFS
  1. NFS allows local access to remote files.
  2. With NFS it is not necessary that both machines run on the same OS.
  3. With the help of NFS we can configure centralized storage solutions.
  4. Users get their data irrespective of physical location.
  5. No manual refresh needed for new files.
Important Files for NFS Configuration
  1. /etc/exports: Its a main configuration file of NFS, all exported files and directories are defined in this file at the NFS Server end.
  2. /etc/fstab: To mount a NFS directory on your system across the reboots, we need to make an entry in /etc/fstab.
  3. /etc/sysconfig/nfs : Configuration file of NFS to control on which port rpc and other services are listening.
NFS Services
  1. nfs: It translates remote file sharing requests into requests on the local file system.
  2. rpc.mountd: This service is responsible for mounting and unmounting of file systems.
Here my testing nodes details
NFS Server IP Address 192.168.105.226
NFS Client IP Address 192.168.135.52

Server & Client Side Configuration
Install NFS packages in your Server and Client system by using the following command:
Enable and start NFS services

Now, Firstly we will configure the NFS Server

For sharing a directory with NFS, we need to make an entry in “/etc/exports” 
configuration file. Here I’ll be creating a new directory named “rdshare” in “/” 
partition to share with client server, 




Now we need to make an entry in “/etc/exportsand restart the services to make 
our directory shareable in the network.



Now Insert the below line and save the file  ( According to your need)
/rdshare 192.168.135.52 (rw,sync,no_root_squash,no_all_squash)

where :
/rdshare  – shared directory
192.168.135.52 – IP address of the clients
rw – Writable permission to shared folder
sync – Synchronize shared directory
no_root_squash – Enable root privilege
no_all_squash - Enable user’s authority

Now Restart the NFS service:




After configuring the NFS server, we need to mount that shared directory or partition 
in the client server.First we need to find out the that shares available on the remote server or NFS Server.



It's shows 
Export list for 192.168.0.100: /rdshare 192.168.0.101
Mount Shared NFS Directory
To mount the NFS directory using given command


Now we can verify mounted directory using given command


it's shows 
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
192.168.105.226:/rdshare on /mnt type nfs (rw,addr=192.168.105.226)

To mount an NFS directory permanently on your system across the reboots
we need to make an entry in “/etc/fstab.



Add the following line 
192.168.105.226:/rdshare /mnt  nfs defaults 0 0

Test the working of NFS Setup
At the server end
create the new text file named rdtest.txt file in the shared directory 




At the server end 

Go to that shared directory in client server and you’ll find that shared file without any 
manual refresh or service restart.

Removing the NFS mount 




Some more important commands for NFS.

showmount -e : Shows the available shares on your local machine
showmount -e <server-ip or hostname>: Lists the available shares at the remote server
showmount -d : Lists all the sub directories
exportfs -v : Displays a list of shares files and options on a server
exportfs -a : Exports all shares listed in /etc/exports, or given name
exportfs -u : Unexports all shares listed in /etc/exports, or given name
exportfs -r : Refresh the server’s list after modifying /etc/exports

1 comment:

  1. Buy windows server 2008 standard & enterprise at Digital Software Market. Windows server 2008 is the part of microsoft server. Check product details, offers & discounts. Windows Server 2008, Standard Edition taking on the bulk of network services, the Enterprise Edition is really focused on server systems that require extremely large-scale processing and memory capabilities as well as clustering or Active Directory Federation Services.

    ReplyDelete

Create a New Virtual Machine

1.In the left pane, Click on the Hyper-V manager that you wish to host the new virtual machine. 2. In the right-hand Action pane, Click Ne...