Sub topic 1
What a server backup must achieve
A server backup is a recoverable copy of important data and configuration. It must help you restore service after accidental deletion, hardware failure, ransomware, or a larger disaster. A backup is useful only if it is recent enough, stored safely, and known to restore correctly.
Prerequisites
This chapter assumes that you are comfortable with the Linux command line, basic shell scripts, SSH, systemd services, file permissions, and common paths such as /etc, /home, and /var.
Start with the 3-2-1 rule
The 3-2-1 rule is a simple design target:
- Keep at least three copies of important data.
- Store the copies on at least two different types of storage.
- Keep at least one copy off the server or off site.
The original data counts as one copy. For example, a server's live files, a backup repository on another disk, and an encrypted repository at a remote provider provide three copies. A second copy on the same disk does not protect against disk failure. Two disks in the same building do not protect against fire or theft.
The rule is a target, not a complete policy. You still need to decide how often backups run, how long they remain available, and how you will restore the operating system, applications, and data.
Define RPO and RTO
A recovery point objective, or RPO, is the maximum acceptable amount of data that can be lost, measured in time. If the RPO is one hour, backups must normally run at least hourly because losing the last 60 minutes of changes is the agreed limit.
A recovery time objective, or RTO, is the maximum acceptable time before the service works again. An RTO of four hours affects more than backup frequency. You may need a prepared replacement server, documented installation steps, and credentials that are available during an outage.
| Goal | Question it answers | Example |
|---|---|---|
| RPO | How much recent work can we lose? | No more than one hour |
| RTO | How long may recovery take? | Service restored within four hours |
Set these goals per service when possible. A development server may have a one-day RPO and two-day RTO. An order-processing server may need a five-minute RPO and one-hour RTO. The stricter goals require more storage, bandwidth, automation, and testing.
Back up recoverable state
Do not assume that copying every file produces a usable recovery. Identify what the service needs:
- Application data and user files.
- Configuration under
/etcand application-specific directories. - Database exports made with database tools.
- Service definitions, scripts, certificates, and deployment files.
- A record of package versions, mount points, users, and scheduled jobs.
RAID, filesystem snapshots, and replicated disks improve availability, but they are not replacements for backups. They can copy deletions or corruption immediately. A backup system should preserve multiple points in time so that you can select a known-good version.
Before choosing restic or Borg, write down the RPO, RTO, data paths, expected growth, and storage locations. These requirements determine whether your design is practical.
Exercise
A server backs up to a second disk every night, but both disks are in the same machine. Which parts of the 3-2-1 rule are still missing?
Show answer
It may have two copies, but it lacks a third copy, a different storage type, and an off-site copy. A failure or theft affecting the machine could destroy both copies.