Data loss on a VPS can come from many sources — both preventable and unpreventable: hardware failure, ransomware, human error (accidental deletion), or OS corruption after a failed upgrade.
Sobering statistics from data security research:
AsiaGB VPS includes twice-monthly automated backups (on the 1st and 15th of each month) as a provider-level safety net. But for data that changes daily, you need your own backup strategy on top of that.
The 3-2-1 Rule is an industry-standard approach used worldwide:
| Number | Meaning | Example |
|---|---|---|
| 3 | 3 copies of your data | Live data + local backup + remote backup |
| 2 | 2 different media types | SSD (VPS) + Object Storage (S3/R2) |
| 1 | 1 copy offsite | Cloudflare R2, Backblaze B2, or another VPS |
| Type | How It Works | Storage | Restore Speed | Best For |
|---|---|---|---|---|
| Full Backup | Copies every file each time | High | Fast | Weekly backup, initial baseline |
| Incremental | Copies only what changed since the last backup | Very low | Slower (chain needed) | Daily backup |
| Differential | Copies everything changed since the last Full | Medium | Medium | When fast restore matters |
| Tool | Strengths | Best For | Difficulty |
|---|---|---|---|
| rsync | Ships with Linux, no install needed, SSH support | Beginners, simple backups | ⭐ Easy |
| BorgBackup | Deduplication, encryption, compression | Production VPS, storage efficiency | ⭐⭐ Medium |
| Restic | Native S3/B2/R2 support, fast, cross-platform | Cloud Storage backends | ⭐⭐ Medium |
| Duplicati | GUI, encrypted, cloud-ready | Users who prefer a web UI | ⭐ Easy |
| mysqldump / pg_dump | Built-in database tools | Database-specific backup | ⭐ Easy |
rsync is the best starting point — no dependencies, and easy to understand.
# On your VPS, create a key pair
ssh-keygen -t ed25519 -C "backup-key" -f ~/.ssh/backup_key -N ""
# Copy public key to backup server
ssh-copy-id -i ~/.ssh/backup_key.pub user@backup-server
#!/bin/bash
# /usr/local/bin/vps-backup.sh
DATE=$(date +%Y-%m-%d)
BACKUP_USER="backup"
BACKUP_HOST="backup-server.example.com"
BACKUP_PATH="/backups/myvps/$DATE"
LOG="/var/log/backup.log"
echo "[$DATE] Starting backup..." >> $LOG
rsync -avz --delete \
-e "ssh -i /root/.ssh/backup_key -o StrictHostKeyChecking=no" \
/var/www/ /etc/ /home/ \
$BACKUP_USER@$BACKUP_HOST:$BACKUP_PATH/ >> $LOG 2>&1
if [ $? -eq 0 ]; then
echo "[$DATE] Backup completed successfully" >> $LOG
else
echo "[$DATE] Backup FAILED!" >> $LOG
fi
# crontab -e
# Run every night at 2:00 AM
0 2 * * * /usr/local/bin/vps-backup.sh
--exclude='/proc' --exclude='/sys' --exclude='/dev' --exclude='/tmp' to skip virtual filesystems and keep backup size lean.
BorgBackup is ideal for VPS servers that need long backup history without ballooning storage costs. Its deduplication system stores identical data only once, typically saving 40–60% on storage.
# Install
apt install borgbackup -y
# Initialize repository (once)
borg init --encryption=repokey user@backup-server:/backups/borg-repo
# Create backup
borg create --stats --progress \
user@backup-server:/backups/borg-repo::$(date +%Y-%m-%d) \
/var/www /etc /home
# List all archives
borg list user@backup-server:/backups/borg-repo
# Restore a single file from specific date
borg extract user@backup-server:/backups/borg-repo::2026-09-20 \
var/www/html/important.php
# Keep 7 daily, 4 weekly, 6 monthly archives
borg prune --keep-daily=7 --keep-weekly=4 --keep-monthly=6 \
user@backup-server:/backups/borg-repo
| Data Type | Recommended Frequency | Best Method |
|---|---|---|
| Database (MySQL/PostgreSQL) | Every 4–6 hours or daily | mysqldump + cron |
| File uploads / user content | Daily | rsync incremental or Restic |
| Config files (/etc) | Before every change + weekly | git + rsync |
| Application code | Every deploy | Git repository is the primary backup |
| System snapshot | Weekly | VPS Snapshot from provider |
mysqldump --single-transaction for InnoDB tables to get a consistent snapshot without table locks. Never copy raw .ibd files while MySQL is running.
Having a backup without testing restore is like buying insurance without reading the policy — you don't know if it actually works until disaster strikes.
mysqldump --single-transaction for a consistent, lock-free snapshot. For PostgreSQL, pg_dump is safe by design. Both work safely on live production databases.