HowTo: Change / Move data directory after installation

Thank you for the link.
I went on two ways:
First, when I posted here first I have installed nextcloud along this manual: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-nextcloud-on-ubuntu-20-04-de
Therefore I used the second way:

If you have already created an admin user

I ended up with the error : There is no .ocdata …
I tried different chmod and chown, starting and restarting snap nextcloud but the missing .ocdata did not disappear.

Because I was at the start there was nothing in the database yet so I sudo snap remove --purge nextcloud and deleted the data directory and the var/snap/nextcloud/ directory.

I did again sudo snap install nextcloud and followed the step one

If you just installed the snap, and haven’t created an admin user yet

I think the database is now located on the harddrive but I cannot login !

There are 27 issues on the github wiki: https://github.com/nextcloud-snap/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition#if-you-have-already-created-an-admin-user
and both my encountered errors are listed - this is frustrating!

The major problem is: I told my wife that we will have our own cloud to automatically save photos from the smartphone - How do I explain that I am wrong?

Manfred :sob:

The following seems to be a workaround:

ln -s /DATA/nextcloud/data /var/snap/nextcloud/common/nextcloud/data

But I have no experience with the Nextcloud Snap. @kyrofa could you have a look? There are indeed related reports at GitHub: Issues ¡ nextcloud-snap/nextcloud-snap ¡ GitHub

No, that won’t work.

You need to read that wiki article again. The very first paragraph:

The partition you want to use must be mounted somewhere in /media/ or /mnt/. These are the only locations the snap can access under confinement with the removable-media plug. Connect the removable-media plug as mentioned in the README in order to grant the snap permission to access external drives.

1 Like

late night:
next try and failed:
new sudo install nextcloud
changed the datadirectory to /mnt/DATA/nextcloud/data
the mount is fixed in fstab
now a new error appears:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

This is more than annoying !

I really cannot use nextcloud on my ssd. It is fast but too small for thousands of photos.

See in the morning!

Did you also connect the removable-media plug?

1 Like
snap connections nextcloud
Interface        Plug                       Slot           Notes
network          nextcloud:network          :network       -
network-bind     nextcloud:network-bind     :network-bind  -
network-observe  nextcloud:network-observe  -              -
removable-media  nextcloud:removable-media  -              -

shouldn’t there be an entry in Slot?

snap connections nextcloud
Interface        Plug                       Slot              Notes
network          nextcloud:network          :network          -
network-bind     nextcloud:network-bind     :network-bind     -
network-observe  nextcloud:network-observe  :network-observe  manual
removable-media  nextcloud:removable-media  :removable-media  manual

I like to thank you all for your patience with me.
For my excuse I like to say that I am very very new to snap and have not entered the deep sea of it yet.

I am so happy that nextcloud is running now and I do not have to find dubious excuses to tell my wife that I cannot hold up my promises.

Thank you for your support.

:+1:

Great. At first it looked similar to this issue, but obviously not.

I’m glad you’re up and running! Please don’t blame this issue on the snap or some deep sea of new tech, though. I’ve tried very hard to write decent wiki articles that answer questions like these, and you didn’t even read the first paragraph where I outlined exactly what the requirements were. Please consider this a lesson for next time.

For his defence, I linked the 3rd header of the Wiki article above (though the complete page in OP), so partly my fault as well :wink:. And I’ve overseen the relevant info as well :see_no_evil:.

1 Like

You did write a very decent wiki article and I am really glad you did.

But reading something and doing it is quite different. As me, I am a NEWBI to snap. I read that there has to be that removable-media connection but I had to find out how to do create it and got lost in just seeing it with snap connections …
But I am still learning. I did again search and found out that I have actually create the connection with snap connect snapname:interface.
This is what I meant with the deep sea of snap - I am exploring!

Hiya, how can I update the oc_storages entry? Thanks

Hiya, can I check and update oc_storages entry? because I am having problem and got .ocdata is missing error message.
My installation is on docker, so I’ve moved the data to another, edited config.php. I also edited data volume on my docker compose / stack to point to the new destination and still not working. So I’m guessing it’s something to do with the db because it’s the only thing that hasn’t got updated.

Hey guys,

I´m searching the path to the file in point 6: /path/to/dbdump/dump.sql

Where is it located? Can someone help me out?

best, jp

This is just a placeholder for where you want to store the database backup. Choose a location where the executing user has write permissions to and which you remember in case you need it at any later time. You should generally have a backup drive or location for regular Nextcloud database backup. You never know when you need it.

1 Like

and how do I execute these lines?

Replace /path/to/nextcloud with your actual Nextcloud installation path, then you can copy&paste them.

1 Like

yeah thanks! Solution1 works for me!

ubuntu 22.04 server on raspberrypi4
latest nextcloud ( 25 )

Hi When I try step 7 of Solution 1 I get the response:

awk: fatal: cannot open file `/var/www/nextcloud/config/config.php’ for reading: Permission denied

I am trying this command:

sudo echo “nextcloud: $(awk -F' “/‘nextcloud’/{print $4;exit}” /var/www/nextcloud/config/config.php)”
dbuser=$(awk -F' “/‘nextcloud’/{print $4;exit}” /var/www/nextcloud/config/config.php)
dbpassword=$(awk -F' “/‘MYSECRETPASSWORD’/{print $4;exit}” /var/www/nextcloud/config/config.php)
mysql -u"$dbuser" -p"$dbpassword"

any ideas?

also where would one suggest I can read up to understand what that command is doing?

Thanks