On Fri, 2023-07-07 at 14:26 -0500, Ron Flory via users wrote:
On 7/7/2023 12:42 PM, home user wrote:
> When I try to verify a back-up, I use "diff -r". The directory
> trees
> being compared contain about 870 files (mostly binary, like PNG,
> JPG,
> and so on), and take up about 707 megabytes. The trees being
> compared
> are on the hard drive and on a USB-3 stick. When I run the "diff -
> r"
> command, it seems to finish too quickly - it seems like less than a
> half of a second. I saw similar results a few weeks ago comparing
> about 30 gigabyte trees on the hard drive vs. on a USB-3.1 stick;
> the
> results were practically instantaneous. Is diff actually checking
> every bit (or byte), or is it using some "short cut"?
Was this immediately after your backup/copy completed? You may be
comparing against the in-memory disk caches.
You may (simply) flush the in-memory disk caches to force reads
from
the external disk with (run as root or sudo):
sync ; echo 3 > /proc/sys/vm/drop_caches
then try your diff again.
The point and syncing is important, but aside from that this is frankly
a terrible way to compare non-text files. Diff is strongly geared to
comparing text line by line, which isn't the OP's use case.
I'd suggest working with something like 'rsync --dry-run'.
poc