In heterogeneous infrastructures, two worlds often collide in day-to-day backup and DR operations (Disaster Recovery, i.e. recovery after a major outage): block-level replication and file-level backup. Both sound like „data is safe“ — but they solve different problems. Anyone who evaluates block-level replication vs. file-level backup properly avoids common misconceptions such as „replication is a backup“ or „file backup is sufficient for databases.“ This article provides a decision aid for administrators, system engineers and IT service providers: with prerequisites, risks, validation steps, implementation and a realistic fallback strategy — including MariaDB-specific pitfalls.
Separate the terms clearly: what exactly is being protected?
Block-level replication replicates storage blocks (e.g. at SAN, iSCSI or storage-array level) from a source system to a target. It operates below the file system: the replication mechanism does not care whether a block belongs to a VM disk, a MariaDB data file or a log file. Advantage: very fast mirroring of entire volumes, often with short RPOs (Recovery Point Objective = maximum data loss measured in time) and fast RTOs (Recovery Time Objective = time until operations resume).
File-level backup protects files and directory structures (e.g. via agents, SMB/NFS, rsync or backup software), often with versioning and retention. Advantage: targeted recovery of individual files, better control over versions and often better integration into immutable/air-gap concepts (protection against post-event tampering).
Important: both approaches can use snapshots. A snapshot is a point-in-time image (usually copy-on-write) of a volume or file system. Snapshots are not a substitute for backups if they reside on the same storage or can be compromised by the same attack.
Why replication is not automatically a backup
The core question is not whether data exists „twice“ somewhere, but whether you can reliably revert to a defined point in time. Replication also replicates errors: accidental deletion, encryption by ransomware, logical data corruption or a faulty deployment are reliably and quickly propagated to the target. That is useful for high availability (HA), but often fatal for recovery.
A file-level backup with versions can often address precisely this: you can roll back to before the damage, even if the damage was „cleanly“ replicated. The price: backups are often slower when RESToring complete systems, and consistency for databases is not guaranteed without an appropriate mechanism.
Decision by target scenario: HA, DR, archive, compliance
In practice, a simple categorization helps before discussing tools:
- High Availability (HA): The objective is minimal downtime. Block-level replication or cluster mechanisms are effective here because they enable rapid failover.
- Disaster Recovery (DR): The objective is RESTart after site/storage failure. Replication makes sense, but only when a “clean” consistency point and a rollback option exist.
- Backup/RESTore: The objective is recovery even after logical errors or attacks. File-level backups, object repositories, immutable storage, and offsite copies are central here.
- Archive/Retention/Compliance: The objective is long-term retention, traceability, and retrievability. File-level backups with index/metadata and separate retention pools are usually more suitable.
In heterogeneous environments (Windows/Linux, VMs/Bare Metal, NAS/SAN, On-Prem/Cloud, different application stacks) a combination is almost always sensible: replication for quick recoveries of specific systems plus backup for versioned, auditable RESTore paths.
Block-level replication in operation: prerequisites and pitfalls
Block-level replication works well when you make infrastructure and operational assumptions explicit. Typical prerequisites:
- Identity & consistency: The target must be able to take over the replicated volumes in a consistent state. Without application quiesce (a brief “freezing” of write access) you risk inconsistent filesystems or databases.
- Network & latency: Replication is I/O-driven. Bandwidth, RTT (Round-Trip-Time) and packet loss determine RPO and stability. Asynchronous replication tolerates latency; synchronous replication is sensitive and can increase write latencies.
- Split-brain protection: On failures both sides must not be “active” for writing. Split-brain (two active primaries) almost always leads to data loss or complex merge scenarios.
- Orchestration: Failover is not just “mount the volume”. DNS, IPs, load balancers, secrets, certificates, application starts, dependencies (e.g. AD, NTP, monitoring) must be present as a runbook or automation.
Typical pitfalls in heterogeneous infrastructure:
- Order errors: VM datastores are switched over, but the database and application servers start in the wrong order. Result: long recovery times, inconsistent states.
- Hidden dependencies: A license server, an internal PKI-Endpoint or a central syslog collector is missing in the DR segment — and applications hang on startup.
- Snapshot chains: Storage snapshots in combination with replication can lead to long “chains”; this complicates rollbacks and increases I/O overhead.
- Replication without retention: There is no „back to yesterday 02:00“. Then replication is only a faster way into the wrong state.
Preflight checks for replication
Before you sell replication as a DR path (internally or to the customer), you should check at least the following points:
- Consistency point defined: How do you ensure application consistency (e.g. DB flush, filesystem freeze, VM snapshot with quiesce)?
- Failover runbook available: Who does what, in which order, with which checks?
- Failback planned: How are data returned without split-brain or long downtime?
- Isolation capability: Can you stop replication during an incident to preserve a „clean“ target?
- Test window: Are there regular drills (at least partial), not just on paper?
File-level backup in production: strengths, limits, typical mistakes
File-level backup is often the most realistic base layer in heterogeneous environments because it works close to the platform: Windows-servers, Linux, NAS shares, application data, configuration directories. The main advantages are versioning, selective RESTore and retention.
The most common operational errors are less about tools than about processes:
- Open files and locks: Without VSS (Volume Shadow Copy Service, Windows snapshot service) or comparable mechanisms, files are backed up „while being written“. That can be unusable.
- ACLs and metadata: NTFS ACLs, POSIX permissions, xattrs (extended attributes) or SMB ownership are lost if the backup is not metadata-capable. The RESTore then „looks correct“, but permissions are broken.
- RESTore domains too large: A single job backs up „everything“. In a real incident the RESTore takes too long because prioritization and parallelization are missing.
- No RESTore test: Backups are considered „green“, but no one has ever verified whether a consistent RESTore works.
Rule of thumb: Backups must reflect the RESTore target
Those who need fast system recovery should combine file-level backups with image/VM backups. Those who need individual files quickly (e.g. accidentally deleted contract PDFs) need versioning and search/index. Those who fear ransomware need immutable and offsite copies as well as separate credentials.
MariaDB in focus: why database consistency can be the deciding factor
In the MariaDB category, the question often comes down to: “How do I RESTore a consistent state — and how far back in time can I go?” MariaDB is MySQL-compatible and typically uses InnoDB (storage engine with a transaction log). For databases, a file copy without coordinated steps is risky: otherwise you back up data files and logs in an intermediate state.
Block-level replication can work for MariaDB if you create application-consistent snapshots (i.e., briefly pause/flush write operations under controlled conditions) and replicate the snapshot. File-level backup can work if it is database-aware (e.g., logical dumps for small DBs or physical backups using an appropriate tool).
Typical MariaDB pitfalls with block-level replication
- Crash-consistent is not the same as application-consistent: A crash-consistent snapshot is equivalent to a “power outage”. InnoDB can recover many things, but not every scenario is clean, and recovery times are hard to predict.
- Binary Logs (Binlog): For Point-in-Time Recovery (PITR) you need binlogs. Replication alone does not provide a “back to 10:17” if, by 10:20, the data has already been encrypted and replicated.
- Version/Migration: A MariaDB upgrade or a schema migration that is logically wrong will be replicated. Without a version-aware backup there is no clean rollback.
Typical MariaDB pitfalls with file-level backups
- “Simply copying /var/lib/mysql”: That is often inconsistent in a running system. Even if it sometimes “works”, it is not a reliable procedure.
- Missing binlogs: Without binlogs you are limited to RESTore-to-snapshot. PITR is not available and RPO becomes coarser.
- Missing RESTore test: A backup is only good when a RESTore on a test instance — including startup, checks and an application query — reproducibly succeeds.
Decision matrix: When to use which method (or both)?
A pragmatic matrix helps for daily operations. Not theory, but operational logic:
- Very small RTO (minutes): Block-level replication or VM replication + orchestration. File-level alone is usually too slow for a complete system recovery.
- Very small RPO (seconds to a few minutes): Replication is powerful, but only sensible with an additional “time buffer” (snapshot retention) or a separate backup; otherwise you replicate the damage.
- Many small RESTore cases (user files): File-level backup with versioning, an index and correct permissions RESTore (ACLs/xattrs).
- High ransomware threat: File-level/repository backups with immutable storage, separate accounts and offline/offsite copies. Replication can complement, but it is not protection if it is allowed to be encrypted along with the primary data.
- Heterogeneous, many platforms: File-level as a base layer; replication targeted at a few critical workloads (e.g., central database VMs) and only with a test and rollback concept.
- MariaDB with a PITR requirement: Physical backup + binlogs (PITR) or another transaction-log-based method. Replication can provide the base state, but does not replace time-travel.
Implementation in practice: checkpoints you should document
Regardless of the product, the following artifacts are critical. If they are missing, the solution is often not reproducible in an emergency:
- System inventory: Which Volumes/Shares contain which data (application, DB, logs, uploads, config)?
- Protection class per workload: Target RPO/RTO, retention, encryption, offsite.
- Dependencies: DNS, identity (AD/LDAP), NTP, certificates, secrets, monitoring, central storage-/network paths.
- Runbooks: Failover, RESTore, failback, Stop-the-Bleed (pause replication), communication and approval points.
Checklist: Minimal RESTore test (technically robust)
A RESTore test does not have to be a full exercise, but it needs clear success criteria:
- Integrity: Checksums/hash or spot file comparisons (for file-level).
- Boot/Start: VM/Host starts, services run, logs are plausible.
- Application check: For MariaDB, e.g. connection establishment, simple queries, table consistency.
- Time: Measured RESTore time (real, not estimated).
- Documentation: What was different than expected? Which dependency was missing?
MariaDB-How-to: Backup + Binlog-PITR as a reliable base layer
For MariaDB a proven approach is: regular physical full backups plus continuous/regular backup of the binlogs. This allows you to return to a full-backup point and then fast-forward to just before the failure (PITR). In practice the tool Percona XtraBackup is often used (physical hot backup for InnoDB). This is not “framework internals”, but operational craft: consistent backup, predictable RESTore steps.
Example workflow sketch (Linux, generic; adjust paths/users). This intentionally shows the structure – in production you must store credentials securely (e.g. in a root-only config, Vault, or Backup-Agent-Secrets) and set permissions correctly.
1) Full backup with XtraBackup (physical, consistent)
#!/usr/bin/env bash
set -euo pipefail
BACKUP_BASE="/backup/mariadb"
TS="$(date +%F_%H%M%S)"
TARGET="$BACKUP_BASE/full_$TS"
mkdir -p "$TARGET"
# Hinweis: Zugangsdaten nicht im Klartext im Skript lassen.
# Nutzen Sie z. B. eine geschützte my.cnf unter /root/.my.cnf
xtrabackup --backup --target-dir="$TARGET"
# Prepare-Schritt macht das Backup RESTorefähig (Redo-Logs anwenden)
xtrabackup --prepare --target-dir="$TARGET"
# Optional: Integritätsmarker
echo "$TS" > "$TARGET/backup.completed"2) Binlogs sichern (Grundlage für Point-in-Time-Recovery)
For PITR to work, binlogs must be enabled and regularly copied to a separate, versioned destination. Binlogs are the continuous change logs (transaction/statement log) that let you replay changes after a full backup.
#!/usr/bin/env bash
set -euo pipefail
BINLOG_DIR="/var/lib/mysql"
ARCHIVE_DIR="/backup/mariadb/binlogs"
mkdir -p "$ARCHIVE_DIR"
# Alle aktuellen Binlogs auflisten
mysql -N -e "SHOW BINARY LOGS;" | awk '{print $1}' | while read -r f; do
src="$BINLOG_DIR/$f"
if [[ -f "$src" ]]; then
# Kopie mit Metadaten, aber ohne Überschreiben (Versionierung im Repo wäre noch besser)
cp -n "$src" "$ARCHIVE_DIR/" || true
fi
done
# Optional: Binlog-Rotation anstoßen (damit ein „abgeschlossener“ Log zum Archiv wandert)
mysql -e "FLUSH BINARY LOGS;"3) RESTore + PITR (Konzept und Prüfschritte)
A PITR is only as good as your test. During a RESTore you first apply the full backup, start MariaDB in a controlled environment and then replay binlogs up to a defined point in time or up to a specific position. Typical verification steps: start without crash-recovery loops, plausibility checks in the application data, and reconciliation of the expected last transaction.
Important for the decision „Replication vs. Backup“: you only get this time-travel capability with pure block replication if, on the replication side, you also have snapshot versioning/retention and can isolate quickly enough during the incident. In practice, a separate backup repository is often the more robust base layer.
Ransomware reality: What goes wrong in both models
Ransomware is no longer a special case but a design criterion. For both approaches the following applies:
- Replication: Encrypted data replicates quickly. Without delayed replication, snapshot retention at the target and a „stop“ process during the incident, the DR target can become unusable.
- File-level backup: Backups can be deleted or encrypted if attackers obtain backup credentials or access to the repository. Immutable storage (WORM/immutability), separate accounts and offline/offsite copies are essential.
A practical pattern is: replication for availability, backup for recoverability. Add an incident runbook „Stop-the-bleed“: stop replication, pause backup jobs, rotate credentials, create a forensic window, then RESTore selectively from a clean point in time.
Fallback strategy: What to do if the planned path fails?
Fallback strategy means you plan for the moment when a RESTore fails or a failover reveals unexpected dependencies. A resilient plan has stages:
- Stage 1: RESTart on the replicated state (fast, but the risk of logical errors remains).
- Stage 2: Rollback to target snapshot (if retention exists and the snapshot predates the incident).
- Stage 3: RESTore from backup repository (versioned/immutable, independent of the replicated storage).
- Stage 4: Partial RESTore (e.g. MariaDB from PITR, files from versions, application servers rebuilt from templates/IaC).
To keep this from remaining theoretical, define in advance: who decides the stage, which data has priority (e.g. MariaDB first, then uploads, then reporting), and what maximum downtime is acceptable. Especially in mixed environments an „all-or-nothing“ RESTore is rarely optimal.
Recommendation for heterogeneous infrastructure: A pragmatic target architecture
If you are RESTructuring now or consolidating an existing setup, this target architecture is operationally manageable in practice:
- Base layer: File-level/repository backup with versioning, clear retention and an offsite copy (3-2-1 as a guideline: 3 copies, 2 media, 1 offsite).
- For critical systems: Block-level replication (or VM replication) with a defined consistency method and snapshot retention at the target.
- For MariaDB: Physical full backup + binlog archiving for PITR, plus regular RESTore tests on a test instance.
- Operations: Monitoring/alerting on job success, duration, data volume, repository fill level and RESTore tests – not just „job green“.
This reduces pressure in DR tests: you do not have to rebuild every system completely from backup if replication enables quick continuation of operations. At the same time, you remain able to revert to a clean point in time if the logical damage has already been replicated.
Conclusion: Block-level replication vs. file-level backup is not a matter of faith
The decision block-level replication vs. file-level backup is best made in heterogeneous infrastructure based on operational objectives: replication is a powerful lever for short RTOs and rapid failover, but without versioning and isolation capability you also replicate the damage. File-level backups provide versions, selective RESTores and better retention – but fail when consistency (particularly for MariaDB) and RESTore testing are not taken seriously.
If you take only one practical guideline away: replication for availability, backups for recoverability – and test both regularly, with a clear “Stop-the-bleed” runbook and a tiered fallback strategy.
Immutable backup and ransomware protection are also important for this topic. The article puts these aspects into context and shows what matters in day-to-day operations.