Last Updated: February 25, 2016
·
1.12K
· pmaoui

Backup your data with RSYNC

Rsync synchronizes your local and offsite filesystems by transferring only the changed portions of files. After your initial upload, each subsequent upload will be very fast, as only the differences in the files are sent.

Server side

/etc/default/rsync :

RSYNC_ENABLE=true

/etc/rsyncd.conf :

uid=root
gid=root
log file = /var/log/rsync.log

[backup_apache]
path = /home/user/apache 
hosts allow = ip1 ip2 etc
comment = Sync Backup 
read only = true
auth users = user
secrets file = /etc/rsyncd.scrt 
(secrets file = user:********)

Client side

Typical usage :

rsync -av --stats user@remote.com::backup_apache/sub/ ~/backup/

with :

-a : typical for backup: recursivity, file owners, timestamps, and access permissions
--delete : delete files (useful for sync)
--stats : display some statistics at the end
--progress : display progression
--files-from=onlythosefiles.txt 

onlythosefiles.txt contains line by line files and folders (if you use --files-from with -a, you will have to add -r for the recursivity).

You can exclude several files or folder :

--exclude=".DS_Store" --exclude=".swp" --exclude=".Trash" --exclude="logs/*"

 DeltaCopy (windows)

If you have permissions problem, put in deltacd.conf:

incoming chmod = Dug=rwx,o-x,Fug=rw,Fo-x