Changing data directory location with snap installation procedures

Hello,
Please help me with the following issue which most probably it is a hot topic but still I cant find a solution.
If there is a working solution for this please point me to the right post, it doesn’t matter if I have to reinstall the nextcloud, I cant use it anyway until I can save the data to the proper location.

I have installed via snap procedures nextcloud 12 on Ubuntu 16.04 server. In the system I have mounted in /home/user/Storage/ the /dev/sdb1 drive, where I want to save the nextcloud/data.
During the installation or after installation I could not find a place where to select the data directory location. After installation I tried to change the data directory location true different procedures including symlink, but without success.
Questions:

  1. Sanp installation it is one of the suggested procedure in the installation guide, is there any procedure how can the data directory location be selected, during the installation or after?
  2. If I create a partition e.g. /dev/sdb1 and mount it in the /var/snap/nextcloud/common/nextcloud/data to be the data directory will this work?

Thank you for help,
Best regards,
Mihai

Hi all,
Probably I’m persistent but I have to be, for the moment I don’t have other way. If someone has a solution please share it.
Like my wife is saying when she is asking me for something, "it will not be for nothing, I will thank you :slight_smile: ".

Best regards,
Mihai

Hey there,

I’ve been playing around with the snap installation all day so far and I’ve got something similar working. Go to this link (https://askubuntu.com/questions/882625/nextcloud-snap-with-data-directory-on-external-harddrive) and follow the instructions to the letter (apart from changing your data directory). In general, snap packages can’t access folders outside of their directories, so just mount your directory somewhere in /media/… and the instructions should work. As I say, I’ve tried lots of different workarounds, but having to mount in the media path is the only thing that’s worked for me - and it’s actually usually only a small price to pay.

Hope this helps (someone),

clarktw

Indeed, by default, snaps cannot access data outside of their directory.

Give the nextcloud snap access to /media:
sudo snap connect nextcloud:removable-media

After this, nextcloud can access data below /media.