So I have two TrueNAS Scale servers and they both have a number of SMB shares they expose. On server1 I expose two, let’s call them share1 and share2, which contain data a bunch of other servers/clients/dockers will need to use. On server2 I was trying to automount those two shares so they are always available to apps, dockers, clients, etc at boot on server2.
I have tried a couple of things at this point but nothing that seems to work as expected.
The first thing I tried was to manually mount via modifying the /etc/fstab and adding two entries for the CIFS shares, which works but results in those shares disappearing upon reboot. I suspect this is not where I should be doing it but couldn’t find a UI element that seems to permanently mount remote shares on boot. Ideally this is what I would want to do, just in a UI friendly/compatible way, or at least a way that results in these being mounted at boot and available for all dockers, etc from the get go.
The second thing I tried was mount the external SMB shares as detailed in the truenas docs under the SMB section: setting-up-an-external-smb-share
Sorry won’t let me post a direct link for some reason…
However this seems to only expose the server1 shares as if they were local to server2 for users looking to mount shares from server2 only, but not actually mounting them anywhere local so as to be usable within the server2 system (eg local clients or dockers).
The last thing I tried was to simply mount the smb shares as part of the docker itself rather than mounting via host path, which only solves the docker usage of the shares but not general access on the server, but I couldn’t get that working either. I will say that the new AI search feature of the documentation was very cool and gave me this to try:
To mount an SMB share inside a Docker container on TrueNAS, you can follow these steps:
- Access the TrueNAS Web Interface: Log in to your TrueNAS system and navigate to the Apps section.
- Select the App: Choose the app you want to configure with an SMB share. This could be a custom app or a pre-installed one like Syncthing or Jellyfin.
- Configure Storage: In the app configuration, look for options related to storage or additional storage.
- Add SMB Share:
- Click Add to create a new storage entry.
- Set Type to SMB/CIFS Share (Mounts a volume to a SMB share).
- Enter the required details:
- Server: The IP address of the SMB server (e.g.,
192.168.1.100
). - Path: The name of the SMB share (e.g.,
my-share
). - Username: The username with access to the SMB share.
- Password: The password for the specified username.
- Domain: If applicable, enter the domain name; otherwise, use the default
WORKGROUP
.
- Server: The IP address of the SMB server (e.g.,
- Specify the Mount Path inside the container where the share will be accessible.
- Read Only Option: If you want the mounted path to be read-only, select the Read Onlyoption.
- Save and Deploy: Save your changes and deploy the app with the new configuration.
This setup allows you to synchronize data between the SMB share and your Docker container application on TrueNAS
but this resulted in the following error:
[2024/11/02 14:29:52] (ERROR) app_lifecycle.compose_action():56 - Failed ‘down’ action for ‘my_docker’ app: service “my_docker” refers to undefined volume cifs_64bb44ff623c2321df3a3ea1323abc6f720aad576a43f7435d39ad263287626c: invalid compose project
In this case it says to use the path as the share name, which is different from what it says in the docker configuration:
‘path’ : the path to mount the SMB share
This seems to indicate the path on the system where this should be mounted… which I guess doesn’t make sense for a SMB share being mounted only in a container.
The storage config looks like:
Type: SMB/CIFS
Mount path: /output
SMB config:
Server: 10.0.2.11
Path: ate
Username: hello
Password: **********
Domain: WORKGROUP
Any thoughts? I feel like I am overcomplicating this somehow and this should be easier than I am making it…