I recently installed TrueNAS and attempted to setup NFS. Here are some notes that may be of use to others or my future self 😄
My use case is to mount the NFS share on demand, backup my home directory, then immediately unmount.
Under Services -> NFS:
- Enable NFSv4. Because, why not? NFSv4 is better.
- Enable ‘NFSv3 ownership model for NFSv4’. This permits UID/GID to be preserved without needing ID mapper running on client side.
Under Sharing -> Unix Shares:
- Create a dataset for the NFS share. Be sure to set a quota to something sensible.
- Create the NFS share with defaults
- Create a TrueNAS user with the same UID as the user that will be using the NFS share
- Drop into command shell on Truenas and navigate to the new NFS share root. Create a directory under the root and
chownit to the user that will use it e.g.
cd /mnt/Seagate4TB/nfsshare mkdir home-backup chown ian home-backup
- add an entry to /etc/fstab e.g.
truenas.lan:/mnt/Seagate4TB/nfsshare /mnt nfs4 noauto,defaults
/mnt/Seagate4TB/nfsshare/ is the NFS root.
- add entry to
sudoersto enable non-root user to mount the NFS mountpoint:
ian ALL=(ALL) NOPASSWD: /usr/bin/mount /mnt, /usr/bin/umount /mnt
Now user ‘ian’ should be able to write into /mnt/home-backup.