Unable to have multiple NEXTCLOUD_MOUNT

Hi
i wanted to use multiple local_storages within the external storage plugin and i stupidly tried adding -e NEXTCLOUD_MOUNT="/mnt/folder1" -e NEXTCLOUD_MOUNT="/mnt/folder2" to my docker run command not realizing they’re environmental variables so now i’m stuck with just one of these folders available.

Which is the proper way to achieve this?

Hi, the correct way is using the parent folder. In your case -e NEXTCLOUD_MOUNT="/mnt/"

1 Like

But how do I mount multiple folders that do not share a parent folder?

I think it is not possible. But then how do you think to distribute e.g. 1000 users to 2 x 500 users on two mountpoints if Nextcloud only knows one data directory anyway?

'datadirectory' => '/var/www/nextcloud/data',

documentation

I think you need one parent folder.

1 Like

You can use the mount command to connect those directories as subdirectories of your mount directory. Or more precisely, you put the necessary mount command into /etc/fstab so that it is always mounted in the proper place.

Just for example, I wanted to make my paperless/consume directory available from NextCloud as an external store so that I could just copy/paste PDFs into it and they will be auto-processed by paperless.

My consume directory is here: /home/bhugh/paperless-ngx/consume

For NextCloud external storage purposes I needed it here: /mnt/paperless/consume

So the line in /etc/fstab looks like this:

/home/bhugh/paperless-ngx/consume /mnt/paperless/consume none defaults,bind 0 0

After putting it into /etc/fstab you can sudo mount -a to make sure it worked - no errors and you can check that the directory is in place with the expected files showing up.

Being in /etc/fstab it will be re-established again every time the machine is restarted.

Note that you might think you could do this by creating links - either hard or soft. But that won’t work for this purpose. But when the directories are mounted in a different location as I described, it’s handled at quite a low level of the operating system so to NextCloud they just appear to be “real” directories in that location. It’s much the same as mounting a hard drive in a certain location via a similar process. Once it’s mounted there you can just access it normally via the directory structure.

2 Likes