How does syncthing deal with input/output errors?

Hi, say I have a bunch of machines that are synced with syncthing and that run checksummed filesystems like btrfs or ZFS. Now a file gets corrupted on one of the machines due to a bad block, or due to a RAM error (these things do happen over years). On OS level this manifests itself by an “input/output error” when trying to read the file.

How will syncthing deal with that? Specifically, is there a way to tell syncthing to go and fetch a correct copy from another machine? I fear that if I simply delete the corrupt file, that deletion will propagate to the other machines.

It probably won’t read the file all together.

We’d only read a file on two scenarios:

  1. The mtime has changed, we rescan it, in which case we would just skip the file: https://github.com/syncthing/syncthing/blob/master/lib/scanner/blockqueue.go#L96
  2. A request comes in for data in the file, in which case we’d just return an error and that peer is likely to get the block from somewhere else: https://github.com/syncthing/syncthing/blob/master/lib/model/model.go#L1194

There is no way to tell syncthing anything about that, as syncthing can’t make any assumptions on what that means, as it means different things on different systems.

Thanks. So it seems that if an unreadable file has been identified by scrubbing on host A, while the file still exists on host B, it should NOT be deleted on A, but rather directly overwritten by a fresh copy from a trusted source, e.g. scp B:file ..

Yes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.