Re: question: does "diff" use short cuts?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux