How do Time Machine's checksums work?
I have a partial answer to my own question: while I don’t know whether Time Machine ever automatically verifies the checksums, a post on ycombinator.com provided me with an answer to my other two questions. The checksumming algorithm is the same one as the default one used by the Terminal utility cksum
. The checksum values are stored in the Time Machine backup as an extended attribute of each file (com.apple.finder.copy.source.checksum#N
). So to list the files for which no checksum is available, you would search for all files in the latest backup without the attribute, using a Terminal command like this one:
find '/Volumes/Time Machine HD/Backups.backupdb/Mac/Latest' -type f -not -exec xattr -x -p 'com.apple.finder.copy.source.checksum#N' '{}' ';' -print 2>/dev/null | grep /
I’ll quote the original post for details on checking the stored checksum against the output of cksum
:
RJIb8RBYxzAMX9u on Apr 18, 2017
[...] In any case, the "hash" appears to be CRC32, stored in extended attributes:$ xattr .inputrc com.apple.finder.copy.source.checksum#N com.apple.metadata:_kTimeMachineNewestSnapshot com.apple.metadata:_kTimeMachineOldestSnapshot $ xattr -px 'com.apple.finder.copy.source.checksum#N' .inputrc 26 E5 4A AB $ cksum .inputrc 2873812262 65 .inputrc $ printf '%x\n' "$(cksum .inputrc | cut -d ' ' -f 1)" ab4ae526