All Data on external storage possible?

Hi,
I’m really new to Nextcloud and I just finished my first installation inside a Debian 10 VM on my Synology NAS.
This means that also the files that I upload to my Nextcloud will be stored inside this VM.
But I want all files to be stored on a separate shared folder on my NAS.

I see big advantages by doing so:

  1. Backups are a lot easier since I can include them in my already existant automatic backups of the NAS.
  2. I also want to access the files locally via SMB/cifs. Nextcloud should just be used for accessing files over the Internet, Sharing, Calender etc.
  3. VM doesn’t grow to hundet of gigabytes
  4. VM snapshots include only the OS, webserver configuration and Nextcloud itself.

My first idea was to just mount that shared folder with fstab to the current location of my Nextcloud data folder (/var/nextcloud_data) but I see problems here:

  1. Probably unnecessary bad performance(?)
  2. File operations (add,change,delete) via SMB (without Nextcloud software) won’t be recognized by Nextcloud as far as I know.
  3. What about file permissions? If I create a file over SMB it probably doesn’t have www-data:www-data ownership?

Currently I have no idea how I could realize that.

I’m thankful for any help. :slight_smile:

  1. cant say anything about it
  2. run sudo -u www-data php /var/www//html/nextcloud/occ files:scan --all
    replace the path with your path, this will recognized the files in NC
  3. do chown …
  1. Unlikely. Or do you have +1000 user?
  2. Mount the share (nfs-local,smb,ftp,sftp,webdav) as external storage. nextcloud is than aware about file changes. → no need for occ file:scan --all
  3. if you use the external storage app this handle by nextcloud.

i have no idea why people want to run nc on synology. what is the usecase?

I can’t do that everytime I access a file, lol.

I’m looking for an automatic solution.

I’ll try that, thank you.

I’m running Nextcloud for the first time, so I want to evaluate it before I build a dedicated server with it.
But my plan is anyway to move away from Synology to a self built little homeserver and then run Nextcloud, webserver and other services there.

OK.

BTW: Three ways to get an evaluation installation: https://github.com/ReinerNippes
Nextcloud handsfree in 10-30 min. :wink:

run this in a cronjob, than it is automatic, like every 5 min or so

ist there a special way, i tried it and NC didn’t recognize…

sorry. probably a misunderstanding.

i meant you should use the nextcloud app “external storage”.

do not mount the share on os level.

maybe you have to install the app before you can use it. it’s not in the nextcloud default.

ahhh. OK now its clear, thanks!

Using the “External Storage” app to add the SMB share works great.
However this is not exactly what I wanted.

When I add the share this way, on the main page of nextcloud I see this share as a folder next to my already existing files.

What I wanted to do:
When I go to the main page of the nextcloud web interface and upload a file in the root directory, in the background this file should be stored on the smb shared folder instead of currently “/var/nextcloud_data”. So the user shouldn’t even realize there is a external storage involved.

Mounting the share on OS level and tell nextcloud to use this share as data location would work if the only goal is to store the files on the share. But I also want to access the files on the local network trough SMB without nextcloud involved. And if I do so, Nextcloud won’t realize changed/added/deleted files. Yes I could do it with a cronjob like Norry said, but if this was real-time it would be better. With the external storage app it is real time, but sadly the share then is accessibly only in a sub solder.

Do you guys understand what I mean? I hope so. :smiley:

2 Likes

Yes we do, but that’s not possible/feasible. NC is not a traditional file server, as Samba is. The kludge of running the file:scan command is the only possible way and it’s not a good one either.

If you want a file server, use one. If you want to access your file server from the internet, use a VPN. Don’t mix systems which are inherently agnostic to each other.

The current data location is /var/nextcloud_data
What if I move the contents of this folder to the share, then delete the folder and create a symbolic link from the share to /var/nextcloud_data?

Would this work or is it a super stupid idea?

Don’t know exactly, but I suppose this won’t work. The data folder does not only contain the user data, but other special folders as well. Putting these out of the control of NC is bound to be troublesome.

Maybe NC isn’t the solution you wanted it to be, there’s no fault in admitting that. On the other hand is also not advertised as a file server replacement, is it?

The solution was very easy.
Using the app “External Storage” but for “folder name” just enter “/”.

This mounts the external storage to the root directory.

As described here in german: https://decatec.de/home-server/nextcloud-tipps-tricks-fuer-admins-und-benutzer/ under “Externer Speicher als Haupt-Speicher”.

3 Likes

Hosting your Nextcloud data folder on SMB is probably asking for trouble, as is accessing it directly outside of Nextcloud.

Since the VM is already on your NAS, can you not just back up the VM as is?

If you decide to try a free backup agent to run inside the VM instead, take a look at Veeam.

Hi @JonSmith, I am interested in how this went for you and I have the same use case.

Did you experience any side effects after mounting an SMB share to “/”?

Hello,

I’m currently test the function and have the same question.
The side effects i found:

If the Storage doesn’t work nobody can log in. :wink: :smile: That’s clear, so you need a user with only local Storage. I solved that with an additional group and and do not include the admin in the group

You need the standards created by nextcloud on first login. I solved this by logging in once with the user, without the user being a member of the additional group.
If you don’t have the Standardfiles “occ files:scan --all” doesn’t work. Besides if you remove the user from the additional group without logging in localy once before, the user can’t log in anymore.

sharing with links and folders seems to work if you use the setting Log-in credentials, save in database mechanism for external storage.
comments and tags seems to work…

But i like the funtion, i want to publish a user home directory over nextcloud. What are the problems when using the function, apart from whether / home directories should be made available online?

Greetings from germany

How did you mount the NAS Storage to NextCloud?
If i try to mountit with the External Storage App i am not able to do this. Do I have to Connect via FTP? WHat Method did you use?

I have my data in /var/{name of data folder and I have never had any issues with that}