Verifying backups

Perry Hutchison perryh at pluto.rain.com
Thu Oct 1 05:53:21 UTC 2015


"Ronald F. Guilmette" <rfg at tristatelogic.com> wrote:

> P.S.  I really do hope that I can get this to work with rsync.
> I do prefer not reinventing the wheel, but it is starting to seem
> simpler to me if I were to just write a Perl script that would
> walk two directory hierarchies, in parallel, and just repeatedly
> invoke the cmp command on all of the regular files found therein.

Just because rsync is an awesome hammer, it does not necessarily follow
that every problem involving backups closely resembles a nail :)

Since your source and backup are both local, I suspect using rsync as
a comparison tool is overkill.  (It may even be overkill for making
the backups in the first place.)  Had you considered "diff -q -r"?

    $ mkdir one two
    $ echo hello > one/hello
    $ ln one/hello two/hello
    $ echo different0 > one/foo
    $ echo different1 > two/foo
    $ diff -q -r one two
    Files one/foo and two/foo differ

or, if you prefer

    $ diff -q -r -s one two
    Files one/foo and two/foo differ
    Files one/hello and two/hello are identical

(I'm using gnu diff; other variants might have different command options.)



More information about the rsync mailing list