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:
- a disk or an entire server fails at the provider;
- an employee accidentally deletes a catalogue section or bulk-changes order statuses;
- a new app version or a failed database change corrupts some records;
- an attacker gains access and deletes or encrypts data;
- the provider blocks the account or stops operating in the region.
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:
- the database: users, orders, payments, statuses and change history;
- files: photos, documents and attachments stored separately from the database;
- server and application settings: everything needed to bring the service up in a new place;
- secrets and keys, kept separately in a protected store rather than next to ordinary backups;
- source code, in a repository that is itself a copy and should belong to the client;
- logs, if incidents are investigated with them or they are needed for reporting.
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 type | What matters | Typical approach |
|---|---|---|
| Orders, payments, customer bookings | Even a short loss is felt | Frequent backups plus continuous logging of database changes |
| Catalogue, reference data, content | Changes less often and can be restored by hand | Daily backups |
| User files | Large, lost entirely if storage fails | Copying changes and keeping versions |
| Settings and configuration | Needed to bring the service up quickly elsewhere | Documentation 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 primary backup with the same provider but in separate storage, for fast restores;
- an external backup with another provider or in another region, in case of problems with the main one;
- for especially important data, a backup that cannot be changed or deleted during its retention period, even with administrator access.
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
| Type | How it works | Pros and cons |
|---|---|---|
| Full | Saves all data in one go | Simplest to restore, but takes more space and time |
| Incremental | Saves only changes since the previous backup | Fast and compact, but restoring needs the whole chain |
| Disk snapshot | Captures the state of the server disk at a moment in time | Handy for rolling back a server quickly, but does not replace a database backup |
| Continuous change logging | Saves the database change log almost in real time | Lets 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.
- On a schedule, a backup is restored on a separate test server.
- The team checks that the application starts, the data opens and recent records are there.
- The restore time is measured and compared with the acceptable time.
- The steps are written down so that another person could carry them out.
- 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:
- backups are encrypted, and the keys are stored separately from the backups;
- access to backup storage is limited to a few people and logged;
- backups with personal data are not restored into test environments without anonymisation;
- old backups are deleted on schedule rather than kept for years just in case;
- the credentials used for backing up do not allow deleting existing backups.
Threats and protection are covered in detail in the guide to web app security.
Common mistakes
- Backups sit on the same server or with the same provider without separate storage.
- Only the database is backed up, not user files or settings.
- A restore has never been tested.
- Nobody is alerted when backups break.
- The backup is a plain file copy of a running database and turns out inconsistent.
- No separate backup is taken before a risky database change.
- Everyone with server access also has access to the backups.
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.