On Mon, 2023-07-10 at 14:31 +0200, Roberto Ragusa wrote: > On 7/9/23 14:55, Robert Nichols wrote: > > > Also, if you run diff with the "-q" (--brief) option it will simply > > report which files differ, stopping after the first mismatch in > > each file, similar to what the cmp command would do. > > For completeness, since the original topic was "does diff use short > cuts?" and I've not > seen it mentioned in the thread yet, diff *does* use a shortcut: it > doesn't open the files > at all if they are hardlinks to the same file, because the content is > for sure equal. > Try this: > - go in a directory with a very big file (iso, mkv, qcow2, ...) > - ln myfile.iso myfile.iso2 > - diff myfile.iso myfile.iso2 > observe how the answer is immediate and the files are not opened at > all > (strace shows that after two "stat"s, it exits without any "open"). > > There is a common practice to have a source dir, "cp -al", then work > on the second one (important: detach links when saving), finally do > the diff, > it is very fast since the majority of files under comparison are > still hardlinked couples. That reinforces the point about using a compatible filesystem on the backup medium, i.e. one that supports hard links, so not FAT and the like. 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