# How to back up a VPS?

> How to back up a VPS in 7 steps: database dumps, restic over SFTP to a second server, a retention policy, a daily timer and a tested restore.

- URL: https://ironkvm.com/guides/how-to-back-up-a-vps/
- Last updated: 2026-11-16
- Publisher: IronKVM (https://ironkvm.com)

Encrypted, deduplicated backups of a VPS to a second machine, with a retention policy and a restore you have actually tried.

**Quick answer — How to back up a VPS?**

To back up a VPS, dump the databases to files, then send /etc, /var/www, /home and the dumps to another machine with restic over SFTP, on a daily timer, with a retention policy and a tested restore. **IronKVM** includes no backups in any of its 6 plans, so this routine is the safety net.

**In brief**

- No plan includes backups: keep a copy of anything that matters outside the VPS.
- A backup on the same disk is not a backup: send it to another server, ideally in another country.
- restic encrypts every repository; lose its password and the data cannot be read.
- Dump databases first: copying live database files gives a broken copy.
- A backup you never restored is a hope, not a backup.

## What should a VPS backup include?

*Folders and data to include in a Debian or Ubuntu VPS backup, and how to capture each*

| What | Path | How |
| --- | --- | --- |
| System configuration | /etc | restic backup |
| Websites | /var/www | restic backup |
| User files and keys | /home, /root | restic backup |
| Databases | /var/backups/db/*.sql | mariadb-dump first, then restic |
| Docker volumes | /var/lib/docker/volumes | Stop or dump the app first |
| Package list | dpkg --get-selections | Save to a file, then restic |

## What are the steps to back up a VPS?

1. **Pick a backup target** — A second VPS or a storage server you control, reachable over SSH. Another country protects against a site-wide failure.
2. **Install restic** — Install the restic package on the VPS you back up.
3. **Create the repository** — Run restic init over SFTP and store the password in a password manager.
4. **Dump the databases** — Write each database to a .sql file with mariadb-dump --single-transaction.
5. **Run the backup** — Back up /etc, /var/www, /home, /root and the dump folder.
6. **Set a retention policy** — Keep 7 daily, 5 weekly and 12 monthly snapshots, and prune the rest.
7. **Schedule it and test a restore** — Run the script daily from cron or a systemd timer, and restore a snapshot to /tmp once a month.

*Set up restic over SFTP*

```bash
sudo apt install restic
export RESTIC_REPOSITORY=sftp:backup@BACKUP_IP:/srv/restic-repo
export RESTIC_PASSWORD_FILE=/root/.restic-pass
restic init
```

*/usr/local/bin/backup.sh, run daily*

```bash
#!/bin/sh
set -e
export RESTIC_REPOSITORY=sftp:backup@BACKUP_IP:/srv/restic-repo
export RESTIC_PASSWORD_FILE=/root/.restic-pass
mkdir -p /var/backups/db
mariadb-dump --single-transaction --databases wordpress > /var/backups/db/wordpress.sql
dpkg --get-selections > /var/backups/packages.txt
restic backup /etc /var/www /home /root /var/backups
restic forget --keep-daily 7 --keep-weekly 5 --keep-monthly 12 --prune
```

*Check and restore*

```bash
restic snapshots
restic restore latest --target /tmp/restore --dry-run --verbose=2
restic restore latest --path /var/www --target /tmp/restore
```

## Why use restic to back up a VPS?

**Because it encrypts, deduplicates and works over plain SSH, with no agent on the backup server.** The restic documentation shows a repository created over SFTP with one command. It also warns that the repository password cannot be recovered: lose it and the data is gone.

Deduplication means a daily run only sends what changed. The `forget` command with keep rules decides which snapshots stay, and `--prune` removes the data no snapshot needs any more. Snapshots can be restored whole or by path, and a `--dry-run` restore shows what would be written first.

## Where is the best place to keep VPS backups?

**On a different machine, with a different provider or at least in a different country.** A backup on the same disk dies with the disk, and a backup in the same datacenter shares its outages. Keep the backup account separate too, so a stolen key on the VPS cannot delete old snapshots.

A small server is enough as a target. Billet has 40 GB NVMe for $4.46 a month on 12 months; Billet, under $15 a month, is rented for 3 months at least. According to IronKVM's survey of 16 November 2026, comparable entry plans cost a median of $15.00 a month. Placing it in another IronKVM country, for example Bucharest for a server in Amsterdam, separates the two.

## When does a backup matter most?

**Before a reinstall, a big update, a move, and the end of a term.** Reboot and reinstall are requested from the dashboard and done by the team; a reinstall wipes the disk. The end of a term matters too. Each VPS is paid from a prepaid crypto balance for the term chosen at checkout. With auto-renew on (a switch on each VPS in the dashboard), it renews from the balance for the same term and price; with auto-renew off, or a balance that is short, the VPS stops at the end of its term, its disk is kept 7 days and then erased.

The [reboot, reinstall and delete guide](https://ironkvm.com/help/reboot-reinstall-delete/ "How do I reboot, reinstall or delete an IronKVM VPS?") lists what each action erases. A fresh backup is also the first step of [moving a website](https://ironkvm.com/guides/how-to-move-a-website-to-an-offshore-vps/ "How to move a website to an offshore VPS?"), and part of [securing an offshore VPS](https://ironkvm.com/guides/how-to-secure-an-offshore-vps/ "How to secure an offshore VPS?"). For WordPress, the dump plus wp-content is the whole site; see [how to install WordPress on a VPS](https://ironkvm.com/guides/how-to-install-wordpress-on-a-vps/ "How to install WordPress on a VPS?").

## Backing up a VPS: questions

### Does IronKVM back up my VPS?

No. No plan includes backups: keep a copy of anything that matters outside the VPS.

### How often should I back up a VPS?

Daily for a site that changes every day. The keep rules then hold a week of dailies and a year of monthlies.

### What is the best backup tool for a VPS in 2026?

restic is a strong default: open source, encrypted and deduplicated. rsync works for plain copies without history.

### Are snapshots the same as backups?

A disk snapshot on the same host is not an off-site copy. restic snapshots live on the backup server.

### How do I restore a whole server?

Reinstall the image, install restic, restore /etc, /var/www and /home, reinstall packages from the saved list, then import the dumps.

**Verdict**

- **Dump, back up with restic to another server, prune, schedule, and test a restore**: seven steps cover a VPS.
- **IronKVM sells no backups**, so a second small server in another country is a simple safety net.

## Sources

1. [Preparing a new repository](https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html) — restic (read 2026-11-16)
2. [Backing up](https://restic.readthedocs.io/en/stable/040_backup.html) — restic (read 2026-11-16)
3. [Restoring from backup](https://restic.readthedocs.io/en/stable/050_restore.html) — restic (read 2026-11-16)
4. [Removing backup snapshots](https://restic.readthedocs.io/en/stable/060_forget.html) — restic (read 2026-11-16)
5. [mariadb-dump](https://mariadb.com/kb/en/mariadb-dump/) — MariaDB Foundation (read 2026-11-16)
6. [IronKVM offshore VPS survey (CSV)](https://ironkvm.com/data/ironkvm-offshore-vps-survey-2026-11-16.csv) — IronKVM (read 2026-11-16)

**Add a backup server in another country** Billet, 1 vCPU, 2 GB RAM, 40 GB NVMe, 2 TB traffic, $4.46 a month on 12 months. [Order a backup Billet](https://ironkvm.com/app/checkout/?plan=billet&term=12m&from=guide-back-up-vps&lang=en) · [Compare the plans](https://ironkvm.com/pricing/ "IronKVM prices 2026: how much does an offshore KVM VPS cost?")

---

IronKVM: IronKVM is an offshore KVM VPS provider with servers in the Netherlands, Romania and Moldova that takes no action on DMCA takedown notices, for content that is legal in the server's country. It is paid in crypto with no ID upload and run by DomaineGoat LLC, a company registered in Panama. On the 12-month term each plan costs at least 25% less than a named comparable plan read on 16 November 2026.
