> For the complete documentation index, see [llms.txt](https://docs.percona.com/percona-xtrabackup/9.7/llms.txt).

# Prepare a full backup

## Version changes

Percona XtraBackup 9.7.2-2 renames the `--apply-log-only` option to [`--apply-redo-only`](https://docs.percona.com/percona-xtrabackup/9.7/xtrabackup-option-reference.md#apply-redo-only). Percona XtraBackup still accepts `--apply-log-only` but prints a deprecation warning. A future Long-Term Support (LTS) release will remove `--apply-log-only`, so update your scripts to use `--apply-redo-only`. If you pass both options in the same command, Percona XtraBackup reports an error and does not start.

## Command reference

Quick syntax for preparing a full backup:

```bash
xtrabackup --prepare --target-dir=<path> [--apply-redo-only] [--parallel=<N>]
```

| Flag                  | Required | Description                                                                                                                                                                                |
| --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--prepare`           | Yes      | Runs xtrabackup in prepare mode (applies redo/undo logs for a consistent snapshot).                                                                                                        |
| `--target-dir=<path>` | Yes      | Directory containing the backup to prepare.                                                                                                                                                |
| `--apply-redo-only`   | No       | Applies the redo log without rolling back uncommitted transactions. Use the option when the backup is the base for incremental backups. Replaces the deprecated `--apply-log-only` option. |
| `--parallel=<N>`      | No       | Use N threads to speed up prepare (for example, `--parallel=4`).                                                                                                                           |

Example (full backup, then restore):

```bash
xtrabackup --prepare --target-dir=/data/backups/
```

Example (base for incremental backups):

```bash
xtrabackup --prepare --apply-redo-only --target-dir=/data/backups/
```

______________________________________________________________________

After creating a backup with the `--backup` option, you need to prepare the backup and then [restore](https://docs.percona.com/percona-xtrabackup/9.7/restore-a-backup.md) it. Data files are not point-in-time consistent until they are prepared, because they were copied at different times as the program ran, and they might have been changed while this was happening.

If you try to start InnoDB with these data files, it will detect corruption and stop working to avoid running on damaged data. The `--prepare` step makes the files perfectly consistent at a single instant in time, so you can run InnoDB on them.

You can run the prepare operation on any machine; it does not need to be on the originating server or the server to which you intend to restore. You can copy the backup to a utility server and prepare it there.

Note that Percona XtraBackup 9.7 can only prepare backups of MySQL 9.7 and Percona Server for MySQL 9.7 databases. Releases prior to 9.7 are not supported.

During the prepare operation, xtrabackup boots up a kind of modified embedded InnoDB (the libraries xtrabackup was linked against). The modifications are necessary to disable InnoDB standard safety checks, such as complaining about the log file not being the right size. This warning is not appropriate for working with backups. These modifications are only for the xtrabackup binary; you do not need a modified InnoDB to use xtrabackup for your backups.

The prepare step uses this “embedded InnoDB” to perform crash recovery on the copied data files, using the copied log file. The `prepare` step is very simple to use: you simply run xtrabackup with the `--prepare` option and tell it which directory to prepare, for example, to prepare the previously taken backup run:

```shell
xtrabackup --prepare --target-dir=/data/backups/
```

When this finishes, you should see an `InnoDB shutdown` with a message such as the following, where again the value of LSN will depend on your system:

Expected output

```text
...
2026-10-13T17:24:08.568744-00:00 0 [Note] [MY-012980] [InnoDB] Shutdown completed; log sequence number 36618262
2026-10-13T17:24:08.576103-00:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!
```

All following prepares will not change the already prepared data files, you’ll see that output says:

Expected output

```text
xtrabackup: This target seems to be already prepared.
xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'.
```

It is not recommended to interrupt xtrabackup process while preparing backup because it may cause data files corruption and backup will become unusable. Backup validity is not guaranteed if prepare process was interrupted.

Note

If you plan to apply incremental backups to the backup, use the `--apply-redo-only` option when you prepare the backup. Without the option, you cannot apply incremental backups. For details, see [Prepare an incremental backup](https://docs.percona.com/percona-xtrabackup/9.7/prepare-incremental-backup.md).

## Next step

[Restore the backup](https://docs.percona.com/percona-xtrabackup/9.7/restore-a-backup.md)
