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

Jon LaBadie ubu at labadie.us
Sun Apr 16 16:38:51 UTC 2023


On Sat, Apr 15, 2023 at 10:02:19PM +0100, Peter Flynn wrote:
>On 15/04/2023 12:52, Little Girl wrote:
>> Hey there,
>>
>> Colin Law wrote:
>>> Little Girl wrote:
>>
>>>> Probably any of the many backup tools out there could do it.
>>
>>> If the OS has a cached version of the file then I believe that when
>>> the backup program asks the OS to read the file it will be given the
>>> cached version, just the same as any other program such as diff. So
>>> again that would not prove that the file has been successfully
>>> written to the stick.
>>
>> Ah. I must have missed that. A small test could be done with a backup
>> of one text file that gets copied over and then changed in one
>> location before the comparison is run. Grsync catches such changes
>> here, but I'm doing my backups from one SSD to another rather than a
>> stick.
>
>It occurred to me that it may be possible to append a character like a
>space or null to the end of the file (with, eg, echo) so that the OS
>will not use the cached copy. I assume in my ignorance that the OS
>relies on something like file size or timestamp to detect if the cache
>should be used or not. Maybe even touch would work.
>
I'm fairly certain you would be modifying the in-memory copy of that
part of the file.  The memory page would thus be marked as dirty/changed
and written to disk at some future time.

-- 
Jon H. LaBadie                  ubu at labadie.us



More information about the ubuntu-users mailing list