TrueNAS and NFS/SMB
I recently installed TrueNAS and setup an NFS share for my Linux backups and an SMB share for my wife’s Mac backups. Here are some notes that may be of use to others or my future self 😄
NFS
My use case is to mount the NFS share on demand, backup my home directory, then immediately unmount.
- Create a TrueNAS user with the same UID as the user that will be using the NFS share
Under Datasets
:
- Create a dataset for the NFS share. Be sure to set a quota to something sensible.
Under Shares
-> Unix (NFS) Shares
:
- Add a path to the dataset created above
- Select ‘Turn on service’ (3 dot menu)
Under System Settings
-> Services
-> NFS
(these should be set by default):
- Enable NFSv4
Other:
- Drop into command shell on Truenas and navigate to the new NFS share root. Create a directory under the root and
chown
it to the user that will use it e.g.
cd /mnt/Seagate4TB/nfsshare
mkdir home-backup
chown ian home-backup
NFS client
- add an entry to /etc/fstab e.g.
truenas.lan:/mnt/Seagate4TB/nfsshare /mnt nfs4 noauto,defaults
where /mnt/Seagate4TB/nfsshare/
is the NFS root.
- add entry to
sudoers
to 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.
SMB
My use case is to enable Time Machine backups from my wife’s Macbook Pro.
- Create a TrueNAS user with the same UID as the user that will be using the SMB share
Under Datasets
:
- Create a dataset for the SMB share.
- I created a top level share called ‘Macshare’ and set the quota to apply to all children
- underneath I create a dataset corresponding with each Mac user
- set permissions on the dataset to give the user owner/group permissions
Under Shares
-> Windows (SMB) Shares
:
- Add a path to the dataset created above
- Select type of ‘Basic time machine share’
- Select ‘Turn on service’ (3 dot menu)
- In SMB service config, enable ‘Apple SMB2/3 Protocol Extension’
Mac
- go to Time Machine settings and add a new destination. In my case it auto detected the share and I just had to select it
- enter the username/password setup earlier
Done!