Shares in TrueNAS

Shares in TrueNAS

Before TrueNAS there was Storage Spaces

For many years, I ran Windows Servers as my Storage Servers. The last version was Windows Server 2019, and with that, I used Storage Spaces.

Storage Spaces worked well, but it was never a good experience. The UI in Windows was pretty clunky, and you had to make various changes within Powershell to get the most from it. I ran many tests before settling on Storage Spaces with and without caching (which had to be configured with PowerShell), and it seemed to be as good as any other solution.

However, I changed to TrueNAS because of Storage Spaces’s unpredictable performance. Sometimes, everything ran without a problem, and then it crawled. I had a 10Gb network, a decent HBA, and plenty of disks, and sometimes, even with large files, everything was okay until it wasn’t. So, I jumped to TrueNAS, and since then, the speed has been the same – it didn’t change the hardware so it would be – but it has been consistent.

My use-case

I have always used my storage server for just storage. I don’t install or run other software on it. It is there to be a simple storage server. I primarily use it as a backup location and a file server for documents, videos, music, ISOs (and I do mean ISOs, not dodgy movies) and my ever-expanding books collection. I have a loft full of books; if available, I download their PDFs too. These are stored in my Books folder.

My TrueNAS server has a couple of Disk Pools installed. Each has an SSD as a Read Cache.

Currently, there are the following Datasets: –

  • DisksAndTemplates – this is used with Proxmox
  • ISOs – this is used with Proxmox
  • Software – all installation images I have built up over the years
  • Backups – this is used with Proxmox, Database backups and Client Image / Data backups
  • Kubernetes
  • Longhorn
  • Music
  • Videos

I also have a dump folder where I dump data from other machines as and when I need to move something from one server to another.

Each of these datasets is backed up to a Synology NAS in another building, and from there, they go up to a OneDrive account.

So, with all of that background, how do we define the shares?

Setting up Shares in TrueNAS

For each of my folders/datasets, I set up an NFS and an SMB share. In TrueNAS, creating Shares is easy, but the permissions side of things is more complex.

I usually create an SMB share first, but the sequence doesn’t make any difference.

To create an SMB share, select Sharing in the lefthand pane, click the Windows Shares link, and click the ‘Add’ button. It will display the screen below: –

image-102-1024x460 Shares in TrueNAS

In the top section, under the folder section, select the pool and folder to be shared. When you choose the folder, the name of the share will be populated with the folder, but you can change it if needed.

I usually leave each option as shown above and handle access to them using permissions, as I described below.

For an NFS share, I define those like this: –

image-104-1024x629 Shares in TrueNAS

To create an NFS share, select Sharing in the lefthand pane, click the Unix Shares link, and click the ‘Add’ button. As with the SMB share, you choose what you want to share in the folder section at the top of the screen and enter the details in the lower section.

I usually check the ‘All Dirs’ checkbox so clients can map to any folder under the selected path.

As I only want my Linux servers accessing my NFS shares, and I only set Unix shares on the folders that my Linux servers need, I put the Maproute User as a user I set up expressly for permissions on those shares. I also populate the Authorised Networks section with my local network details.

Permissions

To set up permissions on TrueNAS, you select the DataSet from the Pools area in the Storage section as shown below: –

image-105-1024x525 Shares in TrueNAS

When you select the DataSet, click the ‘…’ on the right side and select ‘Edit Permissions’. That displays the screen above where you can define the permissions.

For SMB shares, I usually set the permissions based on the Group I put my users in. It is much easier to set permissions on groups of users than having to do it on individual users.

For Unix shares, as I use a specific user in the Maproute section, I just define the permissions against that user.

Once the shares are up and running, you can use them from Windows by connecting using the correct UserID; for Unix shares, things rely on the servers defined in the network section on the share itself.

Stephen

Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.