Set up a NFS server
In this section, we will learn how to set up a NFS server on cPouta.
We will demonstrate a simple tutorial on how to create your NFS server with two services:
NFS Kernel Server
This is the built‑in NFS server available in all major Linux distributions (Ubuntu, Debian, CentOS, Rocky, AlmaLinux, etc.).
Why choose it?
-
Stable, widely used, production‑proven
-
Easy to install and configure
-
Perfect for simple shared storage or lab environments
-
Works well as long as performance and scale needs are moderate
NFS Ganesha
NFS‑Ganesha is a full NFS server that runs in userspace rather than kernel space.
Why choose it?
-
Supports NFSv3, NFSv4.1, NFSv4.2
-
Can export many backend types, including:
-
POSIX filesystems
-
CephFS
-
GlusterFS
-
S3‑like object storage (via FSAL plugins)
-
-
Hot‑reloadable configuration
-
Good for scale‑out deployments
NFS Kernel Server
Server side
Access from the outside
This tutorial shows how to set up the access in a private network, typically two (or more) Pouta machines in the same CSC project. If you want to access the NFS server from the outside, don't forget to create a Security Groups that allows the port 2049. It might be also necessary if your machines have a Floating IP associated.
Note
The following commands were executed on Ubuntu 24.04 and AlmaLinux 9.
-
Create and attach a volume on your machine, then use the volume into your machine. For our example, the mount point will be named
/srv/nfs4 -
Update the system and install the
nfs-kernel-serverpackage. For Ubuntu, runFor AlmaLinux, run
-
Enable the service
-
Edit
/etc/exportsand add this line:192.168.1.0/24: allow the clients in this IP rangerw: allow read and writefsid=0: designate the exported root (mandatory for NFSv4).no_subtree_check: disable the verification of the exported subtree (recommended)crossmnt: allow the NFS server to include the nested mount points within the exported directory, so clients can access the mounted file systems inside the exported path.
-
Save and exit. Apply the configuration:
-
Verify the exports
Client side
-
Update the system and install the
nfs-commonpackage. For Ubuntu, runFor AlmaLinux, run
-
Create the mount point
-
Mount manually
a. You can mount with some optimised parameters
sudo mount -o rsize=1048576,wsize=1048576,nconnect=4,noatime <server_ip_address>:/srv/nfs4 /mnt/nfs/share/rsize=1048576: set the read block size to 1 MB (to be tested depending on bandwidth)wsize=1048576: same but the write blocknconnect=4: open 4 parallels TCP connections for transfer (useful on low-latency networks)noatime: remove the update of the access date with each read, reducing disk writes
Info
You may need to add the 'insecure' option to allow macOS clients to access the share.
-
You can test the Read/Write performance
The recommended way is to add the mount point in the
/etc/fstabfile:<server_ip_address>:/ /srv/nfs4 nfs4 defaults,noatime,tcp,rsize=1048576,wsize=1048576,nconnect=4 0 0If your client reboot, it will be automatically mounted
NFS Ganesha
Server side
Access from the outside
This tutorial shows how to set up the access in a private network, typically two (or more) Pouta machines in the same CSC project. If you want to access the NFS server from the outside, don't forget to create a Security Groups that allows the port 2049. It might be also necessary if your machines have a Floating IP associated.
Note
The following commands were executed on Ubuntu 24.04 and AlmaLinux 9.
-
Create and attach a volume on your machine, then use the volume into your machine. For our example, the mount point will be named
/srv/nfs4 -
Update the system and install the
nfs-ganeshaandnfs-ganesha-vfspackages. For Ubuntu, runFor AlmaLinux, run
-
Make a copy of the default config
-
Edit the configuration file
sudo vi /etc/ganesha/ganesha.conf ## These are core parameters that affect Ganesha as a whole. NFS_CORE_PARAM { ## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4, ## instead of using the physical paths. mount_path_pseudo = true; } ## Configure an export for some file tree EXPORT { ## Export Id (mandatory, each EXPORT must have a unique Export_Id) Export_Id = 1; ## Exported path (mandatory) Path = /srv/nfs4; ## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true) Pseudo = /nfs; ## Restrict the protocols that may use this export. This cannot allow ## access that is denied in NFS_CORE_PARAM. Protocols = 3,4; ## Access type for clients. Default is None, so some access must be ## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block Access_Type = RW; ## Whether to squash various users. Squash = root_squash; ## Allowed security types for this export Sectype = sys; ## Exporting FSAL FSAL { Name = VFS; } ## You can make custom rules for certain clients (R, W, RW) CLIENT { Clients = 192.168.1.0/24; Access_Type = RW; } } ## Configure logging. Default is to log to Syslog. Basic logging can also be ## configured from the command line LOG { ## Default log level for all components Default_Log_Level = WARN; }This is a basic configuration. You can browse through the configuration file and customise it to your liking.
-
On AlmaLinux, the repository only provides the repo-configuration package, not the actual Ganesha service unit or daemon. You need to create it
sudo vi /etc/systemd/system/ganesha.service [Unit] Description=NFS-Ganesha NFS server After=network.target [Service] Type=forking PIDFile=/run/ganesha/ganesha.pid ExecStart=/usr/bin/ganesha.nfsd -f /etc/ganesha/ganesha.conf -L /var/log/ganesha/ganesha.log -p /run/ganesha/ganesha.pid ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure [Install] WantedBy=multi-user.targetSave, exit and reload
-
Verify the exports
Client side
-
Update the system and install the
nfs-commonpackage. For Ubuntu, runFor AlmaLinux, run
-
Create the mount point
-
Mount manually. Since we are using
mount_path_pseudo = truein the ganesha server, you must mount the share using the mount pseudo (nfs)a. You can mount with some optimised parameters
sudo mount -o rsize=1048576,wsize=1048576,nconnect=4,noatime <server_ip_address>:/nfs /mnt/nfs/share/rsize=1048576: set the read block size to 1 MB (to be tested depending on bandwidth)wsize=1048576: same but the write blocknconnect=4: open 4 parallels TCP connections for transfer (useful on low-latency networks)noatime: remove the update of the access date with each read, reducing disk writes
Info
You may need to add the 'insecure' option to allow macOS clients to access the share.
-
You can test the Read/Write performance
The recommended way is to add the mount point in the
/etc/fstabfile:If your client reboot, it will be automatically mounted