To ensure the integrity of the backup data, MySQL Enterprise Backup provides a
validate
command for validating a
backup by the checksum values of its data pages after the backup
is created or transferred to another system.
mysqlbackup [STD-OPTIONS]
[--backup-dir=PATH][--backup-image=IMAGE]
[MESSAGE-LOGGING-OPTIONS]
[PROGRESS-REPORT-OPTIONS]
[CLOUD-STORAGE-OPTIONS]
validate
validate
Verifies that a backup is not corrupted, truncated, or damaged. This operation validates the checksum value for each data page in a backup.
To avoid spending excessive time and resources on files that are too heavily corrupted, mysqlbackup stops validating a .ibd file after more than twenty corrupted pages are found in it, and proceeds to the next file instead. In that case, the operation's summary will not give a full count of corrupted pages, but only says “at least 20 pages are corrupted.”
The operation also has the following limitations:
For any backup directory, the operation can only validate the InnoDB data files (
ibdata*
and*.ibd
files) in it. Problems with other file types within a backup directory (for example,.frm
file corruptions) are not detected.If any
.ibd
or.frm
files are missing from a backup directory during a backup or have been deleted from a backup directory after the backup was made, thevalidate
operation will not be able to detect the problem.If a backup directory has been corrupted by removing or truncating pages from any of the .ibd files inside , the
validate
operation will not be able to detect the problem.
Here is a sample command for validating a backup directory:
mysqlbackup -uroot --backup-dir=/logs/backupext validate
Here is a sample command for validating a backup image:
mysqlbackup -uroot --backup-image=/logs/fullimage.mi validate
The following is a sample command for validating an encrypted backup image and the output for the successful validation:
$ mysqlbackup –backup-image=/meb/backups/image.mbi --decrypt --key-file=/meb/enckeyfile validate 140219 11:22:44 mysqlbackup: INFO: Validating image ... /logs/img.bi 140219 11:22:44 mysqlbackup: INFO: Validate: [Dir]: meta 140219 11:22:45 mysqlbackup: INFO: Total files as specified in image: 44 mysqlbackup: INFO: datadir/tpch/tabnorm7.ibd Validated... mysqlbackup: INFO: datadir/tpch/tabnorm8.ibd Validated... mysqlbackup: INFO: datadir/tpch/tabnorm9.ibd Validated... ................ 140219 11:22:45 mysqlbackup: INFO: Validate operation completed successfully. 140219 11:22:45 mysqlbackup: INFO: Backup Image validation successful. mysqlbackup: INFO: Source Image Path = /logs/img.bi mysqlbackup completed OK!
This is a sample output for a checksum mismatch in the header:
mysqlbackup: ERROR: Checksum mismatch. Computed checksum: ### Checksum in image: ### mysqlbackup: ERROR: Problem verifying checksum of initial header of backup image. Image Path = /meb/backups/image.mbi mysqlbackup: ERROR: Backup image validation failed.
This is a sample output for an image containing corrupted
.ibd
files:mysqlbackup: ERROR: datadir/db2/bigtab1.ibd has corrupt page number : 64 page number from page header : 64 mysqlbackup: ERROR: datadir/db2/bigtab1.ibd is corrupt and has : 10 corrupt pages mysqlbackup: ERROR: datadir/db2/t1.ibd has corrupt page number : 4 page number from page header : 0 ....... mysqlbackup: ERROR: datadir/db2/t1.ibd is corrupt and has : 5 corrupt pages mysqlbackup: ERROR: datadir/ibdata1 has corrupt page number : 63 page number from page header : 63 mysqlbackup: ERROR: datadir/ibdata1 has corrupt page number : 7 page number from page header : 7 .......... mysqlbackup: ERROR: datadir/ibdata1 is corrupt and has : 10 corrupt pages mysqlbackup failed with errors!
This is a sample output for a successful validation for a compressed backup directory
mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm5.ibz Validated... mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm6.ibz Validated... mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm7.ibz Validated... mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm8.ibz Validated... mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabnorm9.ibz Validated... mysqlbackup: INFO: /backups/backup-dir/datadir/tpch/tabrowformat.ibz Validated... 140219 11:22:45 mysqlbackup: INFO: Validate backup directory operation completed successfully.