Backup and Disaster Recovery Questions
Keeping data durable and recoverable when systems fail: backup design (full, incremental, differential, and snapshot strategies; point-in-time recovery), backup verification and restore testing, retention and archival policy (including compliance retention and legal holds), encryption and key management for backups, and disaster-recovery planning measured against recovery-time and recovery-point objectives (RTO/RPO). Tests whether a candidate can design a backup strategy that actually restores, choose the right retention tier for a business's downtime and data-loss tolerance, and operate backup systems safely under failure, compliance, and ransomware threats. Distinct from code-level fault-tolerance patterns (circuit breakers, retries, bulkheads) and multi-region failover architecture, which belong to high-availability-and-disaster-recovery.
Design a disaster recovery plan for a stateful Postgres deployment running in the cloud (RDS or self-managed on EBS). Include target RPO and RTO, backup cadence and retention, cross-region replication options, failover procedures, validation and automated DR testing, and how you'd restore production traffic in a controlled way.
Sample Answer
Direct answer
The design splits into two layers that solve different problems: continuous replication (streaming or WAL shipping, WAL being the write-ahead log, an append-only record of every change Postgres makes before applying it) gets you a warm standby you can promote quickly, meeting RTO; and independent base backups plus archived WAL get you point-in-time recovery (PITR) and protection against the kind of failure replication doesn't cover, like a bad DROP TABLE that a synchronous or asynchronous standby would faithfully replicate right along with the primary. For illustration I'll target RPO (Recovery Point Objective, the maximum acceptable data loss measured in time) of roughly 30 seconds and RTO (Recovery Time Objective, the maximum acceptable downtime) of roughly 15 minutes, both stated as example targets since the question leaves them to the candidate, not as universal numbers.
Structured elaboration
RDS vs self-managed on EBS. On RDS (a managed Postgres service), automated backups continuously stream WAL to object storage, giving PITR out of the box with retention up to 35 days, and a cross-region read replica (asynchronous by default) can be promoted for regional DR. On self-managed Postgres on EBS (Elastic Block Store, cloud block storage volumes), the same capability has to be built: pg_basebackup for periodic base backups, continuous WAL archiving to object storage (commonly via wal-g or pgBackRest) for PITR, and physical streaming replication to a standby in another region. EBS snapshots can also back the base-backup layer, but need care: a snapshot taken mid-write without coordinating with Postgres (e.g. via pg_start_backup) can capture an inconsistent volume state, so either use a backup tool that handles this coordination or take the base backup through pg_basebackup instead of a raw disk snapshot.
Cross-region replication: sync vs async. Synchronous replication (the primary waits for the standby to acknowledge before committing) gives an RPO close to zero but adds the cross-region round-trip time to every write's latency, commonly tens to well over a hundred milliseconds depending on the region pair, and risks stalling the primary if the standby becomes unreachable. Asynchronous replication accepts a small replication lag (commonly seconds under normal load) in exchange for no write-latency tax; given a 30-second RPO target, async has ample headroom and is the more cost-effective default. Reserve synchronous replication for a stricter RPO tier if one is ever needed.
Failover procedure. Promote the standby (pg_ctl promote, or the managed failover API on RDS), update the client-facing endpoint (DNS or a connection proxy) to point at the new primary, and fence the old primary, revoking its ability to accept writes, so it can't diverge from the newly promoted primary if it later comes back online (a split-brain scenario, where two nodes both believe they're primary and accept conflicting writes).
Worked RTO breakdown (basis: wall-clock minutes from declared incident to first successful write, summed and checked against the 15-minute target, not each phase in isolation). Detection and decision to fail over: about 5 minutes (health-check failure threshold plus confirmation). Promotion of the standby: about 2 to 5 minutes. Endpoint cutover and client reconnect: about 5 minutes (DNS propagation and application retry/reconnect behavior). Smoke validation before declaring the incident resolved: about 3 to 5 minutes. Summed, that's roughly 15 to 20 minutes; if the total lands over the 15-minute target, the endpoint-cutover step (usually the least automatable) is the first place to look for savings, e.g. via a connection proxy that can be repointed faster than DNS TTL propagation allows.
Validation and automated DR testing. Run scheduled drills that promote the DR replica into an isolated network (not the live traffic path), run automated read/write smoke tests and a row-count or checksum comparison against the primary before the drill promotes, and time every phase against the RTO/RPO targets. Separately, test the PITR path itself (restore a base backup plus archived WAL to a specific past timestamp) on its own schedule, since it's a different recovery mechanism from replica promotion and can silently break (a missing WAL segment, an expired retention window) without the replication drills ever exercising it.
Controlled restore of production traffic. After promoting the DR replica and validating it, don't cut 100% of traffic over immediately: shift a small percentage first via weighted routing, watch error rates and replication lag on the newly promoted primary, then ramp to full traffic. Keep the old primary around, fenced but not destroyed, as a forensic copy in case anything needs to be recovered from it, and rebuild a fresh standby in a healthy region afterward so the system isn't left without DR coverage once the immediate incident is over.
You need to back up a mix of traditional VMs and containerized workloads and guarantee each backup is actually consistent, not just a snapshot taken mid-write. What approaches would you use for each, and where do containers with ephemeral state or multiple writable layers break the naive approach?
Sample Answer
Direct answer
For VMs, application-consistent backups come from quiescing the guest (flushing filesystem buffers and, for databases, flushing write-ahead logs) immediately before a hypervisor- or volume-level snapshot, using OS-native mechanisms such as VSS on Windows or fsfreeze and application-specific hooks on Linux. For containers, the container image itself needs no backup at all since it is rebuilt from a registry via CI/CD; what actually needs protecting is state living outside the container, meaning persistent volumes, backed up at the storage layer (a CSI snapshot in Kubernetes) combined with the same kind of application-level flush hook for anything stateful running inside the pod. The naive approach breaks specifically where containers hold meaningful state that never touches a persistent volume, and where a multi-volume or multi-container workload is snapshotted piecemeal instead of coordinated as one unit.
VMs: approach
Storage-layer, copy-on-write snapshots (LVM, ZFS, or a cloud block-storage snapshot) are fast and near-instant to create because the storage layer preserves the original data block instead of overwriting it, so the snapshot is a cheap pointer to the current image rather than a full copy, but on their own are only crash-consistent, equivalent to yanking the power cord: correct for many workloads, but not sufficient by itself for a transactional database, which needs its in-flight writes flushed and its log in a known state first. Application-consistent backup adds a quiesce step before the snapshot: pause or flush writes (fsfreeze, a database's own "flush and hold" command, or VSS's application-aware writers on Windows), take the snapshot, then resume, so the captured state is one a database engine would recognize as a clean shutdown rather than a crash.
Containers: approach
A container's writable layer and any in-memory state are not the target of backup; the persistent volumes attached to it are. Back those up via the storage layer's native snapshot capability (a CSI (Container Storage Interface, the plugin standard that lets Kubernetes talk to a storage backend's snapshot capability) volume snapshot), and for anything stateful running in-cluster (a database StatefulSet, for example), add the same pre-snapshot quiesce hook used for VMs, since the consistency problem is identical once you are below the orchestration layer: a database is a database regardless of what schedules its compute.
Where ephemeral state breaks the naive approach
A container can hold meaningful data purely in memory or in its ephemeral writable layer, for example an in-progress upload buffer or a local cache being built, that lives nowhere a storage-layer snapshot would ever see. A backup strategy built entirely around snapshotting attached persistent volumes silently misses this data completely, because there is nothing at the storage layer corresponding to it. If that data actually matters, the fix is either flushing it to a persistent volume or an external store before backup runs, or redesigning the workload so nothing durable is allowed to live only in ephemeral storage in the first place.
Where multiple writable layers break the naive approach
A pod with multiple containers, each writing to its own attached volume (an app container plus a sidecar, say), can have each volume snapshotted independently on its own schedule, producing snapshots that are each individually valid but collectively inconsistent with each other, since they were captured at slightly different instants. This is the same class of problem as backing up two related databases on separate, uncoordinated schedules. The fix is a coordinated, pod-level (or application-level) quiesce-then-snapshot-all step: freeze every writer, snapshot every attached volume together, then resume, rather than scheduling each volume's snapshot independently.
A related trap: snapshotting the overlay filesystem itself
Trying to directly capture a container's copy-on-write overlay/union filesystem layer, rather than its mounted persistent volumes, preserves something that is ephemeral by design and gets discarded on the next restart or reschedule anyway. A backup strategy oriented around that layer is protecting the wrong thing: durability was never supposed to live there, and a naive "back up the container" instinct, carried over from VM thinking where the whole disk image mattered, is exactly the assumption that breaks under containers.
Describe best practices for encrypting backup data both in transit and at rest, including how you'd manage the encryption keys themselves. Who should be able to decrypt a backup, who shouldn't, and what happens operationally if a key is lost or compromised?
Sample Answer
Direct answer
Encrypt backup traffic in transit with TLS and backup content at rest with envelope encryption (a per-object data key wrapped by a master key held in a dedicated key management system or hardware security module), then treat key management, not the encryption algorithm, as the actual hard problem: who can decrypt has to be a small, audited, separated-from-production-admin group, key loss has to be survivable via escrow, and key compromise has to trigger both technical rotation and a compliance review, because a leaked backup encryption key is very likely a reportable data breach even if the storage itself was never touched.
In transit and at rest
Use TLS 1.2 or later for every movement of backup data (agent to repository, replication between sites), ideally with mutual TLS for backup infrastructure specifically, since it is an especially attractive attacker target. At rest, use envelope encryption: each backup object gets a unique data encryption key (DEK), and DEKs are themselves encrypted by a key encryption key (KEK) held in a KMS or HSM, never stored alongside the encrypted data. AES-256 is the standard symmetric algorithm for both layers. Rotate the KEK on a defined schedule; because of envelope encryption, rotating the KEK does not require re-encrypting every historical backup, only wrapping new DEKs under the new KEK version going forward, while old DEKs remain individually unwrapped by whichever KEK version originally wrapped them.
Separation of duties and access control
The person or role who can trigger a restore (and therefore decrypt) should be distinct from the role that administers the KMS and key policy, and distinct from general production admin access. The principle: no single compromised credential should be able to both destroy production and either destroy or exfiltrate the backup that would recover it. For particularly sensitive backup classes, use break-glass procedures requiring dual control, for example two-person, M-of-N approval, ideally spanning two different reporting lines so a single manager cannot unilaterally authorize access, with every decrypt operation logged to an immutable audit trail.
Who should be able to decrypt
In the normal operating path, only the automated backup and restore service's scoped identity should hold decrypt access. A small, named, audited group of humans should hold break-glass access for genuine disaster-recovery scenarios. General infrastructure admins, developers, and, in a SaaS backup product, the vendor itself should not have standing decrypt access; where the vendor relationship allows it, use a customer-managed-key architecture so the vendor is physically unable to decrypt without the customer's key, regardless of the vendor's own internal access controls.
Key escrow
Losing the KEK means losing the ability to decrypt every backup that depends on it, a single point of total, permanent data loss, arguably worse than the outage the backup existed to protect against. Because of that asymmetry, key material for backup KEKs specifically needs a documented escrow procedure: a securely stored, access-controlled, geographically separate copy, for example split across multiple custodians using a secret-sharing scheme, or escrowed via the KMS provider's own durability guarantees plus an independent backup of key metadata. Escrow itself should still require a quorum of parties to reconstruct, so the escrow mechanism does not become the new single point of failure it was built to eliminate.
What happens if a key is lost versus compromised
If the KEK is genuinely lost with no escrow copy, every backup it protected becomes cryptographically unrecoverable, permanently, which is precisely why escrow is not optional for this specific class of key. If the KEK is compromised (an attacker obtained it, rather than it being lost), every backup encrypted under it must be treated as breached: encryption at rest provides no protection once the key itself is out, regardless of whether the storage location was ever touched. The response is immediate rotation for all future backups, plus, because a leaked backup KEK typically implies the underlying personal data is presumed compromised, a compliance response: under GDPR and comparable regimes this is very likely a reportable personal-data breach, triggering the 72-hour supervisory-authority notification clock under GDPR Article 33 regardless of whether the storage itself shows evidence of access, with data-subject notification also required if there is high risk to individuals' rights.
Case study: A compliance workload requires 10-year retention and must be recoverable within 48 hours. Compare two approaches quantitatively and qualitatively: (A) keep replicated backup copies in two regions (higher ongoing storage/egress cost) vs (B) keep primary in lower-cost cold archive and perform on-demand restores to recover within 48 hours. What variables determine the better approach and how would you model costs and risk?
Sample Answer
Direct answer
Build a total-cost model over the same ten-year horizon for both approaches, using the same
dataset size on both sides, then find the break-even restore frequency at which the two costs are
equal. In a realistic model, keeping a cold archive copy and restoring on demand is dramatically
cheaper unless full-dataset restores happen roughly monthly or more often, which is far more often
than a genuine compliance archive is typically accessed. The variable that actually decides the
question is expected restore frequency, not raw storage price, though a hard regulatory
requirement for geographic redundancy can override the cost comparison entirely.
Quantitative model
Take an illustrative 8,000 GB (8 TB) compliance dataset, retained for 10 years, with a 48-hour
recovery requirement. All figures below are illustrative order-of-magnitude prices for
demonstrating the model, not live vendor pricing, and every step stays on the same basis: GB,
GB-month, and dollars per year, converted consistently.
Approach A: replicated copies in two regions, on a tier that supports near-immediate restore,
at an illustrative $0.01 per GB-month per region.
- Per region: 8,000 GB times $0.01 per GB-month is $80 per month.
- Two regions combined: $160 per month, or $1,920 per year, or $19,200 over 10 years.
- Plus a one-time cross-region seed transfer of roughly 8,000 GB at an illustrative $0.02 per GB
egress rate: about $160. - Total over 10 years: approximately $19,360.
Approach B: a single-region cold archive tier plus on-demand restores, at an illustrative
$0.001 per GB-month for storage and $0.02 per GB for a retrieval that still meets the 48-hour
target.
- Storage: 8,000 GB times $0.001 per GB-month is $8 per month, or $96 per year, or $960 over 10
years. - Retrieval: 8,000 GB times $0.02 per GB is $160 per full-dataset restore event.
Break-even. Setting the two ten-year totals equal: 960 plus 160 times N equals 19,360, so N
equals about 115 restore events over 10 years, roughly 11.5 per year, close to monthly. Below that
frequency, approach B is cheaper; above it, approach A is cheaper. At a more realistic frequency
for a legal-hold or audit archive, say 3 full-dataset restores across the entire 10-year hold,
approach B totals 960 plus 3 times 160, or $1,440, versus approach A's $19,360, roughly 13 times
cheaper.
Qualitative factors
- SLA margin, not just average cost. Archive tiers commonly offer a faster, pricier retrieval
option and a slower, cheaper one. For a 48-hour requirement, choose whichever tier's stated
retrieval window leaves real margin under 48 hours, not one whose window is itself close to 48
hours, since that leaves no time for locating the right data, transferring it, and validating it
before the deadline. - Regulatory mandates can override cost. Some compliance regimes require genuinely
geographically redundant, continuously available copies as a requirement in itself, independent
of how often the data is actually restored. Check whether that applies before running any cost
model; if it does, approach A may be mandated regardless of the comparison above. - Tail risk of a single archive copy. If approach B's single region is lost entirely before a
restore happens, and the archive tier does not itself provide independent geographic redundancy
beyond its own region, approach B carries more risk of total data loss than approach A's
two-region design. This risk does not show up in the average-cost model and has to be weighed
separately.
Variables that determine the better approach
Dataset size, retention duration, the price differential between the fast and cold tiers, expected
restore frequency over the retention horizon (the single largest lever, per the break-even
calculation), the archive tier's actual retrieval latency relative to the SLA's margin, and any
hard regulatory requirement for geographic redundancy that removes the choice from a pure cost
comparison.
How to model cost and risk
Compute storage cost as footprint in GB times price per GB-month times months retained, summed per
copy, and retrieval cost as expected number of restores times footprint times price per GB
retrieved, comparing both approaches over the identical retention horizon and dataset size so
nothing is compared across mismatched bases. Score the qualitative risks, SLA margin and single-copy
exposure, separately from the dollar figures, and check whether a hard compliance requirement
removes the choice before optimizing the remaining trade-off on cost alone.
Design a backup and disaster recovery system for 200 TB of production block storage spread across multiple data centers. Requirements: daily incremental backups, weekly full backups, RTO < 4 hours for critical datasets, RPO < 1 hour for highest-priority data, and retention/compliance policies. Detail architecture (snapshot vs block-level copy vs agent), cataloging, verification, restore runbooks, and how SREs should operate and test the system.
Sample Answer
Direct answer
At 200 TB, two things break the naive reading of the requirements and have to be designed around explicitly. First, "weekly full backup" cannot mean literally re-reading and re-copying all 200 TB every week: at a realistic sustained backup throughput of 500 MB/s, copying 200 TB takes roughly 200,000,000 MB / 500 MB/s ≈ 400,000 seconds ≈ 111 hours, well over four days, so a literal weekly full would never finish before the next one starts. The fix is snapshot-based, copy-on-write "synthetic full" backups: a full recovery point that is constructed from an incremental chain without re-reading the whole dataset. Second, RPO < 1 hour (Recovery Point Objective: the maximum acceptable data loss, measured as time) is stated only for the highest-priority subset of data, not the whole 200 TB; daily incrementals alone give an RPO of up to 24 hours, so that highest-priority subset needs a separate, more frequent capture mechanism layered on top of the daily/weekly baseline, not a tighter version of the same schedule applied everywhere.
Structured elaboration
Architecture: snapshot vs block-level copy vs agent, and why a hybrid.
- Storage-level snapshots (copy-on-write snapshots at the SAN, Storage Area Network, a dedicated network of shared block-storage devices, array, or cloud block-storage layer) are fast to create, capture only changed blocks, and are the right mechanism for the frequent, high-priority tier: they don't require reading the whole volume, so an hourly snapshot on a 200 TB estate is cheap regardless of total size. They are typically crash-consistent by default (consistent with an ungraceful power-off) and need an application-aware quiesce step (flushing writes, briefly freezing the filesystem) to be application-consistent for databases.
- Block-level backup/replication (deduplicated, changed-block backup software, or asynchronous block replication to the second data center) is what actually gets data across data centers for disaster recovery, since a local snapshot alone doesn't survive losing the data center it lives in. This is the mechanism that should carry the highest-priority subset's near-real-time copy to the DR site.
- Agent-based, file-level backup (an agent running inside each host or VM that understands the application, e.g. taking an application-consistent dump via a pre-freeze hook) is the most flexible but the slowest to scan at this scale, and shouldn't be the primary mechanism for the bulk of 200 TB. Reserve it for stateful applications (databases, message queues) that need an application-consistent capture the block layer can't provide on its own, layered on top of block-level backup for the rest.
- Recommended hybrid: block-level, copy-on-write snapshots as the default for all volumes (daily, feeding synthetic weekly fulls); asynchronous block-level replication to the second data center for the highest-priority subset, running frequently enough (e.g. every 15 to 30 minutes) to comfortably clear the 1-hour RPO with margin; agent-based, application-consistent backups only for databases and similar stateful services that need a coordinated quiesce, at the same cadence as their tier.
Worked restore-time example (basis: a single critical dataset's volume, not the full 200 TB). Suppose the highest-priority tier is a 10 TB subset. At an aggregate parallel restore throughput of 1 GB/s (achievable by restoring many volumes or shards concurrently rather than serially), restoring 10 TB takes 10,000 GB / 1 GB/s = 10,000 s ≈ 2.8 hours, comfortably inside the 4-hour RTO (Recovery Time Objective: the maximum acceptable downtime) for that dataset. This number is scoped to the 10 TB critical subset; restoring the full 200 TB estate at the same throughput would take roughly 200,000 GB / 1 GB/s ≈ 55.6 hours, which is why the RTO commitment applies per-dataset-tier, not as a promise to restore everything in 4 hours.
Cataloging. Maintain a backup catalog (an index of what was backed up, when, where, and with what checksum) as a small, independently replicated service, not embedded inside the 200 TB of bulk data itself. If the catalog only exists in the data center that just failed, nobody can find anything to restore even though the data may be intact elsewhere; replicate the catalog to every data center that could need to drive a restore.
Verification. Automated, scheduled restore tests: sample a set of volumes weekly, restore them into an isolated environment, and compare checksums against what the catalog recorded at backup time. Separately, run periodic bit-rot scans against the backup storage itself, since 200 TB sitting mostly cold for months can silently degrade without ever being touched by a restore. Neither of these is optional at this scale: an untested backup is a hypothesis, not a backup.
Restore runbooks. Document, per tier: who declares an incident and authorizes a restore, the priority order (highest-priority datasets first, since restore bandwidth is a shared, finite resource across a 200 TB estate and can't restore everything in parallel at full speed), the exact automated restore procedure (scripted, not ad hoc commands typed under pressure), and the rollback point if the restore itself needs to be aborted.
How SREs operate and test it. Track backup success rate, backup duration, and restore-verification pass rate as monitored SLOs (Service Level Objectives), with alerts on any missed window. Run quarterly full DR game days that actually fail a critical dataset over to the second data center and time every runbook phase against the 4-hour and 1-hour targets, rather than trusting the design math alone.
Unlock Full Question Bank
Get access to all Backup and Disaster Recovery interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.