Verifying a Cross-Disk Archive with Checksums
The first step in a cross-disk archive is not copying, but building a reviewable manifest for the source data. A checksum (for example, SHA-256) maps file co…
- Added to the lab
- Downloads
- 0
- Human review
- Review information not provided
The first step in a cross-disk archive is not copying, but building a reviewable manifest for the source data. A checksum (for example, SHA-256) maps file content to a fixed-length string; change one byte and the result is usually completely different. It can answer 'is this copy the same as the original?', but not 'is this data trustworthy?'
In practice, you can arrange it like this: after mounting the source disk, enter the archive root directory, and use find . -type f -print0 | sort -z | xargs -0 shasum -a 256 > manifest.sha256 to generate the manifest; on Linux, replace shasum -a 256 with sha256sum. -print0 and -z handle filenames containing spaces or newlines, and sort ensures both runs produce the same order, making line-by-line comparison easy. After copying to the target disk, run shasum -a 256 -c manifest.sha256 on the target side; the tool prints OK or FAILED for each entry.
A common mistake is to generate a manifest on the target disk only after copying is finished, then compare it against itself; this 'self-proof' is meaningless. The manifest must come from the source and be generated before copying begins; the source files should not be written to during the copy. When an archive spans multiple disks, save a manifest per volume, and record the volume label, relative paths, and generation order; otherwise, during recovery you cannot tell which manifest belongs to which disk.
The manifest itself also needs protection. If manifest.sha256 is stored on the same disk as the archive, a disk failure loses both; it is safer to store it on different media and checksum or sign the manifest again. If the goal is tamper resistance rather than just error detection, ordinary checksums are not enough; use a keyed HMAC or a digital signature.
If the archive is a single package file, you can also compute a single checksum directly over archive.tar and compare it with the record from the source side; but for a directory tree, a per-file manifest has more diagnostic value than a whole-package checksum, because on failure you can pinpoint the specific file rather than just a vague 'mismatch'.
Checksums also have clear limits. They detect content changes, not permissions, ownership, extended attributes, or timestamps—metadata that is often lost when copying across file systems. Symbolic links, hard links, and sparse files are handled differently by different tools; the manifest may record the link target rather than the content. If source files are still modified after the manifest is generated, verification will necessarily fail, but that indicates a problem with the process order, not a copy error. There is another case: matching checksums only mean the copy matches the manifest; if the manifest itself was generated from an already corrupted source, both sides will be 'consistently wrong'.
For long-term archives, a one-time check is not enough. Media ages, and bit flips may appear months later, so periodic re-runs of verification are needed, with results compared against historical records, using diff to see which entries changed from OK to FAILED. Note that rsync -c and similar verify-as-you-transfer options only guarantee the transfer process; they do not leave a reviewable manifest. On Windows, Get-FileHash can generate a manifest for the same purpose. With large numbers of files, verification time depends on disk and file scale, so it should be scheduled within the archive window rather than done afterward.
A checksum is not a substitute for a backup strategy; its value lies in turning 'did the copy succeed' from a subjective feeling into a verifiable conclusion.