Collection File Damaged and Documents Unreadable?
Recover from Corrupted Data File
Scenario Description
A collection is unreadable, but its collection-*.wt file survives. A detached file or damaged blocks may still contain parseable records. Single-file recovery confirms the version and readable ranges before saving physical-version candidates, without inferring the business collection name.
Possible Causes
- Some collection-file blocks are damaged.
- The original directory is unavailable and only one WT file was recovered.
- Compression, overflow or attribution evidence is incomplete.
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
- - Collection queries fail, while the file remains readable as bytes.
- - Block headers, cells or document boundaries are damaged.
- - The same _id may have multiple physical versions.
Why Traditional Methods Fail
- - Normal export requires the instance to open the damaged collection.
- - A filename alone does not identify namespace or object generation.
- - Missing overflow pages affect large-document completeness.
PDU Solution
PDU probes and scans a WiredTiger file, then exports parseable records and their file positions. all mode keeps the physical versions without automatic deduplication. A matching catalog is needed to identify the business collection. Unreadable dependencies are recorded separately.
Recovery Principle
- Preserve Collection File
- Probe Physical Source
- Scan Readable Blocks
- Save Version Candidates
PDU Core Capabilities
- Probe a single file with ds probe.
- Parse using the exact source version.
- Retain parseable records and source positions.
- Keep physical duplicates and unknown attribution explicit.
- Record missing overflow pages and broken chains.
- Inspect scan and export progress through native state.
Recovery Steps
- 1
Configure pdu.ini
Important Notice
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.
- 2
Copy the Corrupted Data File
Preserve a copy of the original file and start PDU from a directory outside the source files. Tasks and output are saved in that working directory. Keep compression, encryption and overflow-page dependencies; file size alone does not show how much data can be recovered.
- 3
Probe the Data File
Probe results identify the physical source and parseable ranges. They are not a completed recovery and do not prove collection identity.
- 4
Parse the Data File
Single-file all mode exports parseable physical versions, which may include duplicate _id values. Collection ownership stays unknown when the file-to-collection relationship cannot be confirmed. PDU does not automatically deduplicate records or fill missing fields.
- 5
Handling External Large Values
Large documents may depend on overflow pages. Directory and declared logical-extent paths can read dependencies through known mappings. An unmapped image cannot locate overflow by guessed addresses. Retain original reasons for missing pages and broken chains.
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.
# Configure pdu.ini
DISK_PATH=/recovery-input/mongodb/source/collection-1.wt
SOURCE_VERSION=8.0.0
SOURCE_KIND=copy
SOURCE_FROZEN=true
RESMODE=all
EXMODE=bson# Probe the Data File
ds probe /recovery-input/mongodb/source/collection-1.wt;# Parse the Data File
ds idx;
ds idx status;
ds unload all;
ds log;Export Results
Recovered Documents
BSON or the selected data format at paths reported by the program.
Sources and Attribution
Retain namespace/UUID, source positions and candidate states; unresolved attribution stays unknown.
Tasks and Dependencies
The launch directory retains native tasks, checkpoints and original reasons for missing pages or overflow.
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
- Preserve a frozen collection-*.wt copy and exact source version.
- Single-file mode does not automatically identify the business collection name. Provide the matching catalog to determine which collection the file belongs to.
- Prepare a matching program, license and sufficient space. Keep original evidence read-only and place the PDU launch directory outside the sources.
Important Notes
- Single-file all may contain duplicate _id values and is not a unique current collection.
- Do not infer a business collection from the filename when catalog attribution is missing.
- Missing content is not zero-filled or converted to empty fields to create complete documents.