TrueNAS NFS Setup For XCP-ng and Linux
In the video below, we cover how to set up NFS Shares in TrueNAS
Several operating systems can take advantage of NFS
This is more popular for Linux computers and hypervisors so we also cover how to configure a Linux client and an XCP-ng hypervisor
One of the main benefits for hypervisors like XCP-ng is that NFS provides an opportunity to provide shared storage between nodes
This allows VMs to be migrated from one node to another
Whilst not as fast as iSCSI, one of the benefits of using NFS on a NAS like TrueNAS is that the NAS has visbility of the files making it easier to backup and restore individual files for individual VMs, without requiring additional software
We begin with how to create user and group accounts in TrueNAS for access permissions, how to create a dataset and how to share that using Unix shares aka NFS
Next we show how to attach to an NFS share for use as an ISO storage for XCP-NG
Because we want to upload CD images to this share, we cover how to create a matching user and group account in Linux so that the name and IDs match
For example,
sudo addgroup --gid 3000 grpxcpusers
sudo adduser --uid 2000 fred
sudo usermod -g grpxcpusers fred
Then we show how to install the NFS client software (nfs-common) on a Linux computer to be able to mount NFS shares as well as Autofs to automate the mounting and mapping of an NFS share to a folder
For example,
sudo apt update
sudo apt install nfs-common
sudo ap install autofs
sudo nano /etc/auto.master
/nfs /etc/auto.nfs
sudo nano /etc/auto.nfs
ISOs -fstype=nfs4 172.16.20.30:/mnt/Pool1/ISOS
And how to update the client software for use with NFS version 4
sudo nano /etc/default/nfs-common
NEED_IDMAPD=yes
NEED_GSSD=no # no is default
sudo service autofs reload
Because the user and group accounts do not show correctly on the Linux computer we show how to correct the domain mapping issue
For example
sudo nano /etc/idmapd.conf
Domain=templab.lan
Because shared storage is a very useful feature for hypervisors like XCP-NG we demonstrate how to set up a VDI storage in XCP-ng to advantage of an NFS share in TrueNAS
Finally we cover the performance pitfalls of NFS and how you can disable the synchronous writes in TrueNAS to get around this, but also the preferred option of how to create a ZLog aka write cache in a TrueNAS system that uses ZFS
Sharing is caring!