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

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

 



Now that the train of hail storms have shifted south, I can attention to this.

On 7/7/23 1:26 PM, Ron Flory 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.


What?  Is "diff" cheating?!

Test #1
I did a back-up yesterday morning.
I've shut down at least 3 times since then.  So surely the cache has been cleared.
So here is a "diff -r":
-----
bash.1[~]: time diff -r .incbak_20230706/ /run/media/weilian.eng//USB\ DISK/.incbak_20230706/

real	0m19.238s
user	0m0.138s
sys	0m1.177s
bash.2[~]:
-----
19+ seconds.  So you may be correct.

Next I'll try a new back-up, run the diff, clear the cache, and do another diff.  I'll report back in several minutes.
_______________________________________________
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