How backups work under the hood

Published on 2026-09-12 by frfrand

What is a hot backup, why a dump and a physical copy solve different problems, how deduplication works, and what hash verification is for.

How backups work under the hood

Short answer: A backup combines several decisions: logical dump (portable and slow) or physical copy (fast and tied to the engine version); hot copy, which marks a point in the write-ahead log so the result is consistent; incremental backups with block-level deduplication; a hash to detect silent corruption; and encryption and off-machine storage. Only a tested restore confirms that the copy works.

"Making a backup" sounds like a single operation and in reality it is several chained decisions. It is worth knowing them because they explain why sometimes a copy works and sometimes it doesn't.

Logical dump and physical copy

The logical dump (pg_dump, mysqldump) generates the instructions needed to reconstruct the data: create tables, insert rows. It is text, or a proprietary compressed format.

Advantages: it is portable between engine versions and even between operating systems, it can be restored partially (a single table), and it can be inspected.

Disadvantage: it is slow on large databases, both to generate and to restore, because restoring means re-executing all those insertions and rebuilding all indexes.

The physical copy copies the data files as they are. Much faster on large databases and is the basis of point-in-time recovery.

Disadvantage: it is tied to the engine version and architecture. You cannot restore a physical copy of Postgres 15 on a Postgres 17.

The usual strategy uses both: physical for fast recovery, logical periodic as a portable safety net.

What "hot" means

A hot copy is taken without stopping the database. The challenge is obvious: while you copy files, the database keeps writing. Some pages are copied in the middle of a modification.

The trick is not to pause, but to mark:

  1. The database notes the exact position in its write log (the WAL in Postgres).
  2. The files are copied, with normal traffic occurring.
  3. The write log is also copied from that mark.

When restoring, the engine replays that log over the files and repairs any page that was left halfway. The result is consistent.

That is why a naive copy of the files of a running database can be useless: it lacks the second half.

And it is also what allows point-in-time recovery: if you keep the continuous log, you can restore the copy and replay up to 14:37, just before the accidental deletion.

Incrementals and deduplication

An incremental copy saves only what changed. The interesting question is how to know what changed.

Modern tools split files into blocks and calculate the hash of each block. If the hash already exists in the repository, it is not saved again: a reference is saved.

That gives a very useful effect: you can have thirty daily copies of a 100 GB database occupying much less than 3 TB, because most blocks repeat. And each copy behaves like a full one when restoring, even though physically it is incremental.

Why the hash matters

Storing the hash of each copy serves to detect silent corruption.

Disks fail in subtle ways: a bit that changes without anyone noticing. If that happens in a backup, you find out the day you need it.

With the hash stored alongside, it can be verified periodically without restoring anything. It is cheap and answers an important question: is this file still the one I saved?

That said: the hash confirms that the file is intact, not that it is useful. For that you have to restore it.

Encryption and location

Two things that are often forgotten:

  • Encrypt before it leaves. A dump does not contain any of the database permissions inside. It is text with all your data.
  • Store on another machine. Ideally with another provider, and with credentials different from production. If whoever compromises your server can also delete your backups, you don't have backups.

In ArduMaker, each VPS, unless you exclude it, has a complete automatic copy every 7 days: a hot snapshot of the container, exported along with the nginx configuration and the certificates for its domains, verified with checksums and stored outside the VPS host, with a LEEME.md explaining how to restore it. Note a detail from this same article: it is a machine copy taken without pausing anything, not a hot copy coordinated with the database engine. For PostgreSQL or MySQL, it is advisable to add your own dump, which is the consistent backup of the data.

How backups work under the hood
How backups work under the hood

From creation to restore drill

To verify a backup strategy, prepare a test environment, restore a recent copy, and run business checks: that users exist, that tables are consistent, and that the application can serve a request. A full disk image and a logical PostgreSQL backup solve different problems.

If you use an ArduMaker VPS, the VPS copy is weekly and the last two are kept; only a company admin can request an off-hours copy or download it. Also document where you store your own database dumps, how often they are generated, and who can access them. A successful restore with a small copy does not automatically prove that the procedure will scale to a large database.

Frequently asked questions

What is the difference between pg_dump and a physical copy? pg_dump generates the instructions to rebuild the data: it is portable between versions and allows restoring a table, but it is slow on large databases. The physical copy copies the engine files: it is fast and allows point-in-time recovery, but it is tied to the version.

Can a database be copied without stopping it? Yes, if the tool coordinates the copy with the engine's write-ahead log (for example, pg_basebackup in PostgreSQL). Copying the files of a running database without that coordination can result in a useless copy.

What is the hash of a backup for? To check, without restoring, that the file is still the one that was saved. It does not say whether the copy is useful: only a restoration confirms that.

What is deduplication? Splitting data into blocks and saving each block only once, even if it appears in many copies.

Related: What is a backup · How to transfer large files.

  • backups
  • snapshots
  • incremental
  • ArduMaker
  • restauración

On ArduMaker

  • Automatic backups: A full live weekly copy, the last 2 kept, manual copies and downloads, and a final copy when the Linux Computer is deleted.

Keep reading

All articles · VPS plans