comparing 2 in rsync
jjlin at OCF.Berkeley.EDU
Sun Jan 11 22:04:04 GMT 2004
* On Jan 11, 2004 at 09:45:14, Johan wrote:
> Is there a sure way to test 2 cd's if they are true copies in rsync.
> I have tried this...
> rsync -avv /mnt/cdrom/ /mnt/cdrom2
> result....quite shotened...
I'm not really qualified to claim with any certainty whether rsync can
be used reliably for this purpose, but you'd probably at least want to
use -n somewhere, since if there is indeed a mismatch somewhere, you're
asking rsync to update that file, and I suspect it'll probably bomb out
once it finds it can't write to the cd-rom. Then you wouldn't find out
about mismatches that come later. Also, I guess you'd probably want -c
so checksums are always computed.
Probably more practical is to use something like
$ cd /mnt/cdrom; find . -type f | sort | xargs md5sum > /tmp/sum1
$ cd /mnt/cdrom2; find . -type f | sort | xargs md5sum > /tmp/sum2
$ diff sum1 sum2
This will miss things like empty directories and things that aren't
regular files (like, say, symlinks). Also, it'll probably have trouble
with filenames that contain whitespace. But with some more effort (and
complication), you can get around most of the important problems.
Hope that helps.
More information about the rsync