Sunday, 28 December 2025

NFS - Network File System

Network File System (NFS) is used to mount external sources of files between Linux/Unix servers.

Nowadays, I think most people use SAMBA (SMB) as that also allows Windows to join the club, but I decided to try NFS (again).

I used to work with NFS back in the past, but it seems to still be viable.

On the server

We will be sharing the directory /mnt/raid.

I've edited the file /etc/exports.d/raid.exports to contain2:

/mnt/raid 192.168.2.0/24(rw,sync,no_root_squash)
rw
read and write access
sync
is the default, makes certain new requests only get a reply when changes have been committed to stable storage
no_root_squash
By default root files are re-mapped to nobody, to prevent write-access etc. in my case, I wish to edit files using root. I don't mind the security consequences very much in my home situation

To apply changes to this file, run "exportfs -ra" or restart the NFS server.

Start services:

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

On the client

To view all mountable directories of a certain server, try this:

# mount | grep raid
watson:/mnt/raid on /mnt/raid type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,fatal_neterrors=none,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.2.1,local_lock=none,addr=192.168.2.6)

Or of course try "cat /proc/mounts".

Then, on the client, mount the directory:

# mount -t nfs -o vers=4 watson:/mnt/raid /mnt/raid

Surprisingly, I did not have to actually change any configuration of the NFS service.

Works surprisingly well.

References

[1] Fedora Server User Documentation - File sharing with NFS – Installation
https://docs.fedoraproject.org/en-US/fedora-server/services/filesharing-nfs-installation/
[2] My Blog - My Current MDADM Setup
https://randomthoughtsonjavaprogramming.blogspot.com/2024/09/my-current-mdadm-setup.html

No comments:

Post a Comment