Data directory snap installation

So, I’ve been trying to change the location of the data files from nextcloud snap installation on a 18.04 Ubuntu server, basically i’ve followed the steps on some previous posts, but they all address to changing the location to a removable device, wich isn’t my case and after the steps all I got was a internal server error. I have a big partition in wich i want to have all the data in there.

What i’ve tryed is changing the config.php so the “datadirectory” is set to the desired partition. (https://askubuntu.com/questions/882625/nextcloud-snap-with-data-directory-on-external-harddrive)

Is is possible? Is there any way I can change it?

1 Like

There is a section in the wiki of the nextcloud-snap. I never tried it myself, but I guess this should work:

I’ve already tryed that, got Internal Server error, not sure if it was because of the permissions in the data folder i wanted, then I gave the folder ‘777’ permission,
and after doing just like the post i got this message:

Aiee I have the same problem.

I installed nextcloud by snap, not realizing that by default it stores data in the root partition (!bad default!!).

I have tried BOTH suggestions on this page: https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition

The first one didn’t work because that value was overwritten at some point; the data ended up in the same place in /var/snap.

The second one has left me with the Internal Server Error described by pberton.

@pberton: did you solve this? Submit a bug report?

1 Like

I had the same issue and this solved it:

Try doing sudo snap connect nextcloud:removable-media first as per https://github.com/nextcloud/nextcloud-snap#removable-media . Even if it’s not removable media, it seems to need that whenever the data directory must be outside the snap directory.

I do not understand it. Snap should optimize Nextcloud installation. Think that does not work. In standard installation (LAMP) i an change everything. Why are you using Snap? Because it is easy or a container like Docker?

Note that running snap connect nextcloud:removable-media only whitelists some common folders/mountpoints like /mnt or probably /run/media and whatever. I tried to use the path /zpool/nextcloud/data, which did not work, so i had to change the mountpoint of my ZFS storage pool to /mnt/zpool.

re:devnull guy, yes, kind of annoying, but I get how snap tries to be part of the “defense-in-depth” security best practice a little bit, since this will prevent a lot of pwnage when there is a bad bug someday.