How To

Configure NFS Server on Arch | Manjaro | Garuda Linux

Network File System (NFS) client is a program that allows users to view and change files on a distant computer as if they were accessing their own local storage. It’s a distributed file system, and it’s used to act as a centralized filing system for a wide network of computers. NFS is a network sharing protocol that allows computers with various OS to share a network. The administrator can also choose which parts of the mounting information are accessible to client systems.

Original content from computingforgeeks.com - post 161422

In this guide, we’ll go through how to install and configure NFS file sharing on Arch | Manjaro | Garuda Linux systems.

Features of Network File System (NFS)

  • To handle files bigger than 2 gigabytes (GB), 64-bit file sizes and offsets are supported.
  • On the server, support for asynchronous writes to enhance write speed.
  • In many responses, extra file characteristics to prevent having to re-fetch them.
  • When scanning a directory, a READDIRPLUS operation to retrieve file handles and characteristics along with file names.
  • Cloning and copying on the server.
  • I/O recommendation for an application.
  • Reservation of a space.
  • Block of data for the application (ADB).
  • NFS labeled with sec label to support any MAC security scheme.

Advantages NFS Storage

  • The same file can be used by several computers, allowing everyone on the network to access the same data.
  • Costs of storage are reduced. Networked computers exchange programs, eliminating the requirement for each computer to have its own local storage.
  • Because all users are reading from the same set of files, it promotes data consistency and dependability.
  • The mounting of the file system is transparent to the users.
  • Reduces the amount of time spent on system management
  • Supports a variety of settings
  • Allows users to access distant files in an unobtrusive manner.

Install and Configure NFS Server on Arch | Manjaro | Garuda

The methods below will be used to install and configure NFS Server on Arch | Manjaro | Garuda Linux.

Step 1: Update system packages

Before installing, make sure your system packages are up to date. Execute these commands:

sudo pacman -Syu

Step 2: Installation of NFS Server

After updating the system packages, run the following command to install nfs server on Arch, Manjaro and Garuda Linux.

sudo pacman -S nfs-utils

Now, start the installation process:

resolving dependencies...
looking for conflicting packages...

Package (1)     Old Version  New Version  Net Change

core/nfs-utils  2.8.2-2      2.8.2-2        0.00 MiB

Total Installed Size:  1.27 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y

Step 3: Start and Enable nfs service

Once the installation is complete, use the instructions following to start and activate the nfs service:

sudo systemctl enable nfs-server.service
sudo systemctl start nfs-server.service

Execute the following command to check if nfs is active and running:

$ systemctl status nfs-server.service
● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; preset: disabled)
     Active: active (exited) since Tue 2025-02-25 18:09:18 EAT; 7s ago
 Invocation: 4592dbade27542d482b1f5936b19a9fa
       Docs: man:rpc.nfsd(8)
             man:exportfs(8)
    Process: 8341 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
    Process: 8342 ExecStart=/bin/sh -c /usr/sbin/nfsdctl autostart || /usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
   Main PID: 8342 (code=exited, status=0/SUCCESS)
   Mem peak: 1.7M
        CPU: 16ms

Feb 25 18:09:18 garuda.cloudspinx.com systemd[1]: Starting NFS server and services...
Feb 25 18:09:18 garuda.cloudspinx.com systemd[1]: Finished NFS server and services.

Step 3: Create and Export NFS share

Take a look at the following scenario:

  • /srv/nfs is the NFS root.
  • The destination is /mnt/music, and the export is /srv/nfs/music through a bind mount.

We are going to create a directory nfs under /srv and mount it to /mnt/music via bind mount:

sudo mkdir -p /srv/nfs/music /mnt/music
sudo mount --bind /mnt/music /srv/nfs/music

Nfs shares are defined in /etc/exports as below:

sudo vim /etc/exports

Once you open the /etc/exports file above add the following contents to create nfs shares:

/mnt/music  192.168.1.196(sync,rw)

The remote nfs client in this example is 192.168.1.191 which is a Manjaro (Arch) machine, and it will use the newly formed directory on the nfs server.

In the example above we can obtain the following:

  • Grants can read and write on the nfs share with the rw option.
  • Sync – Requires that any other action be preceded by the writing of modifications to the disk.
  • no_all_squash – Maps all client requests’ UIDs and GIDs to the same UIDs and GIDs on the nfs server.
  • All UIDs and GIDs from client requests are mapped to the anonymous user using all_squash.
  • root_squash – This property translates client-side requests from the root user to an anonymous UID / GID.
  • the nfs root directory is specified by the entry denoted by fsid=0.

Now export the created share with the command below:

$ sudo exportfs -arv
exporting 192.168.1.196:/mnt/music

In the above command:

  •  -a shows that all directories will be exported
  •  -r is for re-exporting all directories while
  • -v displays verbose output.

You may also use the command below to confirm the export list:

$ sudo exportfs -s
/mnt/music  192.168.1.191(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)

Step 5: Configure NFS Client

On the client side we are going to use Arch machine.

The commands following are used to configure the nfs client on Arch:

sudo pacman -Syu
sudo pacman -S nfs-utils

Now, start the installation process:

resolving dependencies...
looking for conflicting packages...

Packages (1) nfs-utils-2.8.2-2

Total Download Size:    0.38 MiB
Total Installed Size:   1.27 MiB
Net Upgrade Size:      -0.32 MiB

:: Proceed with installation? [Y/n] y

After installation is complete, start and enable nfs-client.target:

sudo systemctl start nfs-client.target
sudo systemctl enable nfs-client.target

Now check if nfs-client.target is active and running:

$ systemctl status nfs-client.target
● nfs-client.target - NFS client services
     Loaded: loaded (/usr/lib/systemd/system/nfs-client.target; enabled; preset: disabled)
     Active: active since Tue 2025-02-25 18:59:39 EAT; 13s ago
 Invocation: 08dacdfcff6841fbbb2e9fdbdc83a656

Feb 25 18:59:39 manjaro systemd[1]: Reached target NFS client services.

With the following command, we can now see mount information for the nfs server:

$ showmount -e 192.168.1.196
Export list for 192.168.1.196:
/mnt/music 192.168.1.191

We must now establish a directory in which to mount the exported file share. Use the commands listed below:

sudo mkdir -p ~/mnt/music
sudo mount -t nfs -o vers=4 192.168.1.196:/mnt/music ~/mnt/music

For persistent mount even after reboot, update fstab as below.

Open the /etc/fstab file as follows:

sudo vim /etc/fstab

Add the following contents to the file above:

192.168.1.196:/mnt/music   ~/mnt/music   nfs   defaults,timeo=900,retrans=5,_netdev	0 0

Create a test file in the nfs server share directory and check if the identical file exists on the nfs client to ensure that the nfs share is working. Create a test file on the nfs server like follows:

sudo touch /mnt/music/test.txt
sudo touch /mnt/music/main.py

On the nfs client, check for the file:

$ ls -l ~/mnt/music
total 0
-rw-r--r-- 1 root root 0 Feb 25 19:30 main.py
-rw-r--r-- 1 root root 0 Feb 25 19:33 manjaro.tf
-rw-r--r-- 1 root root 0 Feb 25 19:29 test.txt

Conclusion

That is all about this guide. On Arch | Manjaro | Garuda Linux, you have successfully installed and configured NFS server and client. I hope you found this guide useful.

Below are some other guides that you might find useful:

Related Articles

AlmaLinux Configure Software RAID on Rocky Linux 10 / AlmaLinux 10 using mdadm CentOS Setup GlusterFS Storage With Heketi on CentOS 8 / CentOS 7 macos Find File Duplicates on Linux/macOS/Windows using dupeGuru Security Free & Easy Way for SD Card Data Recovery | Fix Corrupted SD Card

Leave a Comment

Press ESC to close