Repository Presets
MariaDB & MySQL Consistent Hot-Backup Borgmatic Hook
Capture InnoDB tables cleanly without locking production reads using Borgmatic mariadb_databases single-transaction streaming.
Zero Table Locks · --single-transaction · InnoDB Safe
Never Mix Raw /var/lib/mysql Files with Live Writes
Copying raw MariaDB data files without freezing tables or LVM snapshots produces torn pages that fail crash recovery. Exclude /var/lib/mysql/* and let Borgmatic stream consistent SQL dumps through mariadb_databases.
Restoring Individual Databases Without Full Extract
Because Borgmatic indexes streamed database dumps as named virtual paths inside each archive, you can restore a single database directly via borgmatic restore --database target_db.
Measured Thresholds & Borgmatic Configuration
| MariaDB Setting | Production Value | Reason |
|---|---|---|
| mariadb_databases | name: all / username: backup_ro | Least-privilege read-only backup user with LOCK TABLES + PROCESS |
| Dump Options | --single-transaction --quick | Consistent MVCC snapshot without stalling InnoDB write queries |
| Exclude Raw Datadir | exclude_patterns: /var/lib/mysql/* | Prevents backing up torn raw InnoDB ibdata pages mid-flush |
| Checkpoint Interval | checkpoint_interval: 900 | Saves completed database chunks every 15 minutes over WAN |