Hello All,
I am trying to change the data directory on my Nextcloud 24 installation. I have it running on my Synology NAS using Apache 2.4 and PHP 7.4. I tried to follow the steps found in these guides here HowTo: Change / Move data directory after installation and Is there a safe and reliable way to move data directory out of web root? - #17 by robertb but now I am stuck with this error message whenever trying to access nextcloud “Your data directory is invalid. Ensure there is a file called “.ocdata” in the root of the data directory. Cannot create “data” directory. This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/24/go.php?to=admin-dir_permissions”. I have updated the ‘oc_storage’ database entry and tried to run the occ file:cleanup and occ files:scan --all command and get this error message from both commands "Your data directory is invalid.
Ensure there is a file called “.ocdata” in the root of the data directory.
Cannot create “data” directory.
This can usually be fixed by giving the web server write access to the root directory. See https://docs.nextcloud.com/server/24/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /volume1/web/nextcloud/lib/private/Console/Application.php:164
Stack trace:
#0 /volume1/web/nextcloud/console.php(98): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /volume1/web/nextcloud/occ(11): require_once(’/volume1/web/ne…’)"
When I copied the data from the old location to the new one I made sure to use cp -pr to keep the permissions and I have made sure the .ocdata file is present with the same permissions. Here is what the permissions inside the new data folder look like:
total 164008
drwxrwx— 1 http http 284 Jun 1 20:10 .
drwxrwxrwx+ 1 http http 20 Jun 1 19:17 …
drwxrwxrwx+ 1 http http 246 Mar 18 21:50 appdata_ocm841vnk4t2
drwxr-xr-x 1 http http 26 May 24 10:07 files_external
-rwxrwxrwx+ 1 http http 542 May 24 10:07 .htaccess
-rwxrwxrwx+ 1 http http 0 May 24 10:07 index.html
drwxrwxrwx+ 1 http http 110 Mar 18 21:59 jackstockley
-rw-r----- 1 http http 63016054 Jun 1 17:00 nextcloud.log
-rw-r----- 1 http http 104879859 May 30 05:24 nextcloud.log.1
-rwxrwxrwx+ 1 http http 0 May 24 10:07 .ocdata
-rw-r–r-- 1 http http 4096 Apr 25 14:24 owncloud.db
-rwxrwxrwx+ 1 http http 33570 May 24 10:09 updater.log
drwxrwxrwx+ 1 http http 74 May 24 10:08 updater-ocm841vnk4t2
Any suggestions would be greatly appreciated.