---
title: "Back up and restore a VPS: a plan you can actually test · CloudSat"
description: "Build a VPS backup plan that restores: snapshots vs file backups, the 3-2-1 rule, restic off-site, database dumps, Windows Server Backup and restore tests."
url: https://cloudsat.io/learn/vps-backup-and-restore-plan
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Cloud and hosting](https://cloudsat.io/learn/topic/cloud-infrastructure)

# Back up and restore a VPS: a plan you can actually test

Build a VPS backup plan that restores: snapshots vs file backups, the 3-2-1 rule, restic off-site, database dumps, Windows Server Backup and restore tests.

CloudSat team November 18, 2026 6 min read

Nobody needs backups. People need restores, and a backup is only proven the day you restore from it. A plan starts with two numbers. The recovery point objective (RPO) is how much recent data you can afford to lose: a day, an hour, nothing. The recovery time objective (RTO) is how long the service may be down while you rebuild. Everything below, from snapshot schedules to database dumps, exists to hit those two numbers for a typical VPS.

## Snapshots are not the whole plan

A snapshot captures the entire disk of a server at one moment. It is the fastest way back from a bad upgrade or a deleted directory: restore, reboot, done. It is also the wrong place to keep your only copy:

- **It lives with the provider, in your account.** An account lockout, an expired payment or a platform incident takes the server and its snapshots out together.
- **It is all or nothing.** Getting back one file means restoring or cloning the whole disk.
- **It is crash-consistent.** A snapshot of a running database looks like a server that lost power. Modern databases usually recover from that, but a proper dump is a cleaner restore point.

Use snapshots before changes and as a fast first layer. On CloudSat, they are billed per GB per month, with up to 10 per server ([snapshot pricing and limits](https://cloudsat.io/docs/snapshot-pricing-and-limits)).

## Apply the 3-2-1 rule

The classic rule still fits: three copies of the data, on two different systems, with one copy off-site. For a single VPS that translates to:

1. **The live data** on the server.
2. **Snapshots** at the provider, for fast rollbacks.
3. **Encrypted file backups** in a different place: another provider, another region under different credentials, or a machine at the office.

Add one property to the off-site copy: the server should not be able to delete it. Ransomware and attackers who get root go after backups first. An append-only backup server, or object storage with retention locks, means a compromised server can add backups but not erase old ones.

## Decide what to back up

| Data | Method | Typical frequency |
| --- | --- | --- |
| Databases | Logical dumps or the database's own backup tool | Hourly to daily |
| Uploads and app data (`/srv`, `/var/www`, `/home`) | File-level backup | Daily |
| Configuration (`/etc`, crontabs, systemd units, Compose files) | File-level backup | Daily, and after changes |
| The whole server | Snapshot | Before changes, plus weekly |
| Secrets (keys, `.env` files) | Inside the encrypted backup | With the configuration |

Leave out what can be rebuilt: `/proc`, `/sys`, `/dev`, `/run`, `/tmp`, package caches and container images you can pull again. On a Docker host, the data lives in named volumes under `/var/lib/docker/volumes` and in bind-mounted folders; back those up along with the Compose files that recreate everything else, and dump any database container rather than copying its volume while it runs.

## Dump databases before the file backup

File-copying a live database directory produces a backup that may not open. Dump first, then let the file backup pick up the dump:

```bash
mkdir -p /var/backups/db
pg_dump -Fc -f /var/backups/db/appdb-$(date +%F).dump appdb
mysqldump --single-transaction --routines --triggers appdb | gzip > /var/backups/db/appdb-$(date +%F).sql.gz
find /var/backups/db -type f -mtime +7 -delete
```

`pg_dump -Fc` writes PostgreSQL's compressed custom format, which `pg_restore` can restore selectively. `--single-transaction` gives a consistent MySQL or MariaDB dump of InnoDB tables without locking them; on MariaDB the tool is also available as `mariadb-dump`. The last line keeps a week of local dumps.

## File backups with restic

restic is a single binary that encrypts, deduplicates and verifies backups, and writes them to SFTP servers, S3-compatible object storage or any rclone remote. Install it with `sudo apt install restic` on Debian and Ubuntu, or from EPEL on the RHEL family. Then create a repository on the off-site target:

```bash
openssl rand -base64 32 > /root/.restic-pass && chmod 600 /root/.restic-pass
export RESTIC_REPOSITORY=sftp:backup@203.0.113.50:/srv/restic/web-01
export RESTIC_PASSWORD_FILE=/root/.restic-pass
restic init
restic backup /etc /srv /var/www /var/backups/db --exclude-caches
restic snapshots
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
restic check
```

For the append-only property described earlier, point restic at a `rest-server` started with `--append-only` on the backup host. The server can then add snapshots but never delete them, and you run `forget --prune` from the backup host instead. Store a copy of the password file somewhere outside the server, such as a password manager. Without it the repository is unreadable, by design. `forget --prune` applies the retention policy and deletes data no snapshot needs any more; `check` confirms the repository structure afterward.

Put the dump and backup commands in one script, load the two `RESTIC_` variables from a root-only environment file, and run it nightly with a cron entry or a systemd timer:

```bash
echo '30 2 * * * root /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1' | sudo tee /etc/cron.d/backup
```

Then make failure loud: a backup that silently stopped in March is discovered in July. Have the script ping a health-check service at the end, or alert when the log has not changed for a day.

## Windows servers

Windows Server includes a backup feature that can capture everything needed for a bare-metal restore:

```powershell
Install-WindowsFeature Windows-Server-Backup
wbadmin start backup -backupTarget:\\nas01\backups -include:C: -allCritical -quiet
wbadmin get versions
```

A network share target keeps only the latest backup, overwriting the previous one, so pair it with versioned copies elsewhere. restic also runs on Windows, and its `--use-fs-snapshot` option backs up open files through Volume Shadow Copy. Dump SQL Server databases with its own `BACKUP DATABASE` command rather than copying the files.

## Test the restore

This is the step that separates a plan from a hope. Once a month, restore something real:

```bash
restic restore latest --target /tmp/restore-test --include /etc/nginx
diff -r /tmp/restore-test/etc/nginx /etc/nginx
createdb restore_test && pg_restore -d restore_test /var/backups/db/appdb-2026-11-17.dump
restic check --read-data-subset=5%
```

The first two lines prove that files come back intact. The third proves the dump opens, in a scratch database rather than over production. The last one reads a sample of the stored data itself, not just the index, which catches silent corruption on the backup side.

Once or twice a year, run a full drill: build an empty server, restore onto it from the off-site copy only, and time it. That time is your real RTO. Write down each step as you go, because the person doing it for real may be you at 3 AM, with no memory of how the script works.

## FAQ

### How often should I back up?

As often as your RPO requires. Daily file backups suit most sites. Databases that take orders or payments usually need dumps every hour or continuous archiving, such as PostgreSQL WAL archiving.

### Are snapshots alone enough?

No. They are fast and convenient but share the fate of your hosting account. Keep at least one encrypted copy somewhere the provider, and the server itself, cannot delete.

### Where should the off-site copy live?

Anywhere independent of the server's credentials: another provider, an object storage bucket, or hardware you own. A CloudSat [storage VPS](https://cloudsat.io/storage-vps-hosting), ideally in a different region from the server it protects, makes a capable restic target, but keep one more copy outside your hosting account entirely.

### Does RAID count as a backup?

No. RAID keeps a server running when a disk dies. It copies deletions, corruption and ransomware to every disk just as faithfully as good data, so it protects against none of them.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Cloud and hosting](https://cloudsat.io/learn/topic/cloud-infrastructure)

- [HDD or SSD for a server: choosing storage by workload](https://cloudsat.io/learn/hdd-or-ssd-for-servers): Cloud and hosting HDD or SSD for a server: choosing storage by workload 6 min read
- [Delete directories in Linux safely: rmdir, rm -r and find](https://cloudsat.io/learn/delete-directories-in-linux-safely): Linux Delete directories in Linux safely: rmdir, rm -r and find 6 min read
- [What to install on a new VPS: a baseline, then the workload](https://cloudsat.io/learn/what-to-install-on-a-new-vps): Cloud and hosting What to install on a new VPS: a baseline, then the workload 6 min read
- [Linux or Windows VPS: choose by workload, not by habit](https://cloudsat.io/learn/linux-or-windows-vps-by-workload): Cloud and hosting Linux or Windows VPS: choose by workload, not by habit 5 min read
