Yes another .ocdata issue. I’m so sorry I tried my best.
Moved my data directory. Followed this guide: HowTo: Change / Move data directory after installation
I’m pretty sure this is a permission issue with my new data drive but I can’t seem to get the settings right or doing the syntax wrong.
1. sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --on
2. mkdir -p /new/path/to/data
3. cp -a /path/to/data/. /new/path/to/data
4. chown -R www-data:www-data /new/path/to/data
5. nano /path/to/nextcloud/config/config.php
'datadirectory' => '/new/path/to/data',
6. mysqldump -u<rootuser> -p > /path/to/dbdump/dump.sql
7. Adjust "oc_storages"database table to reflect the new data folder location:
echo "Your Nextcloud dbname is: $(awk -F\' "/'dbname'/{print \$4;exit}" /path/to/nextcloud/config/config.php)"
dbuser=$(awk -F\' "/'dbuser'/{print \$4;exit}" /path/to/nextcloud/config/config.php)
dbpassword=$(awk -F\' "/'dbpassword'/{print \$4;exit}" /path/to/nextcloud/config/config.php)
mysql -u"$dbuser" -p"$dbpassword"
// Inside the MySQL console:
use <dbname>;
update oc_storages set id='local::/new/path/to/data/' where id='local::/path/to/data/'; //take care about backslash at the end of path!!
quit;
// Again outside the MySQL console
unset -v dbuser dbpassword
8. sudo -u www-data php /path/to/nextcloud/occ maintenance:mode --off
Nextcloud version (eg, 20.0.5): 27.0.2.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)
PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.14 (cli)
The issue you are facing:
Your data directory is invalid. Ensure there is a file called “.ocdata” in the root of the data directory.
Is this the first time you’ve seen this error? Y
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'instanceid' => 'ockz1fm1avme',
'passwordsalt' => 'hidden',
'secret' => 'hidden',
'trusted_domains' =>
array (
0 => 'cloud.mydomain.com',
1 => '172.30.1.110',
),
'trusted_proxies' =>
array (
0 => '172.30.1.114',
),
'forwarded_for_headers' =>
array (
0 => 'X-Forwarded-For',
1 => 'HTTP_X_FORWARDED_FOR',
),
'htaccess.RewriteBase' => '/',
'datadirectory' => '/mnt/nasdata',
'dbtype' => 'mysql',
'version' => '27.0.2.1',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'ncadmin',
'dbpassword' => 'mypassword',
'installed' => true,
'maintenance' => true,
);
I’m not sure what /mnt/data/ is. I double checked the commands I ran and it was definitely /mnt/nasdata/. I can remove #4 if needed.
Data drive before running
sudo chown -R www-data:www-data /mnt/nasdata/
sudo chmod -R 755 /mnt/nasdata/
After running those commands
Nextcloud.log
{"reqId":"lwW4ulkOg0bW86BSIRXU","level":3,"time":"2023-09-02T02:30:41+00:00","remoteAddr":"MYIP","user":"--","app":"PHP","method":"GET","url":"/index.php/204","message":"file_get_contents(/mnt/nasdata/appdata_ockz1fm1avme/js/core/merged-template-prepend.js.deps): Failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#305","userAgent":"Mozilla/5.0 (Windows) mirall/3.9.2stable-Win64 (build 20230808) (Nextcloud, windows-10.0.22621 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"27.0.2.1","data":{"app":"PHP"}}
{"reqId":"BAjvHOMXEzif5W9th74W","level":3,"time":"2023-09-02T02:31:43+00:00","remoteAddr":"MYIP","user":"--","app":"PHP","method":"GET","url":"/index.php/204","message":"file_get_contents(/mnt/nasdata/appdata_ockz1fm1avme/js/core/merged-template-prepend.js.deps): Failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#305","userAgent":"Mozilla/5.0 (Windows) mirall/3.9.2stable-Win64 (build 20230808) (Nextcloud, windows-10.0.22621 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"27.0.2.1","data":{"app":"PHP"}}
{"reqId":"rZeO3yImU4Eu8NCtqlor","level":3,"time":"2023-09-02T02:32:45+00:00","remoteAddr":"MYIP","user":"--","app":"PHP","method":"GET","url":"/index.php/204","message":"file_get_contents(/mnt/nasdata/appdata_ockz1fm1avme/js/core/merged-template-prepend.js.deps): Failed to open stream: No such file or directory at /var/www/html/lib/private/Files/Storage/Local.php#305","userAgent":"Mozilla/5.0 (Windows) mirall/3.9.2stable-Win64 (build 20230808) (Nextcloud, windows-10.0.22621 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"27.0.2.1","data":{"app":"PHP"}}