JEEKSSHIRE 24

Application data backups: what to back up, where to keep copies and how to restore

A backup is a saved state of an application's data from which it can be brought back after a failure, a mistake or an attack. You need to copy not only the database but also user files, settings and everything else without which the service cannot be rebuilt. Backups are kept away from the main server, in several places, encrypted and with restricted access. Frequency and retention depend on how much data the business can afford to lose and how quickly the service must come back. The key rule: a backup counts as working only after you have successfully restored from it.

Open the software development page

Why an application needs backups

While everything works, backups feel like a formality. Their value shows only on a bad day, and bad days come in different forms:

In all these cases the same thing saves you: a fresh, intact and accessible backup that the team knows how to restore from. Without it, even a small failure turns into lost customers, money and history. How data storage works in general is covered in the guide to the web app database.

What to back up

A common mistake is backing up only the database. For the application to be restorable as a whole, the backup plan includes:

A good completeness test: could the team deploy the service on a clean server with only the backups and the documentation? If it needs that one file on a developer's laptop, the plan is incomplete.

How often to back up and how long to keep copies

Frequency follows from two questions. First, how much data the business is willing to lose: orders from the last hour, or from the last day? Second, how quickly the service must come back after a failure. Professionals call these the recovery point and recovery time objectives (RPO and RTO).

Data typeWhat mattersTypical approach
Orders, payments, customer bookingsEven a short loss is feltFrequent backups plus continuous logging of database changes
Catalogue, reference data, contentChanges less often and can be restored by handDaily backups
User filesLarge, lost entirely if storage failsCopying changes and keeping versions
Settings and configurationNeeded to bring the service up quickly elsewhereDocumentation and scripts in the repository, a copy on every change

Retention is a separate decision. Keep several recent backups so you can roll back to a point before a mistake that was not noticed at once, and less frequent backups over a longer period. Personal data, however, is not kept longer than necessary and permitted by the processing policy.

Where to store backups

A backup on the same server as the application protects only against data errors, not against losing the server. So backups are moved elsewhere. A widely used guideline is the 3-2-1 rule: several copies of the data, on different types of storage, with at least one at another location.

The last point protects against the worst case: if an attacker gets into the server, they cannot destroy the backups too. Choosing locations is covered in the guide on where to host an app.

Types of backups

TypeHow it worksPros and cons
FullSaves all data in one goSimplest to restore, but takes more space and time
IncrementalSaves only changes since the previous backupFast and compact, but restoring needs the whole chain
Disk snapshotCaptures the state of the server disk at a moment in timeHandy for rolling back a server quickly, but does not replace a database backup
Continuous change loggingSaves the database change log almost in real timeLets you return to a specific minute; needs setup and monitoring

In practice the types are combined: a regular full backup, changes in between, and for a database holding money, a continuous log. A database backup is made with the database's own tools rather than by simply copying the files of a running server, so that it is consistent.

Restoring: an untested backup is not a backup

The worst situation is discovering on the day of a failure that backups were being made but cannot be restored: a file is corrupted, part of the data is missing, nobody remembers the steps. That is why restores are tested regularly, not just in theory.

  1. On a schedule, a backup is restored on a separate test server.
  2. The team checks that the application starts, the data opens and recent records are there.
  3. The restore time is measured and compared with the acceptable time.
  4. The steps are written down so that another person could carry them out.
  5. Problems found are fixed and the test is repeated.

Monitoring watches the backups themselves too: if a backup was not created or is suspiciously small, the person in charge is alerted the same day instead of finding out during an outage. The response procedure and timelines are conveniently fixed in the support contract, covered in the guide to software support SLA.

Backup security

A backup contains the same data as the live database, so it needs the same protection:

Threats and protection are covered in detail in the guide to web app security.

Common mistakes

How JEEKSSHIRE 24 handles backups

In the products we build, backups are set up together with the server side, not after the first failure. Database and file backups are stored outside the main server, monitoring reports backup failures, and restores are tested. Changes that delete or rewrite data are a separate step taken only after a fresh backup.

Together with the product, the client receives configured failure alerts and backups of the server side, and under a support agreement we watch them and test restores. More on the software support page, and all our services are collected on the software development page.

Frequently asked questions

How often should backups be made?

It depends on how much data the business is willing to lose. For orders and payments, backups are frequent and supplemented by a change log; for rarely changing reference data, daily backups are enough.

Are the hosting provider's backups enough?

As a foundation, yes, but it is better to also have your own backup elsewhere. Provider backups will not help if the problem is with the account or the provider itself.

What is the 3-2-1 rule?

It is a guideline: several copies of the data, on different types of storage, with at least one copy at a separate location.

How long should backups be kept?

Several recent backups for fast rollback and less frequent ones over a longer period. Personal data is not kept longer than required and permitted by the processing policy.

Do backups need to be encrypted?

Yes. Backups hold the same data as the live database, so they are encrypted and the keys are stored separately.

How is a server snapshot different from a database backup?

A snapshot captures the whole disk and is handy for rolling back a server. A database backup made with the database's own tools ensures data consistency and lets you return to a specific point.

How do we know backups are working?

Regularly restore a backup on a test server, check the data and receive alerts if a backup was not created.

Do we need backups if the code is in a repository?

Yes. The repository holds code, but not user data, files and production settings, without which the service cannot be restored.

IP geolocation by DB-IP