Crash Recovery Simulation
The inno simulate subcommand helps you understand what would happen at each InnoDB innodb_force_recovery level before you commit to setting it in production.
When to Use
- MySQL refuses to start after a crash and you need to choose a recovery level
- You want to assess the risk of data loss before setting
innodb_force_recovery - You need to document the state of a corrupted tablespace for incident response
- You want to verify that a tablespace can survive recovery without data loss
Quick Start
# Simulate all recovery levels against your system tablespace
inno simulate -f /var/lib/mysql/ibdata1 -d /var/lib/mysql
# Focus on a specific level
inno simulate -f /var/lib/mysql/ibdata1 -d /var/lib/mysql --level 3 -v
Recovery Level Decision Tree
Start at level 1 and only increase if the previous level is insufficient:
-
Level 1 — Try first. Skips corrupt pages but preserves all recoverable data. Safe for most single-page corruption.
-
Level 2 — If level 1 hangs on background operations. Prevents purge and insert buffer merge.
-
Level 3 — If crash recovery itself fails. Skips transaction rollback, which means uncommitted transactions remain visible.
-
Level 4 — If insert buffer corruption is suspected. Skips merge operations entirely.
-
Level 5 — If undo log is corrupted. Skips undo scanning, meaning the undo tablespace is treated as empty.
-
Level 6 — Last resort. Skips redo log entirely. The database starts in whatever state the data files are in, ignoring any pending redo operations.
JSON Output
inno simulate -f ibdata1 -d /var/lib/mysql --json
{
"file": "ibdata1",
"levels": [
{
"level": 1,
"name": "SRV_FORCE_IGNORE_CORRUPT",
"survivable": true,
"affected_pages": 2,
"risks": ["2 corrupt pages will be skipped"]
}
]
}
Workflow: Post-Crash Recovery
- Assess: Run
inno simulateto understand the damage - Back up: Copy all data files before attempting recovery
- Recover: Set
innodb_force_recoveryto the lowest effective level - Export: Use
mysqldumpto export all data - Rebuild: Restore from the dump into a fresh MySQL instance
- Verify: Run
inno verifyandinno auditon the new data directory
Related Commands
inno verify— structural integrity verificationinno recover— page-level recoverability assessmentinno checksum— checksum validationinno repair— fix corrupt checksums