Get a VPS now!

InfrawireInfrawire LogoDocumentation
Appeler

Back up a Linux VPS with rsync

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
1rsync -avz --delete \ 2 -e "ssh -i ~/.ssh/id_backup" \ 3 /var/www/ backup@IP_DEST:/backups/mon-vps/www/ 4 5rsync -avz \ 6 -e "ssh -i ~/.ssh/id_backup" \ 7 /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! 🚀

Need help?

Questions about this guide? Our team and community are here to help.

Our team is available 24/7 to help you · Join our community