Backup/migrate your system and data easily with rsync and rdiff-backup
rsync is the best utility for mirroring. rdiff-backup is very convenient for versioning in addition to mirroring, it is like a time machine which let you rollback your data state to any previous backup done and it keeps only data difference on the disk saving a lot of disk space for you.
I have created two scripts for uniform and convenient (IMHO of course) execution of above utilities. http://www.aulix.com/rsync-and-rdiff-backup-utils Both of them together with file sys_dirs.txt should be installed (copied) to /utils/ directory. sys_dirs.txt contains system directories excluded by default during system backup.
rsync.sh - a script for easy rsync operation
Syntax: /utils/rsync.sh OPERATION SRC [DEST] [NATIVE_OPTIONS]
SRC and DEST should look like [[USER@]HOST:]DIR
rback.sh - a script for easy rdiff-backup operation
Syntax: /utils/rback.sh OPERATION SRC [DEST] [NATIVE_OPTIONS]
SRC and DEST should look like [[USER@]HOST::]DIR
Both scripts expect following values for OPERATION argument:
system - backup excluding directories specified in sys_dirs.txt. It is useful for whole operation system backup.
data - backup data. Usefull when copying from ext3 to another ext3 partition.
data_ntfs - backup data without permissions and omitting hard links
compare - compares source and destination (dry-run)
verify - verifies rdiff-backup checksums
NATIVE_OPTIONS let specify additional options corresponding to rsync or rdiff-backup respectively
You can find more options inside scripts by yourself. Please note that delete and delete-excluded options are not used by default to avoid destination corruption by accidental mistake. RSync works better over sometimes unreliable internet channel. It is preferred to use RBack only in your local network or inside a single host.
1. Backup a remote VPS system to your local /mnt/data/backup/vps/ directory:
/utils/rsync.sh system yourvps.com:/ /mnt/data/backup/vps/ -vi --exclude=/var/swap --delete --delete-excluded
2. Local server with a boot partition backs itself up to a remote storage-host:
/utils/rsync.sh system / $BackupTo -vi --delete --delete-excluded
/utils/rsync.sh data /boot $BackupTo -vi --delete
3. Script executed on storage-host to keep each version of your server1 backup on the same storage-host:
/utils/rback.sh data /mnt/data/backup/server1 /mnt/data/backup/server1.versions