Research notes / Recovery evidence
What a recovered disk image can actually prove
HESELA RESEARCH NOTE | 18 OCTOBER 2026 | GNU DDRESCUE 1.30
A recovery image, a completed map and a zero exit status answer different questions. In a controlled test, resuming a copy brought the map to 4,096 finished bytes while only 3,584 bytes matched the source. The mismatch came from earlier sparse writes into a nonzero destination, a use explicitly excluded by the manual. Simply disabling sparse writes on resume did not revisit the already-finished sector.
This is a reproducible demonstration of documented software behavior and its combined consequences, not a newly discovered ddrescue defect or a study of failing drives. It connects recovery bookkeeping with the existing Hesela work on checksums and identity, sparse allocation and backup acceptance.
The experiment in one table
The source contains eight 512-byte sectors: A, zero, C, D, E, F, G and H. Each letter means 512 repetitions of that ASCII byte. A reused destination starts filled with Z. Errors are simulated by ddrescue’s own --test-mode; no storage device is opened. Every copy uses a one-sector copy buffer. Sector numbers start at zero.
| Case | Finished bytes | Matching bytes | Map complete? |
|---|---|---|---|
| Fresh, no error | 4,096 | 4,096 | Yes |
| Fresh, unread C sector | 3,584 | 3,584 | No |
| Reused, unread C sector | 3,584 | 3,584 | No |
| Fresh, unread zero sector | 3,584 | 4,096 | No |
| Sparse + fresh, no error | 4,096 | 4,096 | Yes |
| Sparse + reused, no error | 4,096 | 3,584 | Yes |
| Sparse + reused, unread C | 3,584 | 3,072 | No |
| Resume last case, no error | 4,096 | 3,584 | Yes |
“Finished” is the number of map bytes marked +; “Matches” is a separate byte comparison with the known fixture. Every rescue operation in this table returned 0. Full-domain ddrescuelog --done-status returned 1 for the incomplete maps and 0 for complete maps. Counts describe these deliberately constructed examples, not success rates.
Why a later successful resume can preserve wrong bytes
The sparse-reused case combines two independent mechanisms. At byte offset 512, ddrescue successfully reads a zero-filled copy buffer. Sparse mode skips the physical write, leaving the old Z bytes in the reused destination. At offset 1,024, the simulated read error prevents the C sector from being copied. The resulting map describes the first sector as finished and the second as bad.
Sector index 0 1 2 3 4 5 6 7
Known source A 0 C D E F G H
Before resume A Z Z D E F G H
Map before + + - + + + + +
After resume A Z C D E F G H
Map after + + + + + + + +
The resume disables both sparse mode and error simulation, and requests one retry pass. C is recovered. The old Z bytes at the earlier zero sector remain because that map range is already finished. The experiment therefore reaches a complete map with an incorrect image.
The upstream manual warns that sparse output requires an empty or zeroed destination. In the pinned source, Rescuebook::copy_block checks whether the entire copied buffer is zero before skipping its write. The one-sector buffer makes the zero region separable here; this does not imply that every zero byte in every mixed buffer is skipped. GNU manual, invoking ddrescue
Negative controls matter
A fresh destination with sparse writes matches all 4,096 source bytes. A reused destination with ordinary writes correctly replaces the readable zero sector. The incorrect sparse result is not evidence that sparse files inherently corrupt data. It demonstrates violation of a documented destination-state precondition, followed by a resume that relies on the original map.
Normal exit is not full recovery
Four incomplete rescue cases return 0 in this experiment. A second command checks the map: ddrescuelog --done-status. It returns 1 for each incomplete full-domain map. Restricting that same check to the first 512 bytes returns 0 in every case, including images with an unresolved sector elsewhere. Preserve the check’s range as part of the result. GNU manual, invoking ddrescuelog
No example command here should be adapted blindly to a failing device. In particular, truncating an existing recovery destination can destroy previously recovered data. The supplied harness accepts executable paths and an output receipt, not a production source or destination device.
The practical consequence
Keep the image, its original map, the acquisition commands and the source identity together. Check completeness over the intended range, then assess content integrity separately. A hash calculated only after recovery identifies that output; without a trusted comparison value it does not establish where the bytes came from.
A reconstructed map can invert the evidence
Generate mode derives an approximate map from the partial output. It uses nonzero sector contents as a proxy for completed copying. It does not recover sectors or perform a byte-for-byte source comparison. The source implementation Genbook::check_block reads the output descriptor and marks nonzero sectors finished. GNU manual, generate mode
| Original output | Original finished | Generated finished | Matching bytes |
|---|---|---|---|
| Fresh, unread C | 3,584 | 3,072 | 3,584 |
| Reused, unread C | 3,584 | 3,584 | 3,584 |
| Sparse + reused, unread C | 3,584 | 4,096 | 3,072 |
In the ordinary reused destination, the real zero sector becomes ?, while the unread sector containing old Z bytes becomes +. The original and generated maps both show 3,584 finished bytes, yet they identify different ranges. Comparing only aggregate completion counters would miss the inversion.
The sparse-reused output contains no all-zero sectors at all. Its generated map is entirely finished even though two sectors differ from the source. The generated map is not a replacement for the original acquisition record.
Identical image bytes can have different acquisition histories
The fresh-bad-zero case prevents reading the zero sector. Later writes extend the new output beyond that offset, and the gap reads as zeros. Its image is byte-identical to fresh-healthy, including the SHA-256 digest. One map is incomplete and the other is complete.
This is not a hash collision: the files really are identical. A trusted reference hash would provide evidence of byte equality under the hash’s usual assumptions. It would still not prove that every sector had been read successfully during this particular acquisition. The experiment has ground truth because the input is a constructed fixture; that ground truth may be unavailable in actual recovery.
The reverse distinction also appears. After a healthy copy, the harness changes one sector in the image while retaining the original map. --done-status still returns 0. It evaluates the map, not the current image’s checksum. A preserved map therefore needs explicit association with a particular image version.
Record three layers separately
- Acquisition: source identity, geometry, range and offsets, command, version, original map and unresolved ranges.
- Artifact integrity: hashes and sizes of the image and map after collection, preservation copies, and any known trusted reference digest.
- Recovered meaning: filesystem or format checks, required files and application-level acceptance. A complete block acquisition is not itself proof of application correctness.
Successful reads are not a content-integrity oracle
The FAST ’08 study by Bairavasundaram and colleagues distinguishes checksum mismatches, block-identity discrepancies and parity inconsistencies. In the studied storage stack, a block could pass its checksum yet fail the filesystem’s identity check; parity checks could detect inconsistencies even when individual block checksums passed. These are different observations, not interchangeable definitions of success. Full paper, Sections 2.2-2.3
Hesela’s implication for recovery is narrower: keep read coverage, byte integrity and application acceptance separate. Our test mode simulates reported read errors, not silently wrong source bytes. It therefore cannot estimate how often a readable recovered image is semantically correct. The FAST study used historical production telemetry, not ddrescue runs; its fleet frequencies must not be transferred to these twelve fixtures. See the checksum and block-identity analysis for that separate evidence.
Reproduce the result
The dataset and CSV include the harness, original receipt, tests and source ledger. The harness creates only disposable regular files, then removes them. Complete map text, sector hashes, commands and exit statuses remain in the JSON receipt. It refuses to replace an existing receipt.
Build upstream GNU ddrescue 1.30 from the GNU release archive. The recorded archive SHA-256 is:
2264622d309d6c87a1cfc19148292b8859a688e9bc02d4702f5cd4f288745542
The source was fetched over HTTPS and its bytes pinned; no detached-signature verification was performed. Build commands were ./configure, make -j2 and make check; the upstream test suite passed. Installation is unnecessary.
python3 observe.py \
--ddrescue /path/to/ddrescue-1.30/ddrescue \
--ddrescuelog /path/to/ddrescue-1.30/ddrescuelog \
--output fresh-results.json
DDRESCUE_BIN=/path/to/ddrescue-1.30/ddrescue \
DDRESCUELOG_BIN=/path/to/ddrescue-1.30/ddrescuelog \
python3 -m unittest -v test_observe
Recorded environment: Python 3.12.14, Linux 6.18.55, x86_64; g++ 13.3.0, -O2. All 12 cases reproduced in normal, -O and -OO Python runs after excluding map timestamps and comments from the comparison, while retaining byte hashes, per-sector outcomes, range states and exit statuses. Thirteen tests passed, including live replay and mutations of misleading receipts. The raw receipt retains the original map comments.
Scope and limits
This is a small, deterministic counterexample set using one upstream release and one build. It establishes possible outcomes under the tested configuration, not their frequency. There are no physical read errors, power interruptions, filesystem mounts, throughput measurements or hardware-recovery claims. Test mode bypasses selected source reads; it does not reproduce firmware retries, unstable data returned without an error, or a failing device’s mechanics.
The independent oracle is the fixture’s complete byte sequence. No sampling confidence interval applies. Additional runs on another pinned release would test version portability; they should not overwrite this receipt. Real-device validation would require a separate non-destructive protocol and hardware access.
Evidence trail
Primary evidence is the GNU 1.30 source distribution, especially doc/ddrescue.texi, rescuebook.cc, genbook.cc and ddrescuelog.cc. sources.json pins their hashes and exact sections/functions. claims.json connects each synthesis claim to source locations and observed case IDs. No third-party source code or executable is redistributed in this bundle.
A second environment rebuilt the same pinned GNU release, passed its upstream tests and reproduced all twelve cases. All thirteen harness tests passed, including live replay. The second receipt preserves its own environment, executable hashes and timestamps; the original receipt remains unchanged. This checks software repeatability, not hardware recovery performance.
The machine-readable dataset includes column definitions, source-to-claim mappings and a deterministic CSV generator. The corpus also defines the ddrescue mapfile separately from the recovered image.
Locate the partition before interpreting its files
A disk partition identifies a logical address range. When it contains a filesystem, the partition entry locates the container, not individual files. Partitioning and filesystem layout are separate layers. util-linux v2.40.4 fdisk documentation.
GPT's ending LBA is inclusive. For start S, end E and logical-block size B, the offset is S * B and the length is (E - S + 1) * B. Use the layout's logical-block size, not its physical-sector size. UEFI 2.10, table 5.6.
| Logical block (bytes) | Start offset (bytes) | Length (bytes) |
|---|---|---|
| 512 | 1,048,576 | 1,048,576 |
| 4096 | 8,388,608 | 8,388,608 |
Check each tool's unit contract. In blockdev --report, StartSec uses 512-byte sectors; --getsz also uses that fixed unit, while --getss reports logical-sector bytes. For the 4096-byte row above, the same start offset is GPT LBA 2,048 or StartSec 16,384. Multiplying the latter by 4096 gives 67,108,864 bytes, eight times the correct offset. These are equivalent address representations, not extra capacity. util-linux v2.40.4 blockdev documentation.
Both rows describe 2,048 blocks, but the byte ranges differ eightfold. These are calculated examples, not two interpretations certified for the same image. Range arithmetic alone checks neither usable-LBA bounds nor overlap, CRCs, acquisition coverage or filesystem health.
Extending the partition does not by itself extend its filesystem. For ext2/3/4, resize2fs changes the filesystem, not the partition table. Shrinking the container below the filesystem size can destroy data; moving its start without relocating the contained filesystem can make it inaccessible. e2fsprogs v1.47.2 resize2fs documentation. Preserve the acquisition and its geometry record; perform any resizing or repair on a separate working copy.
GPT checks validate partition metadata, not recovered payload
Added 21 October 2026. A recognized partition table is another layer of evidence, not a substitute for the acquisition map or file validation. GUID Partition Table (GPT) describes partition locations and identifiers. Its backup metadata is not a copy of the files inside those partitions.
The protective MBR at LBA 0 marks space as type 0xEE for legacy tools. GPT's primary header is at LBA 1; the backup header is at the disk's final logical block. Both describe an entry array. Addresses are logical blocks, so byte offsets depend on the logical block size recorded for the acquisition. UEFI 2.10, chapter 5.
The header CRC covers HeaderSize bytes with its own CRC field temporarily zeroed. A separate CRC covers NumberOfPartitionEntries * SizeOfPartitionEntry array bytes. Neither checksum covers partition payload. Passing both checks also does not authenticate their origin or establish freshness. Linux v6.18 checks each copy separately and compares selected cross-copy metadata: is_gpt_valid and compare_gpts.
Six constructed byte examples
The following results come from a 65,536-byte in-memory fixture with 512-byte logical blocks, 92-byte headers and 16,384-byte entry arrays. The entry declares an EFI System Partition type, but its payload is a known byte pattern, not a filesystem; the label does not make it one. The five mutation cases start independently from the same baseline. No disk, firmware, filesystem parser or ddrescue process is exercised.
| Case | Primary header / array CRC | Backup header / array CRC | Entry arrays equal? | Payload equals baseline? |
|---|---|---|---|---|
| Unchanged baseline | Pass / Pass | Pass / Pass | Yes | Yes |
| Primary header byte changed | Fail / Pass | Pass / Pass | Yes | Yes |
| Primary entry byte changed | Pass / Fail | Pass / Pass | No | Yes |
| Partition payload byte changed | Pass / Pass | Pass / Pass | Yes | No |
| Backup name changed; CRCs recomputed | Pass / Pass | Pass / Pass | No | Yes |
| Reserved header-block byte set to one | Pass / Pass | Pass / Pass | Yes | Yes |
Changing one payload byte leaves all four metadata CRC checks passing. Changing the backup partition name and recomputing its CRCs produces individually CRC-valid, mutually inconsistent copies. That is not a claim of a valid GPT or a prediction of which copy an operating system will choose. The entry arrays can be compared directly here; the headers cannot, because their own locations, partner locations, array locations and resulting header CRCs legitimately differ.
The reserved-byte example changes only absolute byte 604: offset 92 within the primary header block. All four CRC checks still pass because this fixture's HeaderSize is 92. Yet UEFI 2.10 Table 5.5 requires the remainder of the block to be zero. A checksum result is therefore narrower than format conformance, even before checking any filesystem. This example does not measure whether a particular parser rejects that byte.
What the installed parsers actually reported
All 24 native-tool invocations returned exit code 0, including those that warned about damaged metadata. We wrote the same six fixtures to private regular files and ran sfdisk --json, sfdisk --verify, sgdisk --print and sgdisk --verify. The installed versions were util-linux 2.39.3 and GPT fdisk 1.0.10; package revisions and binary hashes are in the receipt. Every before/after image hash was identical.
| Fixture | sfdisk --verify | sgdisk --verify |
|---|---|---|
| Unchanged baseline | Same diagnostics as baseline | Same diagnostics as baseline |
| Primary header byte changed | Backup used; primary-corruption warning | Backup used; primary-header warning |
| Primary entry byte changed | Backup used; primary-corruption warning | Backup used; primary-array warning |
| Partition payload byte changed | Same diagnostics as baseline | Same diagnostics as baseline |
| Backup name changed; CRCs recomputed | Same diagnostics as baseline | Copies differ; backup-table CRC warning |
| Reserved header-block byte set to one | Same diagnostics as baseline | Same diagnostics as baseline |
Read both output streams, not just the exit code or final sentence. For the two primary-corruption cases, sfdisk warned on stderr that it was using the backup, then reported No errors detected. on stdout. The v2.39.3 parser source explains why: probing can reconstruct metadata in memory before the verifier examines that loaded state. This does not mean that the original primary bytes were repaired.
In the inconsistent-backup case, sgdisk warned that the tables differed, while sfdisk's verification output matched its baseline. Both listings still exposed the primary name, Fixture. The backup's name was Gixture. sgdisk also labeled a backup-table CRC problem; that diagnostic does not overturn the independent result above, where each original array matches its own stored CRC. Keep cross-copy disagreement separate from per-copy checksum failure.
For the payload mutation and the reserved-byte mutation, both tools produced baseline-equivalent output after filename normalization. Baseline-equivalent is not warning-free: sgdisk's verifier cautioned about the partition-end alignment even on the unchanged image. No tested command established filesystem health, bootability, payload recovery or full UEFI conformance.
The practical acceptance record should retain the command and version, exit status, stdout, stderr, selected copy and independent checks of the original bytes. A recovery workflow that accepts only a zero status loses the warnings demonstrated here. These six deliberate cases are not a failure-rate estimate or a claim about other releases, sector sizes, firmware or kernel parsing.
Download the native method and source review, fixed-command driver, 24 raw observations, table generator, generated table data and native-receipt tests. Place them alongside the original byte script and tests linked below. The driver constructs only disposable files; it takes no image or device input and performs no repair.
Identifiers are not content verification
A partition type GUID declares a purpose, while UniquePartitionGUID identifies an individual partition and DiskGUID identifies the disk. The type does not prove that the expected filesystem exists or is healthy. The util-linux v2.41 manual exposes these as separate type, partition-UUID and disk-ID fields.
Which identifier survives a new filesystem?
A filesystem UUID belongs to filesystem metadata. On GPT, the unique partition GUID belongs to its partition entry, as specified in UEFI 2.10, table 5.6. Linux mount distinguishes UUID= from PARTUUID=; formatting the contained filesystem does not itself change the latter. See the util-linux v2.41 identifier documentation.
Ext4's s_uuid is stored at byte offset 0x68 within its superblock, not at that offset in the disk. It is a filesystem identifier, not a content digest. Linux v6.12 ext4 layout.
A clone can preserve identifiers without proving which copy you selected. The mount manual warns that copied devices can have duplicate UUIDs. Record both identity layers and the selected image or device path. Preserve the acquisition image and map unchanged; make any operational identity changes on a separate working copy, recording what changed. This is recovery-workflow guidance, not another measured ddrescue case.
For copies intended for use as disks or partitions, UEFI 2.10, section 5.3.3 requires new disk and unique partition GUIDs and warns that duplicate GUIDs produce indeterminate results. A byte-preserving acquisition has a different purpose: keep its original identifiers as evidence and separate it from the operational copy.
Read-only mounting is not a write blocker. The mount manual warns that a dirty ext4 filesystem can replay its journal even with ro. Preserve the acquisition before mounting a working copy; see ext4 journal replay and recovery boundaries for the trade-off when replay is suppressed.
A related distinction appears in Bairavasundaram et al., FAST 2008, sections 2.2 and 3.2: their storage system checks block contents at the RAID layer, but needs filesystem context to check block identity. Their operational logs describe detected events in that system, not a complete census of corruption or evidence about GPT. The engineering lesson is to name both the bytes checked and the question the check can answer.
For recovery, preserve the original image and map before experimenting with partition repair on a working copy. Report metadata checks, cross-copy consistency, acquisition coverage and application acceptance separately. Restoring a table can make a range discoverable without restoring its missing bytes.
Reproduce only these byte examples with the standalone Python script, eleven tests and machine-readable results. Run python3 observe.py and python3 -m unittest -v test_observe. This is a checksum-coverage demonstration, not a complete GPT validator. The original twelve ddrescue cases and their receipts remain unchanged.