The rsync does transfer of file by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand. At
first glance this may seem impossible because the calculation of diffs between two files normally requires local access to both files.
1. Setting up the rsync server
- Edit the file /etc/xinit.d/rsync where the yes is changed to no.
disabled = no
- Restart the rsync service
service rsync restart
chkconfig rsync on
- Ensure that the firewall allows rsync through
- Ensure that clients can ssh to the server
- Login to the localhost and open a terminal. Type the command
rsync -avz --delete --timeout=999 -e ssh /home/nicholas/documents/ email@example.com:/mnt/backup/
- -a is to archive
- -v is verbos
- -z is to compress
- -e is to use a secure SSH instead of rsh connection
- --delete to remove any files on server that does not exist locally
- Type the password for the user nicholas when requested for password.
- To create a file to store the filter rules, open up a text editor. The format of the file is
Where RULE + (plus) means include and - (minus) is exclude. An ** means include into sub directories. Example create a file called mylist.txt with the contents as below.
- To make rsync recursively find files in /home based on the rules in mylist.txt
rsync -avz --exclude-from=mylist.txt --timeout=999 -e ssh /home firstname.lastname@example.org:/mnt/backup
I will add more details on other aspects of rsync when I have more time. This includes public/private key pair and automated backup.