XtraBackup backup files¶
This document provides a guide to the files and directory structure generated by the Xtrabackup tool. This information is essential for system administrators and database professionals who need to understand how to manage and restore backups.
Root backup directory files¶
After a successful backup, the following files will be found in the directory specified by the --target-dir
option. These files contain critical metadata used for the restoration process.
File Name | Purpose | Notes |
---|---|---|
xtrabackup_info |
Metadata about the backup, including the Xtrabackup version, start time, and server’s MySQL version. | The file is essential for all backups. |
xtrabackup_binlog_info |
Stores the binary log coordinates (position and file name) at the exact moment the backup completed. | The file is critical for point-in-time recovery. |
xtrabackup_checkpoints |
Contains key checkpoint information that Xtrabackup uses to ensure a consistent restore. | The file is essential for all backups. |
xtrabackup_logfile |
A copy of the InnoDB transaction log file from the server. | The log file is crucial during the prepare stage to roll back uncommitted transactions and apply committed ones. |
backup-my.cnf |
A snapshot of the server’s configuration file at the time of the backup. | The file is useful for understanding the server’s state when the backup was taken. |
xtrabackup_gtid_info |
The GTID set at the time of backup. | This file is only present if Global Transaction Identifiers (GTIDs) are enabled on the server. |
xtrabackup_slave_info |
Replication metadata, including the master’s binary log file and position. | This file is only created if the server is a replica. The file is used to set up the restored server as a new replica. |
xtrabackup_tablespaces |
Stores metadata about the external tablespaces. On restore, xtrabackup uses this information to ensure that these tablespaces are correctly restored to the same external paths. | The file is essential when innodb_file_per_table is enabled and the tablespaces are not stored in the main data directory. |
ib_buffer_pool |
A dump of the InnoDB buffer pool. | This optional file is created if buffer pool dumping is enabled (innodb_buffer_pool_dump_at_shutdown ). The file is not used for the restore operation, but the file can be used to warm up the buffer pool of the restored instance, improving performance. |
Database subdirectories¶
In addition to the files in the root directory, Xtrabackup creates subdirectories for each database present at the time of the backup. These directories contain the actual table data.
-
*.ibd
files for InnoDB tables: These files store the table data and indexes. Their presence is dependent on theinnodb_file_per_table
setting being enabled in the MySQL configuration. -
*.sdi
files for non-InnoDB tables: These contain serialized data dictionary information for tables.
Incremental Backups¶
When you perform an incremental backup, two additional files are created in the backup directory. These files are used in the apply-log phase of the restore process to merge the incremental changes into a full backup.
-
.delta
: This file contains the actual data changes from the InnoDB tables since the last full or incremental backup. -
meta
: This file stores metadata about the incremental backup. During theprepare
phase, the information in the.meta
file is apply the changes in the.delta
file to the InnoDB tablespace.
After processing the .delta
files, xtrabackup applies the redo log.
Verify backup contents¶
After a backup operation, you can quickly list the contents of your backup directory using the ls
command with the following options:
$ ls -lhR /backups/<backup-directory>
This command provides a detailed, human-friendly, and recursive listing of the entire directory tree.
-
l
(long format): Provides a comprehensive view of each file’s metadata, including permissions, owner, group, size, and the timestamp of the last modification. This information is useful for confirming who has access to the backup and when it was created. -
h
(human-readable): Displays file sizes in a user-friendly format (for example,1.2K
,50M
,1.5G
). You can quickly scan and understand the sizes of the backup files manually converting the size to bytes. -
R
(recursive): Lists the contents of all subdirectories, not just the top level. This operation is crucial for verifying that all database subdirectories and their contents are included in the backup.