Is a tool available to check the integrity of copied files?

Bret Busby bret at busby.net
Fri Apr 14 21:19:56 UTC 2023


On 15/4/23 05:15, Ralf Mardorf via ubuntu-users wrote:
> Hi,
> 
> I've done some googling for "does linux diff compare data using a cache"
> to figure out what's going on. The first diff of 10 GiB of
> data copied from a SATA3 SSD to an USB 2 stick connected to an USB 3
> port took around a minute, right after the copy finished. A second diff
> needed 3 seconds. Both returned exit status 0.
> 
> It's impossible to read 10 GiB of data in 3 seconds from an USB 2 stick.
> Does diff use cached data instead of comparing the "real" files line by
> line?
> 
> Google returned "diff isn't doing any caching. The OS is. If you are
> using Linux, you can flush the disk buffers and cache".
> 
> I expected that diff ensures to compare the "real" files line by line,
> but seemingly diff isn't aimed to check integrity of data.
> 
> Does a command exist that compares "real" files, not just cached files
> by default?
> 
> I experience weird things with Raptor Lake hardware, especially if USB
> is involved and I want to check the integrity of USB transferred, saved
> files by using a tool, without manually clearing cached data manually.
> 
> Usually I don't sent the same request to more than one mailing list, but
> this time I urgently need help, because I run from one into another
> issue with new hardware. I've made harmless careless mistakes that were
> time-consuming because I'm overworked. Maybe I can't see the forest for
> the trees.
> 
> Regards,
> Ralf
> 

It might not be the proper way of doing it, but, if I have any doubts, I 
tend to check that the number of bytes of the source and target files 
(not the space that they occupy, but, the number of bytes of data), match.

..
Bret Busby
Armadale
West Australia
(UTC+0800)
..............




More information about the ubuntu-users mailing list