Did you know  45Drives offers free  public and private  webinars ? Click here to learn more  & register! Build & Price

KB450094 – Single Server Linux NFS Setup

You are here:

Your storage solution may need to make use of a NFS share. NFS allows a system to share dictories and files over a network, and allows users and programs to access network files as if they were local files.

The advantage of a NFS share is ‘in the pudding,’ so to speak. Users don’t need to have separate home directories for every network machine, and home directories can even be set up on the NFS server to be made available across the network.

Storage devices such a CDROM, USB thumb drives and even floppy disks can be used by other machines on the network, reducing the amount of removable media drives that are necessary.

Once your zpool/raid is created and mounted, start preparing to export the zpool via NFS.

Things to consider:

  • Firewall – add the nfs service as an exception:

firewall-cmd –permanent –add-service=nfs; firewall-cmd –permanent –add-port=111/tcp

  • Datasets – It is probably in your best interest to create a dataset on your zpool and export that, rather than exporting the entire zpool itself:

zfs create zpool/dataset1

  • Both the server and the client machine (if Linux) should have an nfs-utils package installed:

yum install nfs-utils

  • Ensure that the NFS service is running on the server:

systemctl start nfs; systemctl enable nfs

  • Edit the /etc/exports file on the server to include which directory you’d like to export, along with mount options:

vim /etc/exports

  • For example here is a copy an /etc/exports file:

/zpool/dataset1 *(rw,sync,no_root_squash,no_subtree_check)
/zpool/dataset2 192.168.*.*(rw,sync,no_root_squash,no_subtree_check)

  • The *’s are related to IP addresses, the dataset1 entry means that anybody can access. The dataset2 entry will only allow IP’s within that range.
  • Once you’ve written your file and saved it – run this command:

exportfs -a

  • You can check that it is now being exported by running:

showmount -e.

  • If it isn’t listed in the export list, restart the nfs service:

systemctl restart nfs

  • You should now be able to mount the nfs share on a client by running:

mount -t nfs /mnt/test

  • is the IP address of the server, and /mnt/test is where we want to mount it on the client side.
Was this article helpful?
Dislike 0
Views: 1084
Unboxing Racking Storage Drives Cable Setup Power UPS Sizing Remote Access