Sharing External Libraries to Immich LXC container with TrueNAS CIFS and NFS share

70tas

New Member
Dec 20, 2023
18
2
3
Since I can't easily mount from an LXC non-privileged container, I've tried to bind the storage from the host.
I am using DigiKam for my camera photo collection and share it as CIFS/SMB. So I was able to mount it on the PVE host as shown in docs.lunyaa.dev; all worked as expected, and I was able to see the storage in the LXC container. However, every time I tried to scan the external storage through Immich, I got an error reading the library, or in a couple of cases an invalid external library.
I probably could have made it work by playing with security options in the NAS and in the mount, but it took too much time, for what will be a read only library; that is I will not be using Immich to edit my photos, but will continue with DigiKam for now. My intent is to import our iPhone photos, mostly as a backup to Immich.

So the way I made it work is by exporting the DigiKam root directory by NFS, and doing an NFS bind to from the PVE host to the LXC. This was easier and simpler than SMB.
1. Create the host mount directory, i.e. /mnt/immich/nfs/lx_fotos
2. Add the mount to the host's /etc/fstab, as:
nas01:/mnt/nas01/smb3/media/lx_fotos /mnt/immich/nfs/lx_fotos nfs
(nas01 is the name of the NAS server; the first path is the NFS export path, and the second path is the mount path on the PVE host;
Create the path on the host with 'mkdir -p /mnt/immich/nfs/lx_fotos'
3. Run 'systemctl daemon-reload'; run 'mount -a'; verify that /mnt/immich/nfs/lx_fotos is showing the properfiles and directories
4. Add the following command to the end of the /etc/pve/lxc/XXX.conf file of the Immich container:
"mp0: /mnt/immich/nfs/lx_fotos,mp=/nfs/lx_fotos," the first path is the PVE host path, and the second is the path on the LXC container to bind to.
5. On the Immich container's CLI, create the path, such as 'mkdir -p /nfs/lx_fotos'
6. Restart the container and verify the data is under the /nfs/lx_fotos path
That is it; easy peasy...

In the Immich GUI, as administrator, assign and import the external library as "/nfs/lx_fotos"; You will get errors, until the library is scanned and thumbnails created.