Skip to main content

Crate idb

Crate idb 

Source
Expand description

InnoDB file analysis toolkit.

The innodb-utils crate (library name idb) provides Rust types and functions for parsing, inspecting, and manipulating InnoDB tablespace files (.ibd), redo log files, and system tablespace data (ibdata1).

§CLI Reference

Install the inno binary and use its subcommands to work with InnoDB files from the command line.

§Installation

cargo install innodb-utils          # crates.io
brew install ringo380/tap/inno      # Homebrew (macOS/Linux)

Pre-built binaries for Linux and macOS (x86_64 + aarch64) are available on the GitHub releases page.

§Subcommands

CommandPurpose
inno parseParse .ibd file and display page summary
inno pagesDetailed page structure analysis (INDEX, UNDO, LOB, SDI)
inno dumpHex dump of raw page bytes
inno checksumValidate page checksums (CRC-32C and legacy)
inno corruptIntentionally corrupt pages for testing
inno recoverAssess page-level recoverability and count salvageable records
inno findSearch data directory for pages by number
inno tsidList or find tablespace IDs
inno sdiExtract SDI metadata (MySQL 8.0+)
inno logAnalyze InnoDB redo log files
inno infoInspect ibdata1, compare LSNs, query MySQL

§Global options

All subcommands accept --color <auto|always|never> and --output <file>. Most subcommands also accept --json for machine-readable output and --page-size to override auto-detection.

See the cli module for full details.

§Library API

Add idb as a dependency to use the parsing library directly:

[dependencies]
idb = { package = "innodb-utils", version = "1" }

§Quick example

use idb::innodb::tablespace::Tablespace;
use idb::innodb::checksum::validate_checksum;
use idb::innodb::page::FilHeader;

// Open a tablespace (page size is auto-detected from page 0)
let mut ts = Tablespace::open("table.ibd").unwrap();

// Read and inspect a page
let page = ts.read_page(0).unwrap();
let header = FilHeader::parse(&page).unwrap();
println!("Page type: {}", header.page_type);

// Validate the page checksum
let result = validate_checksum(&page, ts.page_size());
println!("Checksum valid: {}", result.valid);

§Key entry points

Type / FunctionPurpose
TablespaceOpen .ibd files, read pages, iterate
FilHeaderParse the 38-byte header on every InnoDB page
PageTypeMap page type codes to names and descriptions
validate_checksumCRC-32C and legacy checksum validation
extract_sdi_from_pagesSDI metadata extraction (MySQL 8.0+)
LogFileRead and inspect redo log files

§Module overview

ModulePurpose
innodb::tablespaceFile I/O, page size detection, page iteration
innodb::pageFIL header/trailer, FSP header parsing
innodb::page_typesPage type enum with names and descriptions
innodb::checksumCRC-32C and legacy InnoDB checksum algorithms
innodb::indexINDEX page internals (B+Tree header, FSEG)
innodb::recordRow-level record parsing (compact format)
innodb::sdiSDI metadata extraction and decompression
innodb::logRedo log file structure and block parsing
innodb::undoUNDO log page structures
innodb::lobLarge object (BLOB/LOB) page headers
innodb::compressionCompression detection and decompression
innodb::encryptionEncryption detection from FSP flags
innodb::constantsInnoDB page/file structure constants

§Feature flags

FeatureDefaultDescription
mysqloffEnables live MySQL queries via mysql_async + tokio (used by inno info).

Modules§

cli
CLI subcommand implementations for the inno binary.
innodb
InnoDB binary format parsing.
util
Shared utilities (hex dump formatting, filesystem helpers, optional MySQL connectivity).

Enums§

IdbError
Errors returned by idb operations.