Hosting Users' Files on NAS Drives

Hi Support,

Is it possible for me to host my user files on a NAS drive on the same network as NextCloud machine (local hosting)?

Yes via samba (smbclient) or NFS (pure Linux setup)

but there are some pitfalls.

@jogunremi did you run a nextcloud server and looked at the folder layout of the data directory? do you want to access the files both ways? (direct through NAS and through nextcloud)

thanks for your response. what I would want is to store the users files on the NAS and point nextcloud to the NAS. So users can access the files on the NAS thru the nextcloud portal or the desktop client. I am actually very new to nextcloud though.

What are the pitfalls you are refering to? I will be happy to know.

Hi,
i believe there is multiple ways to do this, depending on the level of security / separation you would like to achieve.

  1. you can simply mount the SMB/CIFS Share on the Nextcloud server and have it presented to the users as external storage. (choose “local” as the storage provider and specify the mount point e.g. /mnt/my_NAS_Share) -> all users could use the same “share-user” and write to the NAS
  2. you could present the share to the user through the smb / cifs external storage connector -> this allows you to specify how the users authenticate when connecting to the share e.g Username / Password, you can even forward the Nextcloud Username and Password)

I recommend trying the external storage connector (option 2). You might have to install some additional packages to your nextcluod server such as smbclient -> normally Nextcloud GUI will tell you if something is missing.
https://docs.nextcloud.com/server/17/admin_manual/configuration_files/external_storage/smb.html

If the files are changed outside of Nextcloud e.g. directly on the NAS through a shared network folder, it might take some time for nextcloud to realize those changes. You can set up Nextcloud to “monitor” an external storage. You’ll find the info in the above manual as well. (SMB Update notifications)

Just FYI, the machines do not need to be on the same network but have to be accessible via the needed ports depending on the protocol you wish to use SMB, NFS, etc.

Hope that helps.
Enjoy Nextcloud.
Best,
Christian

PS: depending on the NAS, you could also run Nextcloud directly on supported NAS systems. It is pretty straight forward to run Nextcloud through docker on a synology NAS for example. (can't speak for others since I am lacking the experience with different vendors)

Hi @CPichler,

It is pretty straight forward to run Nextcloud through docker on a synology NAS for example.

How’d you recommend to set Nextcloud up to use the NAS as storage backend? smbclient seems a bit redundant. In the ideal world, it’ll be great to use the user folders on the NAS as storage for Nextcloud.

Best regards,
stiller_leser

Hi @stiller_leser,
I’d recommend creating the Nextcloud/data folder outside of the docker container as well as keeping the configuration files outside of the container.
This allows you to update the docker image and not have your files and config affected.

It would allow you to also access the Nextcloud files directly through a mount to the NAS file storage, however this would need some tweaking in Nextcloud to have it recognize changes you made outside of the nextcloud environment, for example through a direct mount.

Additional:
(We ended up using Nextcloud all the way and not accessing files directly anymore. If your Nextcloud is available publicly, you could also use that endpoint and connect your local machines to it. If you are worried about performance, it is possible to set a local entry on your machines to point to the local IP, so all files are transferred through the local network.
For mobile devices this is a bit trickier, we wended up running our own DNS service on the NAS-system as well. So all machines that are in the local network get the local IP for nextcloud. Once they leave the local network they will get the public-IP through the public DNS service. Also NAT-Pinning comes to mind when I think about this setup)

Hope that makes sense.
Best,
Christian

2 Likes

Hi @CPichler
Did you just set up as follows:
When on local wifi the user is pointed to a local ip when typing in “somedomain.com” but when the user leaves local range and they connect to a different network then the worldwide dnses point to the normal ip thats been set up with the domain?

Hi @orophix
sorry for my late reply but I did not really get the info that you had a question on this topic.

That is exactly what we did when a user is in the local lan or wifi they get back the local IP of the NAS-System running NC. The client connects to a URL such as https://somedomain.com, externally it will receive the public IP for your NAS-System through the external DNS provider.

Let me know if you have any further questions.
Best,
Christian