accessing datasets trough Nextcloud sync

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
Hey there, how is it possible to expose all datasets to NextCloud and access them trough sync.

I have a vdev with two mirror HDDs and a vdev with two mirror SSDs, with dataset /live data/
The SSD one hosts documents, System Data Pool etc. which are frequently used and the HDDs host data
which is rarely used, this is basically my archive, and my dataset there is also called /archive/

I need to be able to sync (access data trough the nextcloud sync app) from and to both (and maybe future) datasets.

My solution would be to create a third dataset, for /home/ of the users,
symlink the root of /Documents/ and /Archive/ to my home folder and
then set that /home/ dataset as "Hostpath For NextCloud Data Volume"

is this acceptable or is there an more TrueNasScale-good-practice way to achieve that?
 
Last edited:

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
Hey there, how is it possible to expose all datasets to NextCloud and access them trough sync.

I have a vdev with two mirror HDDs and a vdev with two mirror SSDs, with dataset /live data/
The SSD one hosts documents, System Data Pool etc. which are frequently used and the HDDs host data
which is rarely used, this is basically my archive, and my dataset there is also called /archive/

I need to be able to sync (access data trough the nextcloud sync app) from and to both (and maybe future) datasets.

My solution would be to create a third dataset, for /home/ of the users,
symlink the root of /Documents/ and /Archive/ to my home folder and
then set that /home/ dataset as "Hostpath For NextCloud Data Volume"

is this acceptable or is there an more TrueNasScale-good-practice way to achieve that?

Only catch I can think of is that symlinks will not traverse datasets in this case. So if you mount /home, any symlinks there need to also be pointing to locations in /home dataset as well.
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
Hey @Kris Moore , thx for the reply :)

Does that mean, that I cant do this? ln -s /mnt/archive/archive data/ --> /mnt/live/live data/home/archive
as ln cant cross datasets eg /mnt/live/* to /mnt/archive/* ?

I hope I dont go to far by asking: why is that?
or
does anyone have an other idea for this?
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
Its due to the way mounts work to containers. Since you have different pools if you mounted in the "archive" pool, it would be visible to the container, but the "live" pool would not. Any sym-links on the 'archive' pool to the 'live' pool would not be valid from inside the containers perspective.

One way to potentially solve this is in NextCloud to mount additional storage via SMB as well and attach as a client, which can be done through their interfaces.
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
Oh, darn, thx for clarification, didn't think about the containerization...

I try to stay local and low overhead as possible, so SMB would be some kind of last resort, but thx for pointing that out!

is there any possible (maybe also in the future) where this 'rights issue' regarding "containers can only see their own pool",
will be solvable, or is a little hack possible?
 

Kris Moore

SVP of Engineering
Administrator
Moderator
iXsystems
Joined
Nov 12, 2015
Messages
1,471
The way the mounts work I would expect the right fix will be to allow multiple mounts to each container, so that you can have /archive and /live appear inside the container simultaneously. I'll check with the group to see if/when that may be possible though/
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
The way the mounts work I would expect the right fix will be to allow multiple mounts to each container, so that you can have /archive and /live appear inside the container simultaneously. I'll check with the group to see if/when that may be possible though/
thanks a lot! Thats very kind of you Kris :)
 

skittlebrau

Explorer
Joined
Sep 1, 2017
Messages
54
I'd suggest using the official NextCloud Docker image and launch a custom Docker container with the SCALE/Kubernetes UI. You still get easy updates from the official NextCloud Docker image maintainer which you can process in SCALE's UI with just a button click.

When mapping out your bind mounts, don't mount anything directly into the root NextCloud data directory and instead mount your separate datasets so they appear as folders inside the container's root data directory.

For example:
/var/www/html/data/live data [mapped from /mnt/tank1/live data on the host]
/var/www/html/data/archive [mapped from /mnt/tank2/archive on the host]

I do something very similar with datasets from different pools mounted inside a contained /sync directory in Resilio Sync and it works fine.
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
I'd suggest using the official NextCloud Docker image and launch a custom Docker container with the SCALE/Kubernetes UI. You still get easy updates from the official NextCloud Docker image maintainer which you can process in SCALE's UI with just a button click.

When mapping out your bind mounts, don't mount anything directly into the root NextCloud data directory and instead mount your separate datasets so they appear as folders inside the container's root data directory.

For example:
/var/www/html/data/live data [mapped from /mnt/tank1/live data on the host]
/var/www/html/data/archive [mapped from /mnt/tank2/archive on the host]

I do something very similar with datasets from different pools mounted inside a contained /sync directory in Resilio Sync and it works fine.
thx for the feedback!

If there shouldn't be a selfcontained TrueNas solution, I'll definitely give it a try, but as of right now, the ongoing discussion in this thread looks so promising to me, that I will wait a little longer :)
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
As this thread started as an idea, it just became obsolete, because I tried it and found out that NextCloud doesn't allow symbolic links (since 2016) :rolleyes:

Using SMB is for no avail, because the Dockerimage doesn't bring the php-smbclient with it and I fail to install it persistently. And I wonder how those changes would survive any kind of TrueNas upgrade, or upgrade of the Dockerimage, or both at once.

I also tried to use mnt, but there is also a stop for me, just there:

walter@nas02:/$ sudo mount -t zfs /mnt/archive/archive-data/ /mnt/live/live-data/nextcloud-data/data/walter/files/Archive
filesystem '/mnt/archive/archive-data/' cannot be mounted, unable to open the dataset

same for

walter@nas02:/$ sudo mount -t zfs /mnt/live/live-data/home/walter/Documents/ /mnt/live/live-data/nextcloud-data/data/walter/files/Documents
filesystem '/Documents/' cannot be mounted, unable to open the dataset
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
walter@nas02:/$ sudo mount -t zfs /mnt/archive/archive-data/ /mnt/live/live-data/nextcloud-data/data/walter/files/Archive
filesystem '/mnt/archive/archive-data/' cannot be mounted, unable to open the dataset
Try sudo mount -t nullfs /mnt/archive/archive-data/ /mnt/live/live-data/nextcloud-data/data/walter/files/Archive

To mount a directory in another location you use nullfs. A zfs dataset is only mounted once via zfs mount.
 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
walter@nas02:/$ sudo mount -t nullfs /mnt/archive/archive-data/ /mnt/live/live-data/nextcloud-data/data/walter/files/Archive
mount: /mnt/live/live-data/nextcloud-data/data/walter/files/Archive: unknown filesystem type 'nullfs'.


I also didn't find it at: https://man7.org/linux/man-pages/man8/mount.8.html

Code:
/proc/filesystems 

nodev   sysfs
nodev   tmpfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cgroup2
nodev   cpuset
nodev   devtmpfs
nodev   debugfs
nodev   tracefs
nodev   securityfs
nodev   sockfs
nodev   bpf
nodev   pipefs
nodev   ramfs
nodev   hugetlbfs
nodev   devpts
nodev   mqueue
nodev   pstore
nodev   zfs
nodev   autofs
nodev   efivarfs
nodev   configfs
        fuseblk
nodev   fuse
nodev   fusectl
nodev   overlay
nodev   binfmt_misc



Code:
walter@nas02:/lib/modules/5.10.18+truenas/kernel/fs$ ls -l

total 82

drwxr-xr-x 2 root root     3 Apr 22 21:47 9p
drwxr-xr-x 2 root root     3 Apr 22 21:47 adfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 affs
drwxr-xr-x 2 root root     3 Apr 22 21:47 afs
drwxr-xr-x 2 root root     3 Apr 22 21:47 autofs
drwxr-xr-x 2 root root     3 Apr 22 21:47 befs
drwxr-xr-x 2 root root     3 Apr 22 21:47 bfs
-rw-r--r-- 1 root root 33352 Feb 10 13:58 binfmt_misc.ko
drwxr-xr-x 2 root root     3 Apr 22 21:47 btrfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 cachefiles
drwxr-xr-x 2 root root     3 Apr 22 21:47 ceph
drwxr-xr-x 2 root root     3 Apr 22 21:47 cifs
drwxr-xr-x 2 root root     3 Apr 22 21:47 coda
drwxr-xr-x 2 root root     3 Apr 22 21:47 configfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 dlm
drwxr-xr-x 2 root root     3 Apr 22 21:47 ecryptfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 efivarfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 efs
drwxr-xr-x 2 root root     3 Apr 22 21:47 erofs
drwxr-xr-x 2 root root     3 Apr 22 21:47 exfat
drwxr-xr-x 2 root root     3 Apr 22 21:47 ext4
drwxr-xr-x 2 root root     3 Apr 22 21:47 f2fs
drwxr-xr-x 2 root root     5 Apr 22 21:47 fat
drwxr-xr-x 2 root root     3 Apr 22 21:47 freevxfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 fscache
drwxr-xr-x 2 root root     5 Apr 22 21:47 fuse
drwxr-xr-x 2 root root     3 Apr 22 21:47 gfs2
drwxr-xr-x 2 root root     3 Apr 22 21:47 hfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 hfsplus
drwxr-xr-x 2 root root     3 Apr 22 21:47 hpfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 isofs
drwxr-xr-x 2 root root     3 Apr 22 21:47 jbd2
drwxr-xr-x 2 root root     3 Apr 22 21:47 jffs2
drwxr-xr-x 2 root root     3 Apr 22 21:47 jfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 lockd
-rw-r--r-- 1 root root 20768 Feb 10 13:58 mbcache.ko
drwxr-xr-x 2 root root     3 Apr 22 21:47 minix
drwxr-xr-x 5 root root     9 Apr 22 21:47 nfs
drwxr-xr-x 2 root root     5 Apr 22 21:47 nfs_common
drwxr-xr-x 2 root root     3 Apr 22 21:47 nfsd
drwxr-xr-x 2 root root     3 Apr 22 21:47 nilfs2
drwxr-xr-x 2 root root    53 Apr 22 21:47 nls
drwxr-xr-x 5 root root     9 Apr 22 21:47 ocfs2
drwxr-xr-x 2 root root     3 Apr 22 21:47 omfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 orangefs
drwxr-xr-x 2 root root     3 Apr 22 21:47 overlayfs
drwxr-xr-x 2 root root     5 Apr 22 21:47 pstore
drwxr-xr-x 2 root root     3 Apr 22 21:47 qnx4
drwxr-xr-x 2 root root     3 Apr 22 21:47 qnx6
drwxr-xr-x 2 root root     5 Apr 22 21:47 quota
drwxr-xr-x 2 root root     3 Apr 22 21:47 reiserfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 romfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 squashfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 sysv
drwxr-xr-x 2 root root     3 Apr 22 21:47 ubifs
drwxr-xr-x 2 root root     3 Apr 22 21:47 udf
drwxr-xr-x 2 root root     3 Apr 22 21:47 ufs
drwxr-xr-x 2 root root     3 Apr 22 21:47 vboxsf
drwxr-xr-x 2 root root     3 Apr 22 21:47 xfs
drwxr-xr-x 2 root root     3 Apr 22 21:47 zonefs
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Sorry - my bad. Linux ...

 

derWalter

Explorer
Joined
Dec 5, 2020
Messages
88
Okay, stranded again :)

I created the mounting destination folders via ssh (and give it owner and group www-data), but NextCloud couldn't see them.

I scanned the folder to reinitialize the folder structure by using "runuser -u www-data -- php occ files:scan --all" in the shell of the NextCloud container.
But NextCloud still couldn't see them.

So I created the Archive or Documents folder inside of NextCloud, they show up in the NextCloud UI and I could write into them via NextCloud UI, nice.
But when I mounted my Documents and archive-data to those NextCloud created folders, they stayed empt when writing files inside the NextCloud UI into them.

So, after unmount'ing them again, I could also see all the contents from the NextCloud UI via ssh...

My conclusion is: NextCloud seems to work directly with the inodes of the folders :(

As hardlinks wont work with directories, I hereby ran out of ideas how to directly access and write to my data with/inside of NextCloud.


Any (hopefully easy) suggestions?



ps.: Am I wrongly assuming that my task is a quite regular use case (for a newly staring home user)?
  1. Install TrueNas
  2. setup data
  3. install NextCloud (easy and working till here)
  4. pick the folders to sync and work with (problem starts when setting up Nextcloud with "Nextcloud data directory * " vs "Host path for NextCloud Data Volume" --> now I know it but till I found out what is the funtion of what, and that one is inside the container and must not be touched (why is it even a exposed option?), the other is the outside represenation of the userdata one work with inside NC as a user, took me some tinkering, as hours of reading and researching didn't make it clear :P )
  5. done
 
Last edited:
Top