Due to space restrictions, my tv shows are distributed to two ext4 USB drives. Exemplary directory structure is like this:
/media/drive1/tvshows/show1
/media/drive1/tvshows/show3
/media/drive2/tvshows/show2
/media/drive2/tvshows/show4
As I might want to later replace drive1 with a bigger drive and get all shows back together on one USB device, I want Kodi to use both drives in a single library. This can easily be achieved with symlinks:
The Kodi tvshow library points to /media/drive1/tvshows/. Directory structure looks like this:
/media/drive1/tvshows/show1
/media/drive1/tvshows/show2 -> /media/drive2/tvshows/show2
/media/drive1/tvshows/show3
/media/drive1/tvshows/show4 -> /media/drive2/tvshows/show4
This works fine for Kodi, all links in the tv show database will point to drive1 only.
Now I want to expose this whole directory structure via samba. I can of course have shares for both drives separately, but it would be nicer to have one share for both. Seemingly there is two ways to achieve this:
1. Via follow symlinks in samba.conf
The problem is that follow symlinks does not allow links across file system borders. So the additional option wide links = yes must be set per share. It seems though that the necessary module is not part of LibreELEC, log.smbd reports the following:
[2022/06/20 13:36:33.446886, 0] ../../lib/util/modules.c:49(load_module)
Error loading module '/usr/lib/vfs/widelinks.so': /usr/lib/vfs/widelinks.so: cannot open shared object file: No such file or directory
[2022/06/20 13:36:33.447224, 0] ../../source3/smbd/vfs.c:185(vfs_init_custom)
error probing vfs module 'widelinks': NT_STATUS_UNSUCCESSFUL
[2022/06/20 13:36:33.447399, 0] ../../source3/smbd/vfs.c:379(smbd_vfs_init)
smbd_vfs_init: widelinks enabled and vfs_init_custom failed for vfs_widelinks module
[2022/06/20 13:36:33.447515, 0] ../../source3/smbd/service.c:636(make_connection_snum)
make_connection_snum: vfs_init failed for service drive1
This whole approach is also not recommended (not even by the samba team), as it poses a security risk.
2. Via bind mounts
Using bind mounts instead of symlinks is supposed to achieve the same thing:
mount --bind /media/drive2/tvshows/show2 /media/drive1/tvshows/show2 works as expected. But how can I make these mounts being executed at boot time? As /etc/fstab is not being used by LibreELEC, I am not sure which other way I have to approach - do I use udev rules or systemd .mount files? And either way, does somebody have an example on how to do that? Because I am familiar with neither and from initial search it looked somewhat complicated (do I need to use systemd-mount with udev?).
3. Insert your proposal here
Maybe there is a third or completely different approach that I missed. I am happy for every other suggestion. Thanks!