Docs / Backup & Recovery / How to Back Up Your Server with rsync

How to Back Up Your Server with rsync

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 209 views · 1 min read

rsync efficiently copies files between your server and a backup destination.

Basic Backup

rsync -avz /var/www/ /backup/www/

Remote Backup

rsync -avz -e ssh /var/www/ backup@remote-server:/backups/www/

Exclude Files

rsync -avz --exclude='*.log' --exclude='node_modules' /var/www/ /backup/www/

Automated with Cron

crontab -e\n0 2 * * * rsync -avz --delete /var/www/ backup@remote:/backups/www/ >> /var/log/backup.log 2>&1

Flags Explained

  • -a archive mode (preserves permissions, timestamps)
  • -v verbose
  • -z compress during transfer
  • --delete remove files at destination that no longer exist at source

Was this article helpful?