Get error message with .ocdata after copying nextcloud-data folder to a new location

I copied the data that is in the nextcloud data folder, I added the permissions for www-data and added the .ocdata file into the root of the copied data folder.

When I change to the new data directory in the config.php and then open the nextcloud webpage, I get the following error message:

Your data directory is invalid Ensure there is a file called “.ocdata” in the root of the data directory.

When I do ls -al in that copied data directory I get

total 188
drwxr-xr-x  4 www-data www-data   4096 nov 16 13:55 .
drwxrwxrwx  3 www-data www-data   4096 nov 16 15:01 ..
drwxr-xr-x 12 www-data www-data   4096 nov 16 12:51 appdata_oc7yks14xxek
-rw-r--r--  1 www-data www-data      0 nov 16 13:55 flow.log
-rw-r--r--  1 www-data www-data    542 nov 16 12:51 .htaccess
-rw-r--r--  1 www-data www-data      0 nov 16 12:51 index.html
-rw-r-----  1 www-data www-data 170073 nov 16 12:51 nextcloud.log
-rw-r--r--  1 www-data www-data      0 nov 16 15:57 .ocdata
drwxr-xr-x  7 www-data www-data   4096 nov 16 13:42 odenkaz

As you may see, it the .ocdata is there.

Is there something missing that Nextcloud is not reading that file in the new location?

I was following this particular guide: https://www.linuxbabe.com/ubuntu/install-nextcloud-ubuntu-20-04-apache-lamp-stack

There is a section called: How to Move the Data Directory

I can revert back with no problem to the original data folder so I am not worried too much about the data the new location since it’s just copied data.

I just want Nextcloud to point to it so that then I can delete the old data folder later

Any help is appreciated!

Did you find a solution to this?

any answer to this?

Same guide and same problem in the end.
Did you found any solution since you posted?

the tutorial followed is incorrect at the point where they change config.php they use a different directory as in there example above where they change permissoins.

this might be confusing to a novice user.

the datadirectory in the tutorial should be set to

‘datadirectory’ => ‘/media/linuxbabe/b43e4eea-9796-4ac6-9c48-2bcaa46353731/nextcloud-data/’