External Storage in Nextcloud under TrueNAS Core

This resource was originally made by user: asap2go on the TrueNAS Community Forums Archive. Please DM this account or comment in this thread to claim it.

First thing is go to Storage → Pools:

There you probably already made a pool.
Just in case I’ll show you.
Click on “Add”:

Then Create new pool:

Add the disks in the layout you want. For example if you have 6 HDDs then go for one VDEV in a raidz2 config.
In case of 4 disks just make to mirrored VDEVs.
My virutal machine only has one drive so I just add that:

And hit create.

Now we have a pool, but we need a dataset to actually use it:

Let’s just keep the defaults except ShareType. This should be set to SMB as we plan to share it later:

Then hit submit.

Now we are up and running with the basics.
If you already did all of that: Good.

Now what we want do is make our dataset accessible via SMB.
To do that we go to Services → SMB → start:

Then go to Sharing ->Windows Shares (SMB) and click add:

Select the dataset you want to share via SMB. Default options should be fine as they are. Then hit Submit.

It will tell you that it will auto enable the SMB service. Click okay you should now see the SMB share up and running:

Now we need a user that actually has access to the SMB share. So we go to Accounts → Users → Add:

select a username, a secure password that you want to use as authentification for SMB and under Directories and Permissions we select what dataset we want to have access to. In My case I jsut chose My_Dataset as it is the only one available:

Then click submit.
Now go to windows explorer, then right click on ThisPC → map a network drive:

1698075857627.png

Then choose a Drive Letter and enter the location.
Be aware that your truenas system is simply called truenas instead of truenascore.
I just changed that because it would conflict with my real truenas.
Also select “Connect using different credentials”. Because the user we created in TrueNas is not your Windows User which windows will attempt to login by default.

After you flick finish Windows will as you to enter the credentials:

Do that , click OK et voila:

SMB up and running.

Now for the NextCloud part.
Go To Plugins → NextCloud → Install → choose a name and click Save.
Nextcloud will install:

After the Installation it should show as “up”.

Now we have two methods to share files with nextcloud.
The first is the easy solution. External storage “local”.
For this we need to stop nextcloud again:

Then click on Mount Points:
Actions → Add:

Choose the dataset to share (in my case My_Dataset) under source and “mnt/My_Dataset” under Destination as target (you have to enter the “/My_Dataset” manually:

This way it will mount under nextcloud. Hit submit.

Because nextcloud is running under a systemuser called “www” that user needs permissions to access My_Dataset.
To do that we got to: Storage → Pools → My_Dataset → Edit Permissions:

Scroll to the end of the list and click Add ACL Item:

Under Who* you select User
And in the User field you enter www. Permissions should be fine by default (Basic, Modify).
Check: Apply premissions recursively
And if you have more datasets below My_Dataset then also check apply permissions to child datasets:

Click Save.

Go back to Jails → Nextcloud → Start.
Wait for it to start up and copy the address for the admin portal:

and login with the credentials you find under “Post Install Notes”:

Now click on the “N” on the top right and choose Apps:

Scroll down until you find “External Storage support”. Enable it:

Now go to Administration settings:

and choose External storage (under the Administration section. Not under Personal!):

Here we enter the Folder Name that NextCloud should display to the users. E.g. TrueNAS_Storage or just the name of the dataset (which I used)
Then the Storage Method “Local” and the path to the storage “/mnt/My_Dataset” which we defined in the Mount Points. You can also select which NextCloud users may access the folder:

Click on the Check arrow on the right and the entry should be marked green on the left side. This means everything works and NextCloud can access the dataset/folder.

Go To files and try uploading a test file. It should work:

It’s quite late and there might be errors or practices which should be avoided.
If any of the more experienced users could point these out that’d be great :slight_smile: