Backups and restore for your VPS

Two layers keep your data safe: our optional backups store seven daily copies of the whole server for 20% of the plan price, and your own off-server copies with restic, borg or rsync protect the files that matter most. This guide sets up both and shows how a restore actually works.

What do the optional server backups include?

When you turn on backups, the whole server disk is copied once a day and the seven most recent copies are kept, so you can return to any of the last seven days. The price is 20% of the plan: $0.85 a month on S4, which brings a 12-month term from $51.00 to $61.20. On P4 the add-on is $2.41 a month, and on D16 it is $10.39.

These copies cover everything on the disk: the operating system, packages, config files, databases and uploads. They are the fastest way back after a bad upgrade, a deleted folder or a compromised machine, because nothing needs to be reinstalled. Backups are chosen in the order form when you create the server, alongside the plan and the term.

Since a term is offered once its total reaches $40, adding backups raises the monthly figure and can make a shorter term available on some plans.

How do you restore from one of the daily copies?

Open a support ticket from the console, name the server as it appears in your server list, and give the date of the copy you want. For example: "Please restore web1 to the copy from 2 December." Support confirms in the same ticket when the restore is done.

A restore returns the whole disk to that day, so anything written after the copy, such as new orders in a shop database or files uploaded since, is replaced. If you need both, ask in the ticket for the copy and plan to pull recent data from your own off-server backup afterwards. Before you ask, note the exact time the problem started, check journalctl --since "2 days ago" or your app logs to pick the right day, and stop writing new data if you can.

Keep in mind that a rebuild or a delete from the console wipes the disk. If something goes wrong, ask for a restore first, before you rebuild.

Why keep your own copies as well?

Server copies live with us and protect against mistakes on the server. Your own copies cover everything else: an account key you lose, a server removed after an unpaid renewal (it is kept 14 days, then removed with its backups), a bug you notice after more than seven days, or simply the wish to move data to another machine. The common rule is three copies, on two kinds of storage, with one far away. In practice: the live server, our daily copies, and a restic or borg repository on a second machine in another city or at home.

A second server just for backups can be small. An S4 with 2 vCPU, 4 GB RAM, 40 GB NVMe in Helsinki or Nuremberg costs $4.25 a month and holds many compressed, deduplicated snapshots of a typical website.

How do you dump databases before backing up files?

Copying the raw files of a running database can capture a half-written state. Dump it to a file first, then let the backup tool pick up the dump. For MariaDB and MySQL:

mkdir -p /var/backups/db
mysqldump --single-transaction --routines --all-databases | gzip > /var/backups/db/mysql.sql.gz

--single-transaction takes a consistent snapshot of InnoDB tables without locking the site. For PostgreSQL:

sudo -u postgres pg_dumpall | gzip > /var/backups/db/postgres.sql.gz

For a SQLite file, use sqlite3 app.db ".backup /var/backups/db/app.db". Check the dump is not empty with ls -lh /var/backups/db and, for SQL, zcat mysql.sql.gz | tail -n 3, which should end with a "Dump completed" line.

How do you back up with restic to another server?

restic encrypts, deduplicates and compresses every snapshot, and it can talk to any machine you reach over SSH. Install it with apt install -y restic, or on Rocky and Alma with dnf install -y epel-release && dnf install -y restic. Create the repository once, using an SSH alias for the backup host:

export RESTIC_REPOSITORY=sftp:backup@203.0.113.20:/srv/restic/web1
export RESTIC_PASSWORD_FILE=/root/.restic-pass
restic init

Store the password file with chmod 600, and keep a copy of it somewhere other than the server: without it the repository cannot be read. Then a nightly run backs up, thins out old snapshots and checks the repository:

restic backup /etc /var/www /home /var/backups/db --exclude-caches
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
restic check

Put those lines in /usr/local/bin/backup.sh with the two exports at the top, and run it from cron with 15 3 * * * root /usr/local/bin/backup.sh in /etc/cron.d/backup. restic snapshots lists what you have.

What about borg or plain rsync?

BorgBackup works much like restic and is very fast on large trees of files. On the backup host it only needs borg installed; on your server:

borg init --encryption=repokey backup@203.0.113.20:/srv/borg/web1
borg create --stats --compression zstd backup@203.0.113.20:/srv/borg/web1::{now} /etc /var/www /var/backups/db
borg prune --keep-daily 7 --keep-weekly 4 backup@203.0.113.20:/srv/borg/web1

Export the key with borg key export and keep it offline. rsync is the simplest option when you want a plain mirror you can browse without any tool:

rsync -aHAX --delete --numeric-ids /var/www/ backup@203.0.113.20:/srv/mirror/web1/www/

A mirror is not a history: a file deleted on the server disappears from the mirror at the next run because of --delete. Use rsync for convenience and restic or borg for versions.

How do you prove that a backup can be restored?

Restore something on a schedule, not only when disaster strikes. With restic, pull a single file into a temporary folder and compare it:

restic restore latest --target /tmp/restore-test --include /etc/nginx/nginx.conf
diff /etc/nginx/nginx.conf /tmp/restore-test/etc/nginx/nginx.conf

No output from diff means the copies match. Once a month, go further: restore the database dump into a scratch database with zcat mysql.sql.gz | mysql on a test server and open a few pages of the app. A small test server for an hour is cheap insurance; delete it afterwards or reuse it as your next backup target.

What should a written restore plan say?

Write down, in a text file kept outside the server, where each copy lives and the exact steps to get it back: which server name to quote in the support ticket, the restic repository URL, where the repository password and the borg key are stored, and which services to stop before restoring. During an outage, that page saves more time than any tool. Update it whenever you add a new database or move a site to another server.

Questions about this guide

Can I turn backups on for a server that is already running?

Backups are chosen in the order form when the server is created. For a running server without them, set up restic or borg off the server as shown above, or open a support ticket to ask about your options.

How far back can I restore?

Seven days: one copy per day for the last seven days. For older history, keep your own restic or borg repository with weekly and monthly snapshots.

Can I download one of the daily copies?

Restores are done by support onto your server. To keep a copy you can download at any time, use your own tool, such as restic, borg or rsync, to a machine you control.

Are backups kept after I delete the server?

No. Deleting a server removes it and its copies. Pull everything you need to another machine first; unused prepaid time is also not paid back on early delete.

How much do backups add to a yearly order?

On S4, the 12-month term is $51.00 without backups and $61.20 with them. Every plan page shows the add-on for that size.

Do snapshots exist as a separate feature?

No. The daily copies are the server backup feature. For a manual point-in-time copy before a risky change, run your own restic backup and dump the databases first.