Where is the config.php for NextCloud app?

I have Nextcloud app installed. I installed it on a small drive and I would like to move the data to a larger drive. I need to know the location of the REAL data directory and the REAL config.php file.

Running Nextcloud on FB, using a Pi4, booting off SSD - it’s AWESOME!!! Just need a little help.

Thank you!
mark

Hi @masorrell.

I am not using NextCloud on FB myself, but I had a similar requirement when I wanted to move my syncthing data directory to an external SSD.

As far as I understand, FB is simply running the official NextCloud docker image as a container. The container uses a local data directory /var/lib/nextcloud (cf. here). So moving & linking this elsewhere might be sufficient.

Here’s what I did for my syncthing folder:

  • Stop the service (from plinth or CLI)
  • Move all files from /var/lib/syncthing to a new folder on my external SSD
  • Make sure file and folder permissions are still correct
  • Create a symlink as /var/lib/synthing pointing to that new folder
  • Start the service again

That worked perfectly fine for me. Maybe it does for your scenario, too.

Cheers & HTH,
Axel

2 Likes

Hello.

I tried to follow you but I cant really do it.
Moving the folder and adding a symlink from /var/lib/nextcloud to my ssd /media/ssd1/nextcloud wont do anything. Permissions are set and when I try to edit the datadirectory in the config.php file /var/lib/nextcloud/config I get the error that the .ncdata file is missing (its not). Also why is pointing datadirectory to /var/www/html/data? This folder does not exist. But that configuration seems to work.

I hope you kind of understand my problem and the questions I have. I would be really thankful if you could help me.

Hi @lavier

As mentioned above, I am not a NextCloud user, so I am trying to support without having NC on my own FreedomBox.

As for your folder issues for /var/lib/nextcloud, could you post the output of

  • ls -ld /var/lib/nextcloud
  • ls -la /var/lib/nextcloud/
  • ls -ld /media/ssd1/nextcloud
  • ls -la /media/ssd1/nextcloud

That will allow checking the folder structure and permissions.

W. r. t. data directory: FreedomBox runs the containerized version of NextCloud, so /var/www/html/data will probably be relative to the root filesystem inside the container. Here’s the official documentation from the upstream project.

I hope this helps!

Cheers,
Axel

Hello,

Thank you for the response!

here is the output of the commands you gave me, I hope this helps:

lavier@freedombox:/media/ssd1/nextcloud$ ls -ld /var/lib/nextcloud
drwxrwxrwt 1 www-data www-data 600 Nov 20 00:38 /var/lib/nextcloud

lavier@freedombox:/media/ssd1/nextcloud$ ls -la /var/lib/nextcloud/
total 1252
drwxrwxrwt 1 www-data www-data 600 Nov 20 00:38 .
drwxr-xr-x 1 root root 782 Nov 18 12:53 …
-rw-r–r-- 1 www-data www-data 5516 Nov 14 14:39 .htaccess
drwxr-xr-x 1 www-data www-data 8 Nov 14 14:37 .reuse
-rw-r–r-- 1 www-data www-data 271 Nov 14 14:37 .user.ini
drwxr-xr-x 1 www-data www-data 772 Nov 14 14:37 3rdparty
-rw-r–r-- 1 www-data www-data 26314 Nov 14 14:37 AUTHORS
-rw-r–r-- 1 www-data www-data 34520 Nov 14 14:37 COPYING
drwxr-xr-x 1 www-data www-data 1210 Nov 14 14:37 LICENSES
drwxr-xr-x 1 www-data www-data 1330 Nov 14 14:37 apps
-rw-r–r-- 1 www-data www-data 2079 Nov 14 14:37 composer.json
-rw-r–r-- 1 www-data www-data 3400 Nov 14 14:37 composer.lock
drwxr-xr-x 1 www-data www-data 430 Nov 17 22:12 config
-rw-r–r-- 1 www-data www-data 3810 Nov 14 14:37 console.php
drwxr-xr-x 1 www-data www-data 782 Nov 14 14:37 core
-rw-r–r-- 1 www-data www-data 7550 Nov 14 14:37 cron.php
drwxr-xr-x 1 www-data www-data 0 Nov 14 14:37 custom_apps
drwxrwx— 1 www-data www-data 220 Nov 14 14:40 data
drwxr-xr-x 1 www-data www-data 22452 Nov 14 14:37 dist
-rw-r–r-- 1 www-data www-data 331 Nov 14 14:37 index.html
-rw-r–r-- 1 www-data www-data 3485 Nov 14 14:37 index.php
drwxr-xr-x 1 www-data www-data 126 Nov 14 14:37 lib
lrwxrwxrwx 1 www-data www-data 21 Nov 20 00:38 nextcloud → /media/ssd1/nextcloud
-rw-r–r-- 1 www-data www-data 0 Nov 17 22:14 nextcloud-init-sync.lock
-rwxr-xr-x 1 www-data www-data 308 Nov 14 14:37 occ
drwxr-xr-x 1 www-data www-data 50 Nov 14 14:37 ocs
drwxr-xr-x 1 www-data www-data 18 Nov 14 14:37 ocs-provider
-rw-r–r-- 1 www-data www-data 1131946 Nov 14 14:37 package-lock.json
-rw-r–r-- 1 www-data www-data 7227 Nov 14 14:37 package.json
-rw-r–r-- 1 www-data www-data 2821 Nov 14 14:37 public.php
-rw-r–r-- 1 www-data www-data 4435 Nov 14 14:37 remote.php
drwxr-xr-x 1 www-data www-data 198 Nov 14 14:37 resources
-rw-r–r-- 1 www-data www-data 26 Nov 14 14:37 robots.txt
-rw-r–r-- 1 www-data www-data 1327 Nov 14 14:37 status.php
drwxr-xr-x 1 www-data www-data 26 Nov 14 14:37 themes
-rw-r–r-- 1 www-data www-data 383 Nov 14 14:37 version.php

lavier@freedombox:/media/ssd1/nextcloud$ ls -ld /media/ssd1/nextcloud
drwxr-xr-t 16 www-data www-data 4096 Nov 20 00:36 /media/ssd1/nextcloud

lavier@freedombox:/media/ssd1/nextcloud$ ls -la /media/ssd1/nextcloud
total 1328
drwxr-xr-t 16 www-data www-data 4096 Nov 20 00:36 .
drwxr-xr-x 6 www-data www-data 4096 Nov 20 00:36 …
-rw-r–r-- 1 www-data www-data 5516 Nov 20 00:36 .htaccess
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 .reuse
-rw-r–r-- 1 www-data www-data 271 Nov 20 00:36 .user.ini
drwxr-xr-x 42 www-data www-data 4096 Nov 20 00:36 3rdparty
-rw-r–r-- 1 www-data www-data 26314 Nov 20 00:36 AUTHORS
-rw-r–r-- 1 www-data www-data 34520 Nov 20 00:36 COPYING
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 LICENSES
drwxr-xr-x 54 www-data www-data 4096 Nov 20 00:36 apps
-rw-r–r-- 1 www-data www-data 2079 Nov 20 00:36 composer.json
-rw-r–r-- 1 www-data www-data 3400 Nov 20 00:36 composer.lock
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 config
-rw-r–r-- 1 www-data www-data 3810 Nov 20 00:36 console.php
drwxr-xr-x 24 www-data www-data 4096 Nov 20 00:36 core
-rw-r–r-- 1 www-data www-data 7550 Nov 20 00:36 cron.php
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 custom_apps
drwxr-x— 5 www-data www-data 4096 Nov 20 00:36 data
drwxr-xr-x 2 www-data www-data 20480 Nov 20 00:36 dist
-rw-r–r-- 1 www-data www-data 331 Nov 20 00:36 index.html
-rw-r–r-- 1 www-data www-data 3485 Nov 20 00:36 index.php
drwxr-xr-x 6 www-data www-data 4096 Nov 20 00:36 lib
-rw-r–r-- 1 www-data www-data 0 Nov 20 00:36 nextcloud-init-sync.lock
-rwxr-xr-x 1 www-data www-data 308 Nov 20 00:36 occ
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 ocs
drwxr-xr-x 2 www-data www-data 4096 Nov 20 00:36 ocs-provider
-rw-r–r-- 1 www-data www-data 1131946 Nov 20 00:36 package-lock.json
-rw-r–r-- 1 www-data www-data 7227 Nov 20 00:36 package.json
-rw-r–r-- 1 www-data www-data 2821 Nov 20 00:36 public.php
-rw-r–r-- 1 www-data www-data 4435 Nov 20 00:36 remote.php
drwxr-xr-x 4 www-data www-data 4096 Nov 20 00:36 resources
-rw-r–r-- 1 www-data www-data 26 Nov 20 00:36 robots.txt
-rw-r–r-- 1 www-data www-data 1327 Nov 20 00:36 status.php
drwxr-xr-x 3 www-data www-data 4096 Nov 20 00:36 themes
-rw-r–r-- 1 www-data www-data 383 Nov 20 00:36 version.php

If I try to store data on nextcloud, i can see it in /var/lib/nextcloud/data but not on /media/ssd1/nextcloud/data

I tried to change in the config.php file this line: ‘datadirectory’ => ‘/var/www/html/data’, → ‘datadirectory’ => ‘/media/ssd1/nextcloud/data’ , I get this error on the WebUI of Nextcloud:

"
Your data directory is invalid.

Ensure there is a file called ".ncdata" in the root of the data directory. It should have the content: "# Nextcloud data directory" "

but the file exists:
root@freedombox:/media/ssd1/nextcloud/data# ls -al
total 6024
drwxr-x— 5 www-data www-data 4096 Nov 20 00:36 .
drwxr-xr-t 16 www-data www-data 4096 Nov 20 00:36 …
-rw-r–r-- 1 www-data www-data 542 Nov 20 00:36 .htaccess
-rw-r–r-- 1 www-data www-data 52 Nov 20 00:36 .ncdata
drwxr-xr-x 5 www-data www-data 4096 Nov 20 00:36 4c82582c-33f8-103f-87c2-adfabf064e73
drwxr-xr-x 8 www-data www-data 4096 Nov 20 00:36 appdata_ocfsiv84kec4
-rw-r–r-- 1 www-data www-data 0 Nov 20 00:36 index.html
drwxr-xr-x 4 www-data www-data 4096 Nov 20 00:36 nextcloud-admin
-rw-r----- 1 www-data www-data 6138751 Nov 20 00:36 nextcloud.log

With the content:
root@freedombox:/media/ssd1/nextcloud/data# cat .ncdata
# Nextcloud data directory
# Do not change this file

I also tired to add the disk in the NextCloud App itselft.
But the when I try to add the disk at the location /media/ssd1 or /media/ssd1/nextcloud , I get an error saying “Local storage path does not exist”.
I also gave owner permission to www:data to /media.

My ssd is formated in Ext4, this is the /etc/fstab file, if it helps:
UUID=97f33784-a23c-4677-a372-b12b7b89dbde / btrfs compress=zstd:1 0 1
UUID=0F4C-824C /boot/firmware vfat errors=remount-ro 0 2
UUID=6791381f-e355-4a96-972a-31b415b40e32 /media/ssd1 auto defaults 0 0

I also looked into the the docker documentation you’ve send me. I cant really figure out what I have to do, because the docker command does not exist on my freedombox and in the folder /var/lib/containers/storage/volumes/nextcloud-freedombox/_data is this:

root@freedombox:/var/lib/containers/storage/volumes/nextcloud-freedombox/_data# ls -al
total 1252
drwxrwxrwt 1 www-data root 600 Nov 12 03:28 .
drwx------ 1 root root 10 Nov 20 18:41 …
-rw-r–r-- 1 www-data www-data 5516 Nov 14 14:39 .htaccess
drwxr-xr-x 1 www-data www-data 8 Nov 14 14:37 .reuse
-rw-r–r-- 1 www-data www-data 271 Nov 14 14:37 .user.ini
drwxr-xr-x 1 www-data www-data 772 Nov 14 14:37 3rdparty
-rw-r–r-- 1 www-data www-data 26314 Nov 14 14:37 AUTHORS
-rw-r–r-- 1 www-data www-data 34520 Nov 14 14:37 COPYING
drwxr-xr-x 1 www-data www-data 1210 Nov 14 14:37 LICENSES
drwxr-xr-x 1 www-data www-data 1330 Nov 14 14:37 apps
-rw-r–r-- 1 www-data www-data 2079 Nov 14 14:37 composer.json
-rw-r–r-- 1 www-data www-data 3400 Nov 14 14:37 composer.lock
drwxr-xr-x 1 www-data www-data 430 Nov 20 18:37 config
-rw-r–r-- 1 www-data www-data 3810 Nov 14 14:37 console.php
drwxr-xr-x 1 www-data www-data 782 Nov 14 14:37 core
-rw-r–r-- 1 www-data www-data 7550 Nov 14 14:37 cron.php
drwxr-xr-x 1 www-data www-data 0 Nov 14 14:37 custom_apps
drwxrwx— 1 www-data www-data 220 Nov 14 14:40 data
drwxr-xr-x 1 www-data www-data 22452 Nov 14 14:37 dist
-rw-r–r-- 1 www-data www-data 331 Nov 14 14:37 index.html
-rw-r–r-- 1 www-data www-data 3485 Nov 14 14:37 index.php
drwxr-xr-x 1 www-data www-data 126 Nov 14 14:37 lib
lrwxrwxrwx 1 www-data www-data 21 Nov 20 00:38 nextcloud → /media/ssd1/nextcloud
-rw-r–r-- 1 www-data www-data 0 Nov 20 18:41 nextcloud-init-sync.lock
-rwxr-xr-x 1 www-data www-data 308 Nov 14 14:37 occ
drwxr-xr-x 1 www-data www-data 50 Nov 14 14:37 ocs
drwxr-xr-x 1 www-data www-data 18 Nov 14 14:37 ocs-provider
-rw-r–r-- 1 www-data www-data 1131946 Nov 14 14:37 package-lock.json
-rw-r–r-- 1 www-data www-data 7227 Nov 14 14:37 package.json
-rw-r–r-- 1 www-data www-data 2821 Nov 14 14:37 public.php
-rw-r–r-- 1 www-data www-data 4435 Nov 14 14:37 remote.php
drwxr-xr-x 1 www-data www-data 198 Nov 14 14:37 resources
-rw-r–r-- 1 www-data www-data 26 Nov 14 14:37 robots.txt
-rw-r–r-- 1 www-data www-data 1327 Nov 14 14:37 status.php
drwxr-xr-x 1 www-data www-data 26 Nov 14 14:37 themes
-rw-r–r-- 1 www-data www-data 383 Nov 14 14:37 version.php
root@freedombox:/var/lib/containers/storage/volumes/nextcloud-freedombox/_data#

so no difference to the /var/lib/nextcloud/data/ folder…
I hope you can help me a bit more.
I hope this helps to understand my problem :slight_smile: Thank you!

Thanks for the details. This piece here ^ looks as if you did not create a symlink, but still have the original folder with all contents at /var/lib/nextcloud (the initial ‘d’ from ‘drwxrwxrwt’ says it’s a directory, not a link which would be ‘l’).

But this does not explain why NC does not find your .ncdata file which probably also exists there, right?

BTW, you should have podman as alternative to the docker command, if that helps in your research. Others have examples how to use it in this thread.

That being said, I am out of my depth here. Maybe someone who runs NC themselves can help?

1 Like