Complete Documents Are Gone — Can Surviving Fragments Be Recovered?

Recover Plaintext Deep Fragments

Scenario Description

Block headers, cells or document boundaries are damaged and complete-block recovery yields no results, but recognizable BSON bytes may survive. Deep-fragment recovery separately retains complete-document candidates, field fragments and structural evidence for further analysis.

Possible Causes

  • WT block or record boundaries are partially damaged.
  • Only plaintext or recognizable compressed fragments survive.
  • The image contains multiple physical versions and isolated fields.

Challenges

Conventional recovery often requires complete files, a running instance or a usable backup. In these situations, choose a method based on the evidence that survives.

Common Errors and Symptoms

  • - Complete blocks cannot be parsed, but BSON boundary evidence remains.
  • - Only some fields are readable and documents are incomplete.
  • - A damaged compressed stream yields only a readable prefix.

Why Traditional Methods Fail

  • - Field fragments cannot establish a complete document and collection.
  • - Compression, dictionaries and encryption limit readable ranges.
  • - Joining fragments into complete documents can produce incorrect results.

PDU Solution

Specify the file or image and scan range for a deep-fragment scan. PDU exports documents, fields and structures separately. Recognizable compressed fragments are decoded within the permitted range, retaining readable prefixes. File sources, offsets, types and failure reasons are recorded separately.

Recovery Principle

  1. Declare File or Image
  2. Scan BSON Fragments
  3. Separate Documents and Fields
  4. Save Structural Evidence

PDU Core Capabilities

  • Scan independently of complete WT blocks.
  • Export complete-document candidates separately.
  • Save field fragments and structural evidence separately.
  • Handle recognizable Snappy/zlib/zstd fragments within bounds.
  • Retain readable prefixes and original locations.
  • Check unfinished output units and checkpoints before continuing.

Recovery Steps

  1. 1

    Initialization

    Deep scanning searches byte windows independently of SCAN_STEP alignment for complete blocks. Retain declared holes for mapped sources; complete documents spanning readable logical extents can use the mapping.

  2. 2

    Build a Fragment Index

    Indexes retain source positions, lengths, classifications and field descriptions without caching customer document bodies. Record completeness, collection attribution and business time separately.

  3. 3

    Export Complete-Document Candidates

    Complete BSON with a unique interpretable _id enters complete_document_candidate. Output retains original BSON or Canonical Extended JSON without proving original collection, commit state or pre-incident time.

  4. 4

    Export Field Fragments and Suspected Structures

    ClassificationMeaning
    field_fragmentIndependently interpretable scalar fields with unknown container boundaries and original record relationships.
    structure_suspectComplete BSON structures that do not meet complete-document candidate criteria.

    Both outputs explicitly mark recovered_document=false and include raw fragments and source coordinates. Selections use separate tasks/output without assembling fields, guessing missing values or writing to a target database.

  5. 5

    Handle Unrecoverable Content

    Important: Scope of Plaintext Fragments

    Deep scanning can extract readable Snappy/zlib/zstd prefixes within bounds. It cannot recreate missing compressed bytes, dictionaries, unknown ciphertext, overwritten bytes or missing fields. Complete decodable compressed WT blocks continue through complete-block and mapped paths.

  6. 6

    Continue the Recovery Task

    Continue with the original task and selection. If an unfinished partial output remains ACTIVE, the engineer must decide how to handle it; PDU does not read or delete it automatically. Multi-source tasks use the corresponding case resolve.

    Retain native success, failure, unresolved dependencies, original errors and checkpoints. Completed-run resume reads native records and file metadata without checking exported content for counts, JSON, UTF-8, hashes, redecoding or trial import.

Quick Command Examples

Preserve frozen sources and launch PDU outside them. Write configuration snippets to pdu.ini and execute PDU commands after startup. Replace example paths, versions, times and task identities with actual evidence.

# Initialization

DISK_PATH=/recovery-input/mongodb/source/collection-source.wt
SOURCE_VERSION=8.0.0
SOURCE_KIND=copy
SOURCE_FROZEN=true
RESMODE=all
EXMODE=bson

# Build a Fragment Index

ds fragments idx;
ds fragments status;

# Export Complete-Document Candidates

ds fragments unload documents;

# Export Field Fragments and Suspected Structures

ds fragments unload fields;
ds fragments unload structures;

# Continue the Recovery Task

ds fragments resolve discard-active documents;

Export Results

Document Candidates

Complete BSON candidates and physical positions without automatic collection attribution.

Field Fragments

Readable fields and boundary evidence, not complete documents.

Structural Evidence

Structures, source offsets, compressed prefixes and failure reasons.

After export, record PDU’s native success and failure counts and original errors, retaining checkpoints. Resume uses native records and file metadata without rereading exported data or automatic trial import.

Prerequisites

  • This documentation applies to Linux and source versions MongoDB 6.0.0, 7.0.0 and 8.0.0. Freeze source copies and launch PDU from a directory outside the sources. State and output use the launch directory without separate path settings. Confirm other versions and special layouts separately.
  • Specify a concrete file or image. Deep scanning does not require a valid WT descriptor block; register a concrete file before using a directory source.
  • Prepare a matching program, license and sufficient space. Keep original evidence read-only and place the PDU launch directory outside the sources.

Important Notes

  • Ciphertext, missing dictionaries, undecoded tails and overwritten bytes retain failure reasons.
  • Field and structural fragments are not automatically joined, deduplicated or declared business documents.
  • deep accepts a concrete file or image rather than a directory.
MongoDB 场景案例