Does rsync detect file corruption?

Jamie Lokier jamie at shareable.org
Sun May 24 16:25:55 GMT 2009


Daniel Carrera wrote:
> Jamie Lokier wrote:
> >Daniel Carrera wrote:
> >>But there is no way to distinguish between file corruption and a 
> >>legitimate change. All you can do is keep old backups for a few days or 
> >>weeks and hope that you detect the file corruption before the backup 
> >>rotation deletes all the good copies.
> >
> >I'm under the impression ZFS (Solaris) and BTRFS (Linux) allow a
> >checksum to be stored with the file data, so if the data changes due
> >to disk corruption or glitches in the I/O cabling, that will be detected.
> 
> Thinking a little more about this problem, there is one possible 
> solution: Store a checksum and mod time when the file is backed up. If 
> later on, the file's checksum is different but the modification time has 
> not changed, it is safe to assume that the file is corrupt. So we can 
> distinguish between legitimate edits an accidental corruption.

Unless an application changes the data without changing the
modification time.  It's allowed, it happens sometimes.

But you might decide that is not allowed in your particular
circumstances and should at least flag an alert and prevent the backup
from being overwritten.

-- Jamie


More information about the rsync mailing list