Why Automated Backups Are Non-Negotiable for VPS Administrators
Data loss on a VPS is not a question of if but when. Hardware failures, accidental deletions, ransomware attacks, and software bugs all threaten server data. A 2024 survey found that 40% of small-to-medium businesses that suffer major data loss never fully recover. Automated, tested backups are the only reliable defense.
This article compares three leading open-source backup tools — rsync, BorgBackup, and Restic — for VPS data protection. Each offers different trade-offs in speed, storage efficiency, encryption, and restoration simplicity. We evaluate each tool against real-world VPS scenarios including databases, application files, and configuration directories.
rsync: The Veteran File Synchronizer
rsync has been the backbone of Unix file transfers for decades. It uses the rsync algorithm to transfer only the differences between source and destination files, making incremental backups fast and bandwidth-efficient.
Strengths: Universally available on every Linux distribution. Extremely fast for initial backups and filesystem-level restores. Supports SSH encryption natively. Simple to script with cron.
Weaknesses: No built-in deduplication across snapshots. No compression. No native encryption (relies on SSH tunnel). Not atomic — a backup taken during a write can be inconsistent. Manual scripting required for rotation and retention policies.
Basic rsync Backup Script
#!/bin/bash
# /usr/local/bin/rsync-backup.sh
BACKUP_DIR="/backup/$(date +%Y-%m-%d)"
mkdir -p "$BACKUP_DIR"
# Backup critical directories
rsync -avz --delete --link-dest=/backup/latest /etc/ "$BACKUP_DIR/etc/"
rsync -avz --delete --link-dest=/backup/latest /var/www/ "$BACKUP_DIR/www/"
# Database dump before backup
mysqldump --all-databases > /tmp/alldb.sql
rsync -avz /tmp/alldb.sql "$BACKUP_DIR/database/"
# Update latest symlink
rm -f /backup/latest
ln -s "$BACKUP_DIR" /backup/latest
Best for: Simple file-level backups where you need full files restored without any tool-specific format. Excellent for off-site replication to a second VPS.
BorgBackup: Deduplication and Compression Powerhouse
BorgBackup (Borg) is a deduplicating backup tool that splits files into chunks and stores each chunk only once, even across multiple backups. Combined with LZ4 or ZSTD compression, Borg can reduce storage requirements by 80–95% compared to uncompressed rsync copies.
Strengths: Content-defined chunking for cross-file deduplication. Built-in compression (zstd recommended). Authenticated encryption with AEAD. Append-only mode for ransomware protection. Mountable backup archives via FUSE for easy restoration. Prune and compact commands for automatic retention management.
Weaknesses: Repository format is Borg-specific — requires Borg to restore. Initial backup is CPU-intensive due to chunking. Slightly more complex setup than rsync. Not suitable for real-time sync (designed for periodic snapshots).
Borg Backup Configuration
#!/bin/bash
# /usr/local/bin/borg-backup.sh
export BORG_REPO="/backup/borg-repo"
export BORG_PASSPHRASE="your-strong-encryption-key"
# Create backup
borg create --verbose --filter AME --list --stats --show-rc --compression zstd,8 --exclude-caches --exclude '/var/cache/*' --exclude '/var/tmp/*' ::'{hostname}-{now:%Y-%m-%d_%H:%M}' /etc /var/www /var/lib/mysql
# Prune old backups (keep 7 daily, 4 weekly, 6 monthly)
borg prune --list --show-rc --keep-daily 7 --keep-weekly 4 --keep-monthly 6
# Compact freed space
borg compact
Best for: Long-term retention on limited storage. Servers where backup storage costs matter (small VPS plans, cheap object storage). Environments requiring encrypted off-site backups.
Restic: Cloud-Native Encrypted Backups
Restic is a modern backup tool designed from the ground up for cloud storage backends — S3, Backblaze B2, Google Cloud Storage, Azure Blob, and SFTP. Like Borg, it uses content-defined chunking and deduplication, but Restic emphasizes simplicity and broad backend support.
Strengths: Supports 10+ storage backends with a unified interface. Built-in AES-256-GCM encryption with key-based or password-based access. Automatic deduplication across all snapshots. Very fast restore — can restore individual files or entire snapshots. Immutable snapshots with append-only repositories. Self-healing via check command and data integrity verification.
Weaknesses: Slightly less compression efficient than Borg on highly redundant data. No built-in prune scheduling (must script it). Restic format is not mountable natively on all platforms.
Restic to Backblaze B2 Example
#!/bin/bash
# /usr/local/bin/restic-backup.sh
export RESTIC_REPOSITORY="b2:mybucket-vps-backups"
export RESTIC_PASSWORD="your-backup-encryption-key"
export B2_ACCOUNT_ID="your-b2-key-id"
export B2_ACCOUNT_KEY="your-b2-application-key"
# Create snapshot
restic backup --verbose --exclude '/var/cache/*' --exclude '/tmp/*' --exclude '*.log' /etc /var/www /var/lib/mysql
# Forget old snapshots (keep 7 daily, 4 weekly, 12 monthly)
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune
# Verify repository integrity weekly
if [ "$(date +%u)" = "7" ]; then
restic check --read-data
fi
Best for: Off-site backups to cloud object storage. Multi-server environments with a centralized backup repository. Compliance scenarios requiring encryption at rest and in transit.
Head-to-Head Comparison
| Feature | rsync | BorgBackup | Restic |
|---|---|---|---|
| Deduplication | No (per-file hardlink) | Yes (content-defined chunks) | Yes (content-defined chunks) |
| Compression | No (uses SSH) | zstd, LZ4, LZMA | None built-in (repo-level) |
| Encryption | SSH tunnel only | AEAD (keyfile/password) | AES-256-GCM |
| Cloud backends | SSH/rsync daemon only | Local, SSH, FUSE | S3, B2, GCS, Azure, SFTP, local |
| Restore speed | Fastest (file-level) | Fast (FUSE mount) | Fast (mount or restore) |
| Incremental speed | Very fast (delta sync) | Fast (chunk-level) | Fast (chunk-level) |
| Storage efficiency | Low (full copies) | Very high (dedup+compression) | High (dedup) |
| Learning curve | Low | Medium | Low-Medium |
Recommended Strategy: Layered Backups
The most resilient VPS backup architecture uses multiple tools together:
- Daily Borg/restic snapshots (local VPS storage or NFS) — fast recovery for common restore scenarios
- Off-site restic to cloud object storage — ransomware protection (append-only) and disaster recovery
- Weekly rsync to a second VPS — bare-metal file access without needing backup tool dependencies
- Nightly mysqldump + pg_dump database dumps — application-level consistent backups separate from file snapshots
Regularly test restores — a backup that has never been restored is not a backup. Schedule quarterly restore drills where you spin up a fresh VPS and restore your entire stack from scratch. Time the process and document any missing steps.
For VPS plans with sufficient storage and compute to support comprehensive backup strategies, check the best VPS providers for reliable backups and choose one with generous included storage and fast network uplinks.

Leave a Reply
You must be logged in to post a comment.