Server crashed, lost files, how to resync?

Nextcloud version: 26.0.1
Operating system and version: Docker running on Unraid 6.11.5

The issue you are facing:

One of my drives has silently crashed, wiping out files before I get any notification of disk malfunction. Files are lost, can’t recover them on the server.
However, Nextcloud didn’t notice at first that files were missing, they were still listed when navigating through the folders (but, obviously, throwing an error when trying to open it). Now, they are not listed anymore.

I had time to stop the synchronization on my PC and I still have the files here. I believe that if I restart synchronization, files from my PC missing on the server might be deleted, so what would be the best option to have my PC files properly re-synced on the server (considering I don’t have a clear view on the global list of impacted files and folders)?

obviously backup your files from your PC to an external HDD or something and then try the sync. did you replace the defect HDD on the server already?

replace files from your backup and then launch file scan: sudo -u www-data php occ files:scan (cf. documentation)

And for other apps, restore database (before occ file scan).

Thank to both of you.

Yes, disk has been replaced and server is up. Looking for a spare disk so I can backup what is needed.

At the moment, I’m running a file comparison between the PC and the server, so I’ll have a comprehensive view about what has been impacted.
Once done, I’ll backup the files, copy the missing one and then I’ll be able to copy the missing parts!

@esprit-libre, when you say to restore database for other apps, why doing that?
Only the synced files have been impacted, not the Nextcloud instance.

It was just a reminder, in case of.

Ok, thanks!

For now, I’ve done the backup, and currently copying missing files to the Nextcloud server… so just being patient !

files have been copied back to the server, ran occ files:scan command, and got a SQL error during the process (issue #6899).
It seems it happens when Nextcloud is handling a large amount of files, which is what I’m doing… So I’ve checked the folders sizes reported by Nextcloud and compared with my backup and they seen identical.
Since I have a cold backup, I’ll restart Nextcloud sync app… worst case, if files are deleted, I’ll be able to retrieve them from my backup!