Nextcloud, how to change data directory?

Hi, I have Nextcloud on my Raspberry Pi 3. It runs fine but I need to change the data directory because I need to use a folder inside an external HDD.

I tried different ways with no succes, what can I do?

Thank you.

Hi,

We recommend changing DietPi user data locationt:
https://dietpi.com/forum/t/dietpi-software-user-data/400/1

I don’t want to change my DietPi user data folder, I prefer to let it as default. Is it possible to change the next cloud folder?

https://help.nextcloud.com/t/is-there-a-safe-and-reliable-way-to-move-data-directory-out-of-web-root/3642/2

config should be in:

/var/www/nextcloud/

Hi, yes. Tried all that things!
I tried to change the path of the data directory. I moved all /mnt/dietpi_userdata/nextcloud_data files to /mnt/myexternaldrive/nextcloud, then done

chown -R www-data:www-data /mnt/myexternaldrive/nextcloud

and changed settings in config.php and in oc_storage in the database.

I still get Data directory (/mnt/myexternaldrive/nextcloud) is invalid. Please check that the data directory contains a file “.ocdata” in its root.

I can’t find any nextcloud.conf. What may I do?

Thank you

Bump.

I’d also like to see clear instruction for how to change the data directory to be within Nextcloud.

How does one for example edit oc_storage and where it might even be located? Everything’s well hidden for a linux newbie like me.

I used this method…mounted an external 1TB harddrive, moved all user data, it’s now all on the external harddrive

THANKS!!!

Just ran the web updater too

Worked like a champ!

Hi, I use that method to move my data but when I open nextcloud and users tab I see that my data is in /mnt/dietpi_userdata/nextcloud_data/. I have also my data in /mnt/Toshiba/dietpi_userdata/nextcloud_data/

pls can you past output of

ls -la /mnt/

That is:

drwxr-xr-x  8 root     root     4096 mar 21 08:11 .
drwxr-xr-x 21 root     root     4096 mar 22 09:33 ..
lrwxrwxrwx  1 root     root       28 mar 20 21:45 dietpi_userdata -> /mnt/Toshiba/dietpi_userdata
drwxr-xr-x  2 root     root     4096 sty  7 23:35 ftp_client
drwxr-xr-x  2 root     root        0 lut 14  2019 Maly
drwxrwxrwx  1 root     root     8192 mar 20 19:38 My_Passport
drwxr-xr-x  2 root     root     4096 sty  7 23:35 nfs_client
drwxr-xr-x  2 root     root     4096 sty  7 23:35 samba
drwxr-xr-x  4 www-data www-data 4096 mar 20 21:45 Toshiba

That is all correct. When changing the userdata location, a symlink is left behind, so the old path stays valid while the actual data is on the new drive.

But I see that path i nextcloud web app and all my data sync with that location. So I have to delete my data from

/mnt/dietpi_userdata/nextcloud_data/admin

?

Yes thats all correct. As you can see there is a symlinc from old to new location

dietpi_userdata -> /mnt/Toshiba/dietpi_userdata

OK, thanks. Now I install fail2ban on my Rpi4 and cannot open Nextcloud, Emby and ssh :confused: Can You help with that? I will create another topic for that.

Hmm, fail2ban should not be related to web access, especially not Nextcloud. By default it controls SSH access failures only and block access (completely) for a specific client when SSH access failed for, AFAIK 6 times, although might be 3 attempts only since each produces two log entries, AFAIK. Should be released after 600 seconds/10 minutes by default.

Were you able to access via SSH and web before installing fail2ban?