The 3-2-1 rule: the foundation of every backup strategy

Drives fail, ransomware encrypts and people delete files by mistake. The 3-2-1 rule is the simplest way to be ready when the time comes to restore your data.

Illustration of the 3-2-1 rule: three copies, two media, one copy off-site

What 3-2-1 means

The rule is easy to remember and covers the most common data loss scenarios:

  • 3copies of your data. The original plus two backups.
  • 2different media. For example a local NAS and object storage, so one type of failure cannot destroy both copies.
  • 1copy off-site. A fire, flood or theft in the server room must not take the backup with it.

Why RAID is not a backup

RAID protects against drive failure, but not against deletion, ransomware or a controller fault. Every mistake is written to all drives in the array instantly. The same goes for snapshots that live on the same storage as the data.

Example: restic on a Linux server

restic is a free tool that makes encrypted, deduplicated backups to a local disk, over SFTP or to S3-compatible storage. The basic workflow looks like this:

# initialize a repository on a remote server
restic -r sftp:backup@backup.example.com:/srv/restic init

# back up configuration and websites
restic -r sftp:backup@backup.example.com:/srv/restic backup /etc /var/www

# retention: 7 daily, 4 weekly and 6 monthly snapshots
restic -r sftp:backup@backup.example.com:/srv/restic forget \
  --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune

Test your restores

A backup you have never restored is just an assumption. At least once a month, restore data to a test location and check that it is complete.

restic -r sftp:backup@backup.example.com:/srv/restic restore latest --target /tmp/restore-test
Tip

The modern version of the rule is 3-2-1-1-0: one copy is offline or immutable, and restore verification completes with zero errors.