Retention plans are an operational must: they definitively specify which backups are retained for how long, where and in what form. The focus keyword „Retention plans“ appears right at the start because proper planning of these retention rules has immediate impact on storage budget, RESTore capability and compliance. This article is aimed at administrators, system engineers, operators and technical service providers and explains GFS rotation, incremental intervals, MariaDB specifics as well as practical verification and fallback strategies.
Why a retention plan is more than „deleting older backups“
A retention plan is a binding operational rule based on RTO (Recovery Time Objective) and RPO (Recovery Point Objective). RTO describes the maximum tolerable downtime, RPO the maximum acceptable data-loss window. Both metrics drive the choice of full and incremental backups, retention durations, verification intervals and reporting routines.
For operations this means: binding storage planning, automated deletion runs with dry-run mode, documented responsibilities and tested fallback paths if deletions or RESTore tests fail. Without these operational agreements, undetected deletion errors, compliance gaps or unforeseen RESTore durations may occur.
Operationalizing retention plans: roles, processes, governance
A retention plan is only reliable if not just technology but also processes and responsibilities are defined. Operationalizing means concretely:
- Define responsibilities: who authorizes retention exceptions? Who validates RESTore tests?
- Change management: every change to the retention plan goes through review, staging test and approval (change ticket).
- Audit trail: every deletion, quarantine move or RESTore is logged and provable.
Why this matters: technology alone can execute incorrect deletion rules without human oversight. Governance prevents formal retention periods from being technically undercut.
GFS strategy (Grandfather‑Father‑Son) in practice
GFS is an established rotation scheme with yearly, monthly and weekly levels. Goal: long-term archival while maintaining fast access for short-term RESTores. The tiers (Grandfather=Annual, Father=Monthly, Son=Weekly/Daily) are ordered by access frequency and retention duration.
Practical guidance:
- Use clear naming conventions (e.g. /backup/{env}/{year}/{month}/{week}) and metadata files containing UUID, creation time, checksums and tool version.
- Plan capacity with conservative growth assumptions and reserve pools.
- Document the RESTore path per GFS tier: number of steps, expected duration and dependencies (e.g. binlogs for recovery).
Incremental intervals: chain length, RPO and integrity
Incremental backups save storage but increase RESTore complexity. The chain length (number of consecutive incremental steps) is a central parameter: the longer the chain, the more susceptible it is to faulty intermediate steps.
Recommendation: limit chain lengths (e.g. maximum 7–14 steps) and force a full backup afterwards. Complement this with immediate integrity checks (checksums, xtrabackup_info verification) after each backup. An overly long chain raises the probability that a single error renders the entire chain unusable.
Plan intervals concretely
A robust example for moderate change rates:
- Daily incremental backups, retention 14 days (fast RESTore for recent data).
- Weekly full backup or differential backup, retention 4 weeks.
- Monthly full backup (Father), retention 12 months.
- Annual full backup (Grandfather), retention 7–10 years for legally relevant data.
MariaDB‑specifics: binlogs, XtraBackup, LVM snapshots and PITR
For MariaDB, binlogs (Binary Logs) are central: they record all change commands and enable Point‑In‑Time Recovery (PITR) as well as replication. Percona XtraBackup is a common tool for hot backups of InnoDB‑based databases. LVM snapshots can serve as the basis for consistent backups on large filesystems because they briefly capture a consistent filesystem state.
Binlog management: practical commands, configuration and pitfalls
Important SQL checks for binlogs:
# Liste der vorhandenen Binlog‑Dateien und Größen
mysql -e "SHOW BINARY LOGS;"
# Aktuelle Position und Dateiname
mysql -e "SHOW MASTER STATUS;"
# Prüfen, wie weit Replikate sind
mysql -e "SHOW SLAVE STATUSG"Configuration recommendation in my.cnf (example):
# /etc/my.cnf.d/backup.cnf
[mysqld]
log_bin = /var/lib/mysql/mysql-bin
binlog_format = ROW
server_id = 42
# Automatisches Ablaufen von Binlogs nach 30 Tagen
binlog_expire_logs_seconds = 2592000When this fails: an aggressive binlog_expire setting can make PITR impossible if you need to RESTore further back than configured. Likewise, asynchronous replication slaves with large lag can cause required binlogs to already have been removed. Coordination with the replication architecture and RESTore scenarios is therefore mandatory.
XtraBackup: process, checks and common errors
XtraBackup produces an incremental/combined backup including metadata. Crucial checks are:
- Verify metadata: xtrabackup_info and xtrabackup_checkpoints must exist and be logically consistent.
- Verify integrity: xtrabackup –check and an isolated test RESTore are standard.
- Verify transport layer: copy errors (e.g. rsync, scp, object upload) lead to inconsistent backups.
Example: create a full backup and extend it incrementally (simplified):
# Vollbackup
xtrabackup --backup --target-dir=/backup/full/2026-07-01 --user=backup --password=secret
# Inkrementelles Backup
xtrabackup --backup --target-dir=/backup/inc/2026-07-02 --incremental-basedir=/backup/full/2026-07-01 --user=backup --password=secretPrepare and RESTore (simplified steps):
# Prepare (apply logs)
xtrabackup --prepare --target-dir=/backup/full/2026-07-01
# Kopieren/RESTore in Data‑Directory (in Wartungsfenster)
systemctl stop mariadb
rsync -a /backup/full/2026-07-01/ /var/lib/mysql/
chown -R mysql:mysql /var/lib/mysql
systemctl start mariadbIf prepare fails (e.g. due to missing incremental parts), then a recovery is only possible up to the last intact point. Therefore schedule regular full backups and additional test RESTores in an isolated environment.
Binlog replay with mysqlbinlog
For PITR you replay binlogs up to the desired point in time. Important note: mysqlbinlog generates SQL statements that you should verify in a test environment.
# Create binlog up to a point in time
mysqlbinlog --stop-datetime="2026-07-02 14:30:00" /var/lib/mysql/mysql-bin.000123 | mysql -u root -p
# Alternatively: from multiple files
mysqlbinlog --stop-datetime="2026-07-02 14:30:00" /var/lib/mysql/mysql-bin.00012* | mysql -u root -pAutomatically applying binlogs without inspection is dangerous: large transactions or DDL can alter production state. Run mysqlbinlog preferably against an isolated database instance first and check size and expected runtime.
Automation: Scheduler, validation and Dry‑Run
Automated jobs should be idempotent, auditable and secure. Cron is widespread; systemd timers provide better visibility and RESTart policy. An example systemd timer and service for daily validation:
# /etc/systemd/system/backup-validate.service
[Unit]
Description=Backup Validation Service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/validate-backup.sh
# /etc/systemd/system/backup-validate.timer
[Unit]
Description=Run backup validation daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.targetThe validation script should define exit codes (0=OK, 1=Warning, 2=Error) and write structured logs in JSON so monitoring systems (e.g. Prometheus Pushgateway, ELK) can generate alerts.
Object storage and lifecycle policies (S3-compatible)
Object storage offers cost advantages for long-term retention. Use lifecycle rules to move objects to Glacier-like tiers. A lifecycle example (JSON) for S3-compatible bucket rules:
{
"Rules": [
{
"ID": "move-to-cold",
"Filter": {"Prefix": "backup/old/"},
"Status": "Enabled",
"Transitions": [{"Days": 30, "StorageClass": "GLACIER"}],
"Expiration": {"Days": 3650}
}
]
}Important: enable Object Lock (WORM) only for data that must be legally immutable. Lifecycle rules must not automatically delete legally relevant copies without human approval.
Risk considerations: ransomware, data corruption and operator error
Retention plans must anticipate risk scenarios. Ransomware often attempts to encrypt or delete all copies. Measures:
- Immutable storage or Object Lock for critical backups.
- Separate admin accounts for backup systems, MFA, and RESTricted networks for backup access.
- Quarantine buckets and delayed deletion (e.g. 7–14 days) to catch accidental or malicious deletions.
For data corruption, checksums, immediate alerting and the ability to access older GFS tiers help.
Rollback strategy and recovery runbook
A robust runbook lists concrete, tested steps for a RESTore and any possible rollback. Key elements:
- Initial assessment: affected systems, RTO/RPO, affected data classes.
- Selection of the recovery source: full backup, replica or offsite copy.
- Test RESTore in isolation and verification of integrity (checksums, application smoke tests).
- Production RESTore during a maintenance window with a communications plan (stakeholder notifications, user information).
- Post-RESTore audit: comparison of datasets, consistency checks and lessons-learned documentation.
Define clear decision levels: Who decides on failed RESTores? When is an alternative source (e.g. a replica) used?
Tests and Audit: How often and with which acceptance criteria?
Test frequency: quick RESTore samples (weekly), full RESTore runs (monthly) and disaster simulations (annually). Acceptance criteria must be measurable, e.g. „full RESTore of a DB schema in < 4 hours“ or „PITR with a maximum 15-minute RPO“. Document deviations and root causes.
Typical pitfalls and how to avoid them
- Missing metadata: Store xtrabackup_info and checksums together with the data.
- Automatic deletion rules without a dry run: always introduce a dry run and a quarantine phase.
- Untested lifecycle policies: test migrations in a staging-bucket environment.
- Binlog deletion without reconciliation with replicas: check replication lag and SLAs before discarding binlogs.
- No capacity buffer: plan for peaks, not just averages.
Checklist for implementing a retention plan (practical)
- Inventory: Which data classes are relevant and which legal retention periods apply?
- Classify: Define and document RTO/RPO per data class.
- Design: Define GFS schema, incremental intervals, storage tiers, Object Lock and quarantine.
- Automation: Implement idempotent scripts, dry-run, systemd timers, structured logs and alerts.
- Validation: Introduce regular RESTore tests, integrity checks and reporting.
- Documentation: Retention policy as a binding document including roles and an audit trail.
- Review: Periodic review (e.g. semi-annually) and updates when legal requirements change.
Conclusion: Building operational robustness
Retention plans link compliance, cost-effectiveness and operational security. Practically this means: GFS for long-term needs, limited incremental chains for efficiency, automated integrity checks and documented RESTore samples for reliability. For MariaDB, binlog management, XtraBackup chain integrity and regular PITR tests are additional key topics. Test changes in staging, keep deletion operations reversible until final verification, and operate monitoring with clear alerts.
If you follow these steps, your retention plan will not be a one-time document but a living operational process: automated, verifiable and legally compliant. This protects your data while ensuring economical storage.
Further resources
Internal links to in-depth articles (e.g. backup tests with Ansible, ransomware resilience, MariaDB PITR) should be embedded here so that runbooks, playbooks and audit checklists are directly accessible.
Retention management: metadata, Legal Hold and monitoring
An often undeRESTimated part of retention is the metadata catalog: it documents which backup batches belong to which data classes, legal retention periods, audit results and encryption keys. Without a reliable catalog, deletion automation becomes dangerous — because the system cannot reliably distinguish which copy is still under Legal Hold or relevant to an ongoing investigation.
Architectural note: separate the metadata repository from the object stores. Use a small, highly available database (e.g. a single schema-secured MariaDB schema or a document-oriented store) with versioned entries. Each backup batch gets a UUID, status (available, quarantined, deleting, deleted), owner and legal_hold_flag. This info drives the deletion pipeline.
Two-phase deletion reduces risk: 1) set a tombstone + quarantine (e.g. 7–14 days), 2) permanently delete after a successful reconcile and audit. This allows Dry‑Run, manual intervention and automated rollbacks in case of errors.
Operational monitoring should provide measurable metrics:
- Percentage retention compliance (target vs. actual according to retention periods)
- Count of tombstones and age of tombstones
- Deletion errors per day and time to manual resolution
- Discrepancy between metadata and actual storage (reconcile rate)
Example query (metadata table backups):
-- Backups, die laut Policy bereits gelöscht sein sollten
SELECT id, uuid, created_at, retention_until, status
FROM backups
WHERE retention_until < NOW() AND status != 'deleted';
-- Tombstones älter als 14 Tage
SELECT COUNT(*) FROM backups WHERE status = 'quarantined' AND updated_at < NOW() - INTERVAL 14 DAY;Other points: manage key management (KMS) for encrypted backups separately and under RBAC; introduce version numbers for backup tools and perform compatibility checks during migrations. Finally: integrate reconcile jobs into your incident runbook — automatic notification plus an escalating pager procedure when the reconcile rate falls below a defined threshold.
MariaDB backups and binlog retention are also important for this topic. This article places these aspects into context and shows what matters in day-to-day operations.