VPS Snaps

How to back up a Hetzner Cloud Volume (server backups and snapshots skip it)

If your app keeps its uploads, media or database files on a Hetzner Cloud Volume, turning on Backups or taking Snapshots does not protect that data. Hetzner's own FAQ says Backups and Snapshots do not include any Volumes attached to the server. This guide shows how to find what is on the Volume, back it up with restic to S3-compatible storage every night, and restore it onto a fresh Volume when you need it.

What Hetzner backs up, and what it does not

DataServer BackupsSnapshotsWhat protects it
Server root diskYes, 7 slots, oldest deleted firstYes, kept until you delete themBackups or Snapshots
Attached VolumeNoNoYour own file-level backup
Database files on a VolumeNoNoA database dump, then a file-level backup

Hetzner stores every Volume block on three physical servers. That protects you from a failed disk, not from a deleted folder, a bad migration, ransomware or a deleted Volume: those changes are copied three times too. A backup is a separate copy you can go back to.

Find the Volume and what is on it

Terminal
lsblk -So NAME,MODEL,SERIAL
lsblk -o NAME,SIZE,MOUNTPOINT
df -h
sudo du -sh <volume-path>/*

The first command comes from Hetzner's Volumes FAQ: the MODEL column identifies Volumes. The second shows where each disk is mounted. In the rest of this guide, <volume-path> is that mount point, for example a directory under /mnt.

If PostgreSQL, MySQL or another database keeps its data directory on the Volume, copying those files while the database runs can give you a backup that will not start. Dump the database to a file first, for example with pg_dump or mysqldump, and back up the dump.

Set up restic and a bucket

These steps are for Ubuntu 24.04 or Debian 12, using the restic package from the distribution. You need an S3-compatible bucket and an access key for it. For a copy that survives a problem with your Hetzner account, use a bucket with another provider, such as Backblaze B2 or Cloudflare R2. Hetzner Object Storage also works.

Terminal
sudo apt update
sudo apt install restic
sudo sh -c 'openssl rand -base64 32 > /root/.restic-volume.pass'
sudo chmod 600 /root/.restic-volume.pass
/root/.restic-volume.env
export RESTIC_REPOSITORY="s3:https://<s3-endpoint>/<bucket-name>"
export RESTIC_PASSWORD_FILE="/root/.restic-volume.pass"
export AWS_ACCESS_KEY_ID="<access-key-id>"
export AWS_SECRET_ACCESS_KEY="<secret-access-key>"
# Only if your provider needs a region other than us-east-1:
# export AWS_DEFAULT_REGION="<region>"
Terminal
sudo chmod 600 /root/.restic-volume.env
sudo sh -c '. /root/.restic-volume.env && restic init'

For S3-compatible services other than Amazon, restic expects the s3:https://server/bucket form. On Amazon S3 itself, use the regional endpoint, for example s3:s3.us-east-1.amazonaws.com/<bucket-name>.

restic encrypts everything with the password in /root/.restic-volume.pass. If you lose it, the backups cannot be read by anyone, including you. Store a copy in your password manager now, not on the same server.

Run the first backup

Terminal
sudo sh -c '. /root/.restic-volume.env && restic backup <volume-path> --tag hetzner-volume'
sudo sh -c '. /root/.restic-volume.env && restic snapshots'

The first run uploads everything. Later runs only upload changed data, so they are much faster. restic snapshots should list one snapshot with your Volume path and the hetzner-volume tag. To skip caches or temporary files, add --exclude patterns or --exclude-file=<file>.

Schedule it with cron

/usr/local/bin/volume-backup.sh
#!/bin/sh
set -e
. /root/.restic-volume.env
restic backup <volume-path> --tag hetzner-volume
restic forget --tag hetzner-volume --keep-daily 7 --keep-weekly 5 --keep-monthly 12 --prune
/etc/cron.d/volume-backup
20 3 * * * root /usr/local/bin/volume-backup.sh >> /var/log/volume-backup.log 2>&1
40 4 * * 0 root . /root/.restic-volume.env && restic check >> /var/log/volume-backup.log 2>&1

Make the script executable with sudo chmod +x /usr/local/bin/volume-backup.sh. Each night it backs up the Volume, then keeps 7 daily, 5 weekly and 12 monthly snapshots and deletes the data no snapshot needs any more. The restic docs advise running restic check after pruning, so the second line checks the repository every Sunday.

Read /var/log/volume-backup.log after the first scheduled night. A cron job that fails quietly is the most common way a backup stops without anyone noticing. Backup failure alerts shows how to get told.

Restore onto a new Volume

  1. In the Hetzner Console, open Volumes, choose Create Volume, pick the same location and server, a size at least as large as the data, automatic mounting and EXT4.
  2. Find the new mount point with lsblk -o NAME,SIZE,MOUNTPOINT. Below it is <new-volume-path>.
  3. Restore the latest snapshot into a temporary folder on the new Volume, copy the files into place, and remove the folder.
Terminal
sudo sh -c '. /root/.restic-volume.env && restic restore latest --tag hetzner-volume --target <new-volume-path>/.restore'
sudo cp -a <new-volume-path>/.restore<volume-path>/. <new-volume-path>/
sudo rm -rf <new-volume-path>/.restore

restic recreates the original path under the target, which is why the copy reads from .restore followed by the old Volume path. For example, if the old Volume was mounted at /mnt/data, the files are in <new-volume-path>/.restore/mnt/data/. During the copy the data briefly takes twice its size, so make the new Volume large enough. Then point your app, or its mount entry in /etc/fstab, at the new Volume.

To restore a single folder instead, add --include, for example --include <volume-path>/uploads, and use restic ls latest to find the exact path first.

Test a restore without touching production

Terminal
sudo sh -c '. /root/.restic-volume.env && restic restore latest --tag hetzner-volume --target /tmp/restore-test --include <volume-path>/<some-folder>'
sudo diff -r <volume-path>/<some-folder> /tmp/restore-test<volume-path>/<some-folder> && echo 'restore matches'
sudo rm -rf /tmp/restore-test

Pick a folder that does not change every minute, so the comparison is fair. If diff prints nothing and you see restore matches, the backup can be read and decrypted with the password you saved. Do this once a month, and after any change to the script. How to test a backup restore covers a full rehearsal.

Frequently asked questions

Do Hetzner Cloud Backups include attached Volumes?
No. Hetzner's Backups and Snapshots FAQ says they do not include any Volumes attached to the server. You need a separate backup of the Volume's files.
Is triple replication on Hetzner Volumes a backup?
No. It keeps the Volume online when a physical disk fails, but deletions, corruption and ransomware are replicated as well. A backup is a separate copy with history you can restore from.
Can I keep the restic repository on a Hetzner Storage Box?
Yes. restic supports SFTP repositories, and Hetzner Storage Box backups shows the setup. A bucket with another provider gives you a copy outside Hetzner as well.
How much space does the backup need?
The first snapshot is roughly the size of the data after compression and deduplication. Later snapshots only add changed data, so the repository grows slowly unless files change a lot.

How this was checked

Commands, limits and prices were checked against these official pages, on November 9, 2026: