English

Back up a Linux VPS with rsync

1 min
VPS/VDS Hosting

rsync enables efficient incremental backups over SSH. Ideal for protecting /etc, websites, databases and app files on your Infrawire Linux VPS.

📋 Prerequisites

  • Source Linux VPS, destination server/NAS with SSH and enough disk space.

Set up passwordless SSH

On the source VPS, as the user running backups:

Bash
ssh-keygen -t ed25519 -f ~/.ssh/id_backup -N "" ssh-copy-id -i ~/.ssh/id_backup.pub backup@IP_DESTINATION

First backup (test)

Example: copy /var/www and /etc to backup@DEST_IP:/backups/my-vps/:

Bash
rsync -avz --delete \ -e "ssh -i ~/.ssh/id_backup" \ /var/www/ backup@IP_DEST:/backups/mon-vps/www/ rsync -avz \ -e "ssh -i ~/.ssh/id_backup" \ /etc/ backup@IP_DEST:/backups/mon-vps/etc/

Exclude noise

Create an exclude file, e.g. /root/backup-excludes.txt:

/tmp/*
*.log
/proc/*

Utilisez : rsync -avz --exclude-from=/root/backup-excludes.txt ...

Automate with cron

Edit crontab (crontab -e) for a daily run at 3 AM:

CRON
0 3 * * * rsync -avz -e "ssh -i /root/.ssh/id_backup" /var/www/ backup@IP_DEST:/backups/mon-vps/www/ >> /var/log/backup-rsync.log 2>&1

Tips

  • Test restore regularly, not only the copy job.
  • Encrypt sensitive backups (GPG or encrypted volume on destination).
  • Monitor destination disk space and cron logs.

Protect your data! 🚀

Stay up to date with the latest offers, discounts and special promotions.

View promotions

We use cookies

We use analytics cookies to improve your experience on our site. No data is sold to third parties. Learn more in our privacy policy.