innochecksum
innochecksum is a tool for printing checksums for InnoDB files.
Usage
innochecksum [options] file_name
Description
It reads an InnoDB tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies. Because checksum mismatches will cause InnoDB to deliberately shut down a running server, it can be preferable to use innochecksum rather than waiting for a server in production usage to encounter the damaged pages.
Multiple filenames can be specified by a wildcard on non-Windows systems only.
innochecksum works with compressed pages, and also includes options to analyze leaf pages to estimate how fragmented an index is and how much benefit can be gained from defragmentation.
Options
innochecksum supports the following options. For options that refer to page numbers, the numbers are zero-based.
-a, --allow-mismatches=#
Maximum checksum mismatch allowed before innochecksum terminates. Defaults to 0, which terminates on the first mismatch.
-c, --count
Print a count of the number of pages in the file.
-e num, --end-page=#
End at this page number (0-based).
-?, --help
Displays help and exits.
-I, --info
Synonym for --help.
-f, --leaf
Examine leaf index pages.
-l fn, --log=fn
Log output to the specified filename fn.
-m num, --merge=#
Leaf page count if merge given number of consecutive pages.
-n, --no-check
Ignore the checksum verification. Until MariaDB 10.6, must be used with the --write option.
-p num, --page=#
Check only this page number (0-based).
-D, --page-type-dump=name
Dump the page type info for each page in a tablespace.
-S, --page-type-summary
Display a count of each page type in a tablespace
-i, --per-page-details
Print out per-page detail information.
-u, --skip-corrupt
Skip corrupt pages.
-r, --skip-freed-pages
innochecksum misinterprets freed pages as active, leading to confusion that too many valid pages exist. To avoid this, this option was introduced to avoid freed pages while dumping or printing the summary of the tablespace. From MariaDB 10.6.21, MariaDB 10.11.11, MariaDB 11.4.5, MariaDB 11.7.2.
-s num, --start-page=#
Start at this page number (0-based).
-C, --strict-check=name
Specify the strict checksum algorithm. One of: crc32, innodb, none. If not specified, validates against innodb, crc32 and none. full_crc32 is not supported. See also innodb_checksum_algorithm. Removed in MariaDB 10.6.0
-v, --verbose
Verbose mode; print a progress indicator every five seconds.
-V, --version
Displays version information and exits.
-w, --write=name
Rewrite the checksum algorithm. One of crc32, innodb, none. An exclusive lock is obtained during use. Use in conjunction with the -no-check option to rewrite an invalid checksum. Removed in MariaDB 10.6.0
Examples
Rewriting a crc32 checksum to replace an invalid checksum:
innochecksum --no-check --write crc32 tablename.ibd
A count of each page type:
innochecksum --page-type-summary data/mysql/gtid_slave_pos.ibd
File::data/mysql/gtid_slave_pos.ibd
================PAGE TYPE SUMMARY==============
#PAGE_COUNT PAGE_TYPE
===============================================
1 Index page
0 Undo log page
1 Inode page
0 Insert buffer free list page
2 Freshly allocated page
1 Insert buffer bitmap
0 System page
0 Transaction system page
1 File Space Header
0 Extent descriptor page
0 BLOB page
0 Compressed BLOB page
0 Page compressed page
0 Page compressed encrypted page
0 Other type of page
===============================================
Additional information:
Undo page type: 0 insert, 0 update, 0 other
Undo page state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
index_id #pages #leaf_pages #recs_per_page #bytes_per_page
24 1 1 0 0
index_id page_data_bytes_histgram(empty,...,oversized)
24 1 0 0 0 0 0 0 0 0 0 0 0
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?