Hidden file .ocdata in data directory / error message

Can anyone tell me the background of this file in the data directory? Why this is needed?

If NC looking, if the data directory ist valid, they need the empty file.

Okay. Thanks.
Everything seems to be working, but I get the error message:

It was not possible to execute the cron job via CLI. The following technical errors have appeared: - 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.

But I’m using a non-typical use case. I redirected the data directory to a mounted volume (NTFS). I adjusted the mount so that NC also has write permissions (uid, gid):


Here the result:
/var/www/html/nextcloud# ls -a -l
drwxr-x--- 1 www-data www-data 4096 Apr 19 00:16 data

/var/www/html/nextcloud/data# ls -a -l

-rw-r-----  1 www-data www-data      0 Apr 19 00:37 .ocdata

The data directory already exists. Why does NC want to create this?

Does no one have an idea or have been able to recreate the problem?

This has been answered in another post. In particular, this answer, which says:

You can have a disk that is mounted in your filesystem, e.g.:
And under this path are all the files/folder mounted from this drive. E.g. if that is the Nextcloud data folder, there is at least the .ocdata file.
If the disk is unmounted, there is still the
folder which is empty. Now Nextcloud could think, that suddenly all the files were deleted. For that reason, if there isn’t the .ocdata file, it knows that something is wrong and it doesn’t see the real data folder.

It’s not the number 1 result in a search engine, but it probably should be. I found it by asking ChatGPT and gives this as the first result.

The answer of ChatGPT is correct, but in my case the drive is automatically mounted at startup. So, if you call the nextcloud website, NC should/must find the .ocdata file.