Database Won’t Start?
Recover from Corrupted Instance
Scenario Description
WiredTiger data-file or metadata damage prevents MongoDB from starting, so mongodump cannot connect. A frozen dbPath copy survives. Preserve readable turtle, catalogs, collection files and dependencies, then extract documents through confirmed directory relationships and checkpoints.
Possible Causes
- Power loss, storage faults or file damage.
- An incomplete directory copy omitted catalogs or collection files.
- Source versions or checkpoint dependencies do not match.
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
- - mongod cannot start or open WiredTiger data.
- - mongodump cannot connect to the failed instance.
- - Collection relationships or required dependencies are incomplete.
Why Traditional Methods Fail
- - Logical export requires an instance that can read collections.
- - Repeated repair or startup changes the original evidence.
- - Scattered WT files do not establish complete catalogs or collection attribution.
PDU Solution
PDU reads the WiredTiger directory and selected checkpoint from an offline copy, identifies databases and collections through the catalog, then exports parseable documents. The damaged instance does not need to start. Missing metadata and damaged dependencies are recorded with their original causes.
Recovery Principle
- Preserve Frozen Directory
- Read Catalog
- Confirm Collection and Checkpoint
- Export Readable Documents
PDU Core Capabilities
- No connection to the failed mongod is required.
- Initialize and inspect catalog status.
- List identified databases and collections.
- Export a collection or database.
- Read large documents with known dependency mappings.
- Record collection results and original errors separately.
Recovery Steps
- 1
Initialization
Set MONGODBDATA in pdu.ini to the frozen database directory. State and output use the directory where PDU is launched.
Enter the pdu directory and execute b; to complete initialization. PDU reads WiredTiger metadata and the MongoDB catalog to establish database and collection relationships.
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
View Current Databases
Use \l; to view selectable databases. Database names come from the matching catalog rather than collection filenames.
- 3
Enter Database and View Collection Information
Use use database_name; to select and enter the corresponding database. Use \dt; to view collections and \d collection_name; to view collection information.
- 4
How to Use Exported Data
Use the corresponding command example below, replacing paths, objects and identity parameters with evidence from this run.
- 5
Components of Exported Data
Collection data is exported as BSON files or Canonical Extended JSON line files. Recovery commands generate offline candidate data without writing to the target database. Native records retain sources, success, failure, unresolved dependencies, original errors and checkpoints.
- 6
Paths of Exported Data
Exported files and task state are saved in the current working directory where PDU was started. Use the paths reported by PDU. Existing export results are not overwritten.
After export, record the native success and failure counts, unresolved dependencies and original errors reported by PDU, and retain the checkpoint. Resume uses native records and file metadata such as existence and size without rereading exported data.
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
MONGODBDATA=/recovery-input/mongodb/source/dbpath# Initialization
./pdu
param sourceversion 8.0.0;
param sourcekind copy;
param sourcefrozen true;
b;
ds catalog status;# View Current Databases
\l;# Enter Database and View Collection Information
use appdb;
\dt;
\d orders;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
- The MongoDB instance cannot start or connect due to corruption or misconfiguration.
- Collection files and matching WiredTiger directory metadata are still accessible on disk.
- Use a complete, consistent frozen copy, configure the exact source version and launch outside the sources.
- Prepare a matching program, license and sufficient space. Keep original evidence read-only and place the PDU launch directory outside the sources.
Important Notes
- Directory recovery requires matching catalogs and readable WiredTiger.turtle; a missing turtle root is not rebuilt automatically.
- A selected checkpoint is not an arbitrary pre-incident point, and normal export does not replay journal automatically.
- Confirm other versions, encryption and special source layouts from actual evidence.