A simple rule that survives almost any disaster: keep 3 copies of your data, on 2 different types of storage, with 1 copy offsite.
In practice
- Copy 1: the live data on your server.
- Copy 2: a local backup on another machine or storage system in the same datacenter, for fast restores.
- Copy 3: an offsite copy in another datacenter or S3-compatible object storage, in case the whole site is lost.
Make it ransomware-proof
- Keep at least one copy immutable or offline: object lock, append-only repositories (Restic and Borg support this), or snapshots the server itself can't delete.
- The production server should not hold credentials that can delete its own backups.
Things that are not backups
- RAID: protects against a disk failure, not against deletion, corruption or ransomware.
- Replication: copies mistakes to the replica instantly.
- Snapshots on the same storage: gone if that storage fails.
And a backup only counts once you've restored from it. See How to test a restore.