Quick answer
How do I back up a dedicated server with restic?
Install restic, store a repository password in a root-only file, run restic init against an SFTP target on another machine, then back up /etc, /home, /root and data folders nightly, piping database dumps in with --stdin. Prune with restic forget and test a restore monthly. CryptoDedicated machines from $83.69 can serve as source or target, paid in Monero.
In brief
- Off the machine: RAID 1 mirrors mistakes, so the repository must live on other hardware, ideally another city.
- SFTP backend: restic only needs SSH access to the target, no agent and no special server software.
- Encrypted at the source: the target stores ciphertext; losing the password loses the backups.
- Databases via stdin:
mysqldump | restic backup --stdingives a consistent dump without a temporary file. - Restore drill: a monthly
restic restoreof one folder proves the chain works end to end.
What should be in the backup, and what should be left out?
Back up what cannot be rebuilt from packages: configuration, data and dumps; skip caches and kernel file systems.
| Path or source | Back up? | Reason |
|---|---|---|
| /etc | Yes | Every service configuration, SSH host keys, firewall rules |
| /home and /root | Yes | User files, scripts, SSH authorized_keys |
| /var/www, /srv, /opt | Yes | Sites and applications |
| Database dump via --stdin | Yes | Consistent copy of live MySQL or PostgreSQL data |
| /var/lib/mysql or /var/lib/postgresql | No | Raw files of a running database are not consistent; use the dump |
| /proc, /sys, /dev, /run, /tmp | No | Virtual or temporary file systems |
| /var/cache, node_modules, .cache | No | Rebuilt automatically |
How do I set up restic from scratch?
Prepare the target
On the second machine, create a user such as backup with a folder /srv/restic and add the source server's SSH public key to its authorized_keys.
Install restic on the source
apt install restic; if the distribution package is old, use the static binary from the official GitHub releases instead.
Write the password file
Generate a long random password into /root/.restic-password with mode 600 and keep a copy outside both servers.
Initialise the repository
Run restic init with -r sftp:backup@TARGET:/srv/restic; this creates the encrypted structure.
Run the first backup
Back up the include list with an exclude file, then pipe each database dump in with --stdin-filename.
Schedule it
A systemd service plus a daily timer runs the same commands each night and logs to the journal.
Prune and verify
restic forget with keep rules and --prune once a week, restic check once a month, and a test restore.
apt install -y restic
restic version
head -c 48 /dev/urandom | base64 > /root/.restic-password && chmod 600 /root/.restic-password
export RESTIC_REPOSITORY=sftp:backup@TARGET:/srv/restic
export RESTIC_PASSWORD_FILE=/root/.restic-password
restic init
printf '/var/cache\n**/node_modules\n**/.cache\n' > /root/restic-excludes
restic backup /etc /home /root /var/www /srv /opt --exclude-file=/root/restic-excludes --tag files
mysqldump --single-transaction --all-databases | restic backup --stdin --stdin-filename mysql-all.sql --tag db
restic snapshots
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune
restic check
restic restore latest --tag files --target /tmp/restore-test --include /etc/nginx# restic-backup.service
[Unit]
Description=Nightly restic backup
[Service]
Type=oneshot
Environment=RESTIC_REPOSITORY=sftp:backup@TARGET:/srv/restic
Environment=RESTIC_PASSWORD_FILE=/root/.restic-password
ExecStart=/usr/bin/restic backup /etc /home /root /var/www /srv /opt --exclude-file=/root/restic-excludes --tag files
ExecStart=/bin/sh -c 'mysqldump --single-transaction --all-databases | /usr/bin/restic backup --stdin --stdin-filename mysql-all.sql --tag db'
# restic-backup.timer
[Timer]
OnCalendar=*-*-* 03:30
RandomizedDelaySec=15m
Persistent=true
[Install]
WantedBy=timers.target
# enable: systemctl daemon-reload && systemctl enable --now restic-backup.timerWhere should the restic repository live?
On different hardware, preferably in a different city, reached over SSH with a key that can do nothing but write backups. Two CryptoDedicated machines, one in Amsterdam and one in Zurich, can back each other up across two countries at the same price.
Other good targets: a home NAS with SFTP, or any S3-compatible bucket, which restic reaches with -r s3:.... A target on the same machine protects against deleted files only, not against a failed server or a reinstall that wipes both drives. To harden the target, restrict the backup user in its authorized_keys with restrict and an internal-sftp ForceCommand, so a stolen source cannot open a shell there.
How does restic compare with the backup option CryptoDedicated sells?
The paid option is the hands-off choice; restic is the flexible, encrypted, long-retention choice. Many customers run both.
- CryptoDedicated's option: Extra IPv4 $3.40 a month each (up to 8), daily backups kept 7 days for 12% of the machine price, assisted migration $59.00 once.
- restic: free software, retention as long as the target has space, encrypted with a key only the customer holds, restorable file by file.
The option is ordered as an add-on on the checkout; the terms are on extra IPv4, backups and migration. RAID 1 is no substitute for either, as the RAID 1 status guide explains.
What does a monthly restore drill look like?
Pick one folder and one database snapshot, restore them to a scratch path, and compare. restic restore latest --target / brings back a folder; restic dump latest mysql-all.sql | head shows the dump is readable.
Write the time it took next to the date. If the whole server had to come back, the order is: new machine or reinstall, the same packages, restic restore of /etc and data, then the database import, the same sequence as a VPS to dedicated migration. According to CryptoDedicated's survey of 30 October 2026, 34 of the 48 providers read sold dedicated servers; whichever host is chosen, the restore plan stays the customer's job.
Frequently asked questions
Does restic need software on the backup target?
No, only an SSH account with SFTP. restic also supports its own rest-server and S3-compatible storage.
How big will the repository get?
The first snapshot is roughly the size of the data after compression; later ones add only changed chunks thanks to deduplication.
Can two servers share one repository?
Yes. Each snapshot records its host name, and identical files across servers are stored once.
What if the restic password is lost?
The repository cannot be decrypted by anyone. Keep the password in a password manager and on paper, never only on the server.
Is the backup add-on encrypted like restic?
The add-on is run by CryptoDedicated and kept 7 days. For backups only the customer can read, encrypt them with restic before they leave the machine.
Verdict
- restic over SFTP to a second machine is the strongest free backup for a dedicated server: encrypted, deduplicated, scriptable.
- Add CryptoDedicated's daily backup option if a provider-side copy with zero setup is worth 12% of the machine price.
- A backup that was never restored is a guess: run the monthly drill.
Sources (4)
- Preparing a new repository (SFTP) — restic documentation (read 2026-11-30)
- Backing up (reading data from stdin) — restic documentation (read 2026-11-30)
- Removing backup snapshots — restic documentation (read 2026-11-30)
- systemd.timer(5) — systemd (read 2026-11-30)
A second server to hold the backups
Ryzen 9700X, 2 × 1 TB NVMe in RAID 1, any of 4 cities: $154.54 per 30 days.
- Sold by CryptoDedicated LLC, New Mexico, USA
- Machine ready within 1 hour of confirmation
- No KYC, no email required
- Downtime credited back to the balance
Read next
- IPv4, backups, migrationCryptoDedicated options at checkout: extra IPv4 at $3.40 a month (up to 8), daily backups kept 7 days, and an assisted migration paid once.
- Check RAID 1Check RAID 1 status with cat /proc/mdstat and mdadm --detail: [UU] is healthy, [U_] is degraded. Every machine has 2 NVMe drives from $83.69.
- Migrate from a VPSMigrate from a VPS to a dedicated server: lower DNS TTL, rsync files, dump databases, final sync, switch DNS. 32 GB machines from $83.69.
- PricingDedicated server prices paid in crypto: $83.69 to $869.62 per 30 days, up to 30% off on 12 months. No setup fee, no KYC.