FreeKB - NFS Share a storage drive on Linux using NFS
Share a storage drive on Linux using NFS

Install

Use the apt-get or yum command to install NFS

yum install nfs-utils

 


Firewall

If using iptables, allow NFS.

iptables -I INPUT -p 2049 -j ACCEPT
iptables-save > /etc/sysconfig/iptables

 

If using Firewalld, allow NFS.

firewall-cmd --add-service=nfs --permanent
firewall-cmd --reload

 


Configuration

Let's say you want to share /var/myShare. Edit the /etc/exports file, and add the following. In this example, only a single client is allowed to mount the share, client1.example.com. * can be used to allow any client to mount the share.

/var/myShare     client1.example.com(rw,sync,all_squash,no_subtree_check)

 

Export the new addition.

exportfs -a

 

The ps command can be used to determine if your system is using init or systemd. If PID 1 is init, then you will use the service command. If PID 1 is systemd, then you will use the systemctl command.

If your system is using systemd, use the systemctl command to start and enable nfs.

systemctl enable nfs
systemctl start nfs
systemctl status nfs

 

If your system is using init, use the chkconfig and service commands to start and enable nfs.

chkconfig nfs on
service nfs start
service nfs status

 


You can now access this share from a different computer in our LAN.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 80cba in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |