Does rsync detect file corruption?
Matt McCutchen
matt at mattmccutchen.net
Thu May 28 15:44:26 GMT 2009
On Sun, 2009-05-24 at 14:53 -0700, Wayne Davison wrote:
> On Sun, May 24, 2009 at 06:32:40PM +0200, Christian Hecht wrote:
> > Such a tool i plan to write for Mac OS X. The first time it should
> > store checksums and mod times for all files to verify.
>
> There are various patches in the "patches" dir that deal with cached
> checksums in different ways:
>
> - checksum-reading.diff & checksum-updating.diff -- both of these use a
> special file in each dir to store the checksums, with the latter
> putting code into rsync to be able to update the file when copying
> the files (both have a perl script to build/update the files and
> check checksums against the file).
>
> - checksum-xattr.diff -- this has a script that puts checksums into an
> xattr field which rsync can access when it is using the --checksum
> option. The very latest version of this patch (in git) adds a --list
> and --check option to the script.
>
> - db.diff -- this is the start of some db-accessing code for rsync that
> can be used to store/access/check checksums (supports sqlite and
> mysql at present). This is the method I like the best, but the code
> is in an early state that needs more work.
IIUC, all of those patches are designed to maintain a checksum cache and
update it when the mtime changes. I don't see an obvious way to use any
of them to detect file corruption (defined as a checksum change without
an mtime change), although the "xsums" script in checksum-xattr.diff may
be a useful basis (ha ha) for writing a script that does that.
--
Matt
More information about the rsync
mailing list