This feature request arose from this thread:
The idea is that the user has the option to manually trigger a checksum based file verification process, in case the user suspects anything went wrong with the local data.
After pressing the new “Verify all files” button in the UI, Syncthing would:
- warn the user that any changes to files during that process my be lost
- hash every file and check it against the checksum in the index
- re-download all files where there is a checksum mismatch
Read-only nodes could execute this function periodically via an api call in a cron job. This would also then report broken and fixed files. This could also mitigate bit rot on primitive filesystems.
Issue #1315 on Github already discusses this and the idea was dismissed with the main points made:
- (A) This is something the filesystem should handle.
- (B) There is no way to detect if changes were made by the user and therefore should be synced, or if the data should be corrected.
Also, Audrius Butkevicius’ comment from the thread where this came up:
I don’t think verify feature makes sense. If the file changed we’d know (mtime and size changes), if it hasn’t changed, what’s the point of verifying? What are we trying to catch here? Bad drives? That’s not really syncthing’s problem.
I would like to comment about the two points made on Github, as well as Adrius’ comment.
First, the easy one:
(B) Because this would be a manual feature, the user has to trigger it and can be reminded to not change any files during the process.
Now the tricky one:
(A) Yes, you are right. Theoretically, the filesystem is responsible for the integrity of the files. There are really great filesystems out there that can totally handle all these problems.
But lets look at this from a practical perspective for a moment. For most users, Syncthing is a kind of DIY thing. They don’t trust cloud providers with their proprietary software to push all their data to some cloud. Or tech savvy people that use Syncthing for personal home network. Or just office colleagues that want to sync data.
All of these people have no idea about all these fancy filesystems that would solve integrity problems. They are way to complex and time consuming to set up and maintain.
My hypothesis is, that the majority of Syncthing users do not use self-healing file systems, and therefore the argument “that this is the filesystems job” does not hold true practically.
I’d like suggest that the maintainers evaluate this a feature carefully and give it consideration. I urge you to decide what is best for the project and listen to the community - and that may also mean to deny this feature request. I am not trying to push you into this. I am just contributing an idea.