BlogMariaDB

MariaDB Backup Restore Time: How to Test a Restore

Scott Sternloff

By Scott Sternloff, Senior Enterprise Architect

LinkedIn · Updated · 4 min read

MariaDB Backup Restore Time: How to Test a Restore
On this page

Short answer

A MariaDB backup only counts once you have restored it and timed the result. Restore a mariadb-backup copy to a scratch server, time three steps separately (prepare, copy-back, binary log replay for point-in-time recovery) and record the sizes next to the durations. The total is your real recovery time, and it is rarely the backup time.

A MariaDB backup only counts once you have restored it and timed the result. Restore a mariadb-backup copy onto a scratch server, time three steps separately (prepare, copy-back, and binary log replay for point-in-time recovery) and record sizes next to durations. The total is your real recovery time, and it is rarely the backup time. Commands and behavior are from the MariaDB documentation, read 3 December 2026.

If nobody has done this yet, our mariadb consulting team can run the rehearsal with yours.

What do you need before you start a restore test?

A scratch server with the same MariaDB version, similar storage and enough free space for the backup plus the restored datadir. Keep the production server out of it. Also pull the files you will need: the backup directory, the binary logs written since the backup and the record of when the backup ran. If the binary log is off (log_bin is off unless you enable it), point-in-time recovery is not possible at all, and binlog_expire_logs_seconds defaults to 0, which means no expiry, so check what your own setting is.

How do you restore and time a mariadb-backup copy?

  1. Prepare. Run mariadb-backup --prepare --target-dir=/backup/full. This step is required: without it InnoDB notices inconsistencies and crashes. --use-memory sets the buffer pool size used during prepare, and the page states no default.
  2. Stop the server and empty the datadir. The restore target must be empty.
  3. Copy back. mariadb-backup --copy-back --target-dir=/backup/full. --move-back moves files and loses the originals, so avoid it for a rehearsal. --parallel sets the number of transfer threads and defaults to 1.
  4. Fix ownership with chown -R mysql:mysql on the datadir.
  5. Start the server and run a few real queries.

Time each step with time or timestamps. The docs say backup time depends on database size and give no figures, so your own numbers are the only ones that matter.

Record thisWhy
Backup size and durationSets the backup window
Prepare duration and --use-memoryOften the surprise on large datasets
Copy-back duration and --parallelStorage speed shows up here
Binlog volume replayed and durationDecides point-in-time recovery length
Time from decision to application connectedThe number the business cares about

How does point-in-time recovery work?

The backup records its binary log position. In xtrabackup_binlog_info you will find the binlog file, position and gtid_current_pos, for example mariadb-bin.000096 568 0-1-2. From MariaDB 11.1 the files are named mariadb_backup_binlog_info and mariadb_backup_info. The values are reliable only if --no-lock was not used.

Restore into a new datadir, then replay the logs: mariadb-binlog --start-position=<position> --stop-datetime="2026-12-03 09:59:00" <binlog files> | mariadb. --start-position defaults to 4, and from 10.8 it also accepts a GTID list. Start and stop datetimes use local time and begin or end at the first event at or after the value. The MariaDB page notes that a restore does not restore the binary log, so keep copies of it somewhere else.

What should you write down?

Record versions, the exact commands, every duration and the result of a row count or checksum on a few key tables. Re-run the test after a major version change or a storage change. Also note what the test did not cover: partial backups made with --databases or --tables, compressed or streamed backups (--compress supports only quicklz and is deprecated, and --stream=xbstream is the only stream format) and anything outside the database, such as users, configuration files and certificates.

See our backup and point-in-time recovery rehearsal use case for what a full rehearsal covers.

How do restore times map to RPO and RTO?

Two figures tell you whether a backup design holds up. The recovery point objective (RPO) is how much data you can afford to lose, and the recovery time objective (RTO) is how long you can afford to be down. Your restore test gives the RTO: the measured prepare, copy-back and binary log replay, plus the time to start the server and reconnect the application. Your binary log setup gives the RPO: with binary logs kept and copied off the server, recovery can stop close to the failure, and without them you can only return to the moment of the last backup.

If the measured time is longer than the business accepts, the fix is usually one of these:

  • faster storage on the restore target, or a higher --parallel value for the copy-back;
  • more memory for the prepare step through --use-memory;
  • backups taken more often, so less binary log has to be replayed;
  • a replica or standby that can take over while the restore runs elsewhere.

Repeat the test on a schedule, because data grows and the restore time grows with it.

Sources

Frequently Asked Questions

How long does a MariaDB restore take?

The MariaDB documentation gives no figure, because it depends on data size, storage speed and how much binary log you replay. Time a real restore on comparable hardware and write the number down.

What does mariadb-backup --prepare do?

It makes the copied files consistent so the server can start from them. Without it, InnoDB notices the inconsistencies and crashes. Prepare is a separate step with its own duration, so time it on its own.

How do I restore MariaDB to a point in time?

Restore the prepared backup, then replay binary logs with mariadb-binlog, starting from the position recorded in the backup and stopping at the time or position you want. A restore does not restore the binary log itself.

Scott Sternloff

Author

Scott SternloffSenior Enterprise Architect

Senior Enterprise Architect at AceMQ. Writes the technical coverage here: RabbitMQ, Kafka and Redis architecture, clustering and migrations.

Talk to an engineer

Need a hand with MariaDB?

Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

Free Consultation

Get Expert Eyes on Your MariaDB Environment

Whether you're troubleshooting a production incident, planning a migration, or want a second opinion on your architecture — our team is ready. No pitch, just answers.

Email Us