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

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

 



On 7/7/23 3:15 PM, Patrick O'Callaghan wrote:
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'.

I don't follow.

To do a back-up of a directory tree, I
1. insert a USB-3.0 stick into a USB-3 port; this launches the "Files" GUI.
2. launch another "Files" GUI for my home directory.
3. drag the icon for the directory tree that I want to back up from the home directory "Files" GUI to the USB-3.0 stick "Files" GUI.
I do not know what the system does "under the hood" to do the copy.

Because of what George White said in a different thread way back on June 01:
-----
The crooks copy name-brand packaging.  Bogus USB drives can be introduced anywhere in the supply chain, so the problem
is usually discovered only when it refuses to hold advertised capacity.    Some reports say they silently discard data past the
physical capacity and fill reads with garbage, so casually transferring a large file will appear to work until you actually check the
contents.
-----
and for other reasons, it seems wise to verify the back-up.  And because of what George said, I want the check to check every bit of every file in the USB stick back-up.

What I back up is a mix of binary and text files.  I understand that "diff" is not the best for binary files, but "cmp" does not have a recursive option.  "rsync" does copying.  I don't see how that command (including with the "--dry-run" option) will verify the back-up.


_______________________________________________
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