I Managed to loose all shares and Groupe Folders do not show there usage but No files lost

I Managed to loose all shares and Groupe Folders do not show there usage but No files lost.

Some background what I think brought me there:

One user had sync issues. So I went into the database table oc_filecache and deleted all with path __groupfolder% at first all looked good. But the day later I noticed my Group folders show no usage. Also shares where missing, but all files are still in place.

I run several commands like:

occ files:scan --all
occ files:cleanup
occ groupfolders:scan 1

I also moved files out of the groupfolder scanned the empty folder moved files back and scanned again, but no storage usage is shown.

Creating a new groupfolder gives me perfectly working one, how can I solve this most elegantly? Can it be solved during maintenance so I would create a new groupfolder and move the files over, but how to have the same old naming?

Do you have backups? The easiest and only reliable option is to restore from backup.

The oc_filecache table is not meant to be modified manually. It is literally Nextcloud’s filesystem table and extremely critical.

If I backup is not possible, well, first at least get backups functioning before proceeding with any further changes. :wink: Then the next best option I can think of, since you at least have the files themselves, is to move the still stored files somewhere temporarily. Then blow away the entire groupfolders configuration. Then recreate brand new matching groupfolders and ACLs. At that point you should be able to re-add your files back in manually at the OS level (and then scanning). With this approach any shares, comments, version history, etc. associated with the files will be gone (since they’re effectively completely new files from Nextcloud’s perspective) and you/your users will need to re-share everything. I believe this is essentially what the approach you’re considering based on the rest of your query.

Theoretically some other options are possible, but would entail doing a lot of manual database changes and cleaning up various references in other tables. It would be a delicate process, require deep knowledge about the internal structures, and be very error prone and tedious.