Ensure there is a file called ".ocdata" in the root of the data directory

My external hdd where nextcloud data folder was mounted got broken, and i’ve replaced it now. When starting nextcloud i get the error

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

That is expected. What I would like to do, is to reset all users and their data folders, so I can start resync-ing. How can I do that?

3 Likes

Good question. One thing I would be careful is that if the client reconnects and thinks all files have been deleted and it starts to delete everything on the client as well. So do backups on the client before.

Normally if you restore things from backup there is a occ-command to reset the fingerprint, I haven’t tried that so far, so I can’t say if the server “wins” per default or if conflict files are created…, there could be more details in the documentation: https://docs.nextcloud.com/server/12/admin_manual/configuration_server/occ_command.html?highlight=occ#maintenance-commands

In theory you can setup a new data folder, create the .ocdata-file and the filestructure for the users. I don’t really know how this stuff behaves. I’d run a test before (small setup, just two users, sync something, then clean out the data-folder).

@nickvergessen @jospoortvliet can you tell us how Nextcloud behaves? Or is it better to save the database and start a new setup and resync everything again manually?

I’ve removed all users using the occ command for each user, re-added them.
I’ve created the .ocdata file manually (touch .ocdata)
I’ve cleared the DB oc_cache_files (forgot the exact table name)

I’m now resync-ing… seems to work until now.
Next, I will have to figure out how to mark one of the users as admin, as all the users manually created are simple users, not admins.

Nextcloud 18.0.1. I had this problem after data directory migration.
It’s strange, but It helps me. I klicked Basic Settings clicked Webcron, and after that back to Ajax. This message gone.

18 Likes

Great, for me thats also a solution, just switch from Ajax to Cron

1 Like

Works also for me - didn’t expect it when reading your post :wink: thx

1 Like

Let’s lock this here as answer for NC18. It’s very specific for this version, so in general it is better to have a specific topic for that.