NFS

Install and Configure NFS

Install and Configure NFS

Network File System (NFS) is an application that allows users to access and modify files on a remote computer as if they are accessing the local storage of their own computer. It is what is called a distributed file system, and it serves as a centralized filing system for a large network of computers.

NFS works with networks shared by systems with different operating systems. The administrator can also select which sections of the mounting information are made available to the client systems.

This article shows you how to install and configure NFS on your ArchLinux system.

Step 1: Set Up NFS packages

First, we will install the packages for NFS. To do so, issue the following command:

$ sudo pacman -S nfs-utils

Step 2: Set NFS to Launch at Startup

Use the commands below to set NFS to launch at startup:

$ chkconfignfs on
$ service rpcbind start
$ service nfs start


Now, NFS should launch at the startup.

Step 3: Share Directory with Client

Next, you will select a directory to share with the client and move it to /etc/exports. Use the command below to do so:

$ vi /etc/exports


Then, append this line to the files:

# /share 192.168.87.158(rw,sync,no_root_squash,no_subtree_check)

Finally, export these files with the command below:

$ exportfs -a

Step 4: Prepare the Client

The synchronization will require certain packages that you can download with the commands below:

$ sudo pacman -S nfs-utils

Step 5: Mount the Shared Directory

Once the packages are installed on the remote computer, it is now time to mount the shared directory:

$ mkdir -p /mnt/share


Then, mount the shared directory:

$ mount 192.168.87.156:/share /mnt/share/


Run a confirmation test to see if the share is mounted:

$ df -h


Type in #mount to list the mounted file systems:

$ mount

Running A Test

Bring over the contents to be distributed to the client through the server share directory. Type in the following command to run a test:

$ touch test1
$ mkdir test


Go to the /mnt/share folders in the remote computer that is serving as the client:

$ ls /mnt/share/ -lh


Then, add the entries in the /etc/fstab file to automatically mount the shared folder permanently.

Append the /etc/fstab file with the following lines:

$ vi /etc/fstab


This should mount the share folder files and all its contents.

Using NFS

We will now go over some of the options specific to NFS that might come in handy:

Fire up the terminal on the server and type the command below to see the contents up for sharing on the client machine:

$ showmount -e


To see the contents up for sharing on the server, you can use a variation of this command. Type the command below:

$ showmount -e 192.168.87.156


The following command allows you to list all the share files on the server:

$ exportfs -v

To clear the /etc/exports location and send contents back to the source, enter the following:

$ exportfs -u

Conclusion

NFS is a very simple, yet exceptionally convenient, network file sharing application. The extensive central filing system of NFS saves tons of HDD space, as many folders present on the host no longer need to be stored on each computer. The straightforward interface of NFS allows users to access the server for contents as they would access the local storage.

Keep in mind that NFS is susceptible to many exploitative attacks from the internet. As such, you should also consider setting up a firewall to protect your host from these attacks.

That is all we have for today. Stick around at linuxhint.com for more articles like this. We will post follow-ups to this particular post.

Open Source Ports of Commercial Game Engines
Free, open source and cross-platform game engine recreations can be used to play old as well as some of the fairly recent game titles. This article wi...
Кращі ігри командного рядка для Linux
Командний рядок - це не просто ваш найбільший союзник при використанні Linux, він також може бути джерелом розваг, оскільки ви можете використовувати ...
Кращі програми для картографування геймпадів для Linux
Якщо ви любите грати в ігри на Linux із геймпадом замість типової системи введення клавіатури та миші, є кілька корисних програм для вас. Багато ігор ...