inno defrag

Defragment a tablespace by reclaiming free space and reordering pages.

Usage

inno defrag -f table.ibd -o table_defrag.ibd
inno defrag -f table.ibd -o table_defrag.ibd -v --json

Options

OptionDescription
-f, --filePath to source InnoDB data file
-o, --outputPath to output file (required)
-v, --verboseShow per-page details
--jsonOutput in JSON format
--page-sizeOverride page size
--keyringPath to MySQL keyring file

Behavior

  • Reads all pages from the source file
  • Removes empty and corrupt pages
  • Sorts INDEX pages by (index_id, level, page_number)
  • Fixes prev/next chain pointers within each index group
  • Renumbers pages sequentially
  • Rebuilds page 0 (FSP_HDR)
  • Recalculates all checksums
  • Writes to a new output file (source is never modified)