Backups are essential for protecting your data against accidental deletion, corruption, or hardware failure. rsync is a powerful tool that synchronizes files and directories between locations. This guide explains how to set up automatic backups with rsync on Ubuntu servers.
sudo apt update
sudo apt install rsync -y
rsync -avz /source /backup
This copies files from /source to /backup with compression and verbose output.
rsync -avz /source user@remote-server:/backup
This synchronizes files to a remote HostPalace server via SSH.
Edit cron jobs:
crontab -e
Add a daily backup at midnight:
0 0 * * * rsync -avz /source /backuprsync -avz --exclude='*.log' /source /backup
This excludes log files from the backup.
rsync --dry-run -avz /source /backup
This simulates the backup without making changes.
Note: HostPalace servers support rsync-based backups, making it easy to protect client data across multiple locations.