Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to run an rsync job which connects to one server and backs everything up to another. These backups should be incremental and we don't want to delete any files.

Any ideas?

share|improve this question

migrated from Mar 24 '11 at 15:47

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

Check out rdiff-backup and duplicity. Both are for exactly what you want, duplicity also adds encryption layer.

You can do this also with rsync alone, but then you are not saving old versions at all.

rsync -az /local/folder -e ssh username@remote_host:/backup/folder

backups files from /local/folder to remote host. Most probably you want to setup public key authentication, otherwise you have to enter your password each time.

You can put commands to crontab with command crontab -e. Something like

12 03 * * * your_commands
share|improve this answer
Thanks, I'll have a look at rdiff-backup looks like it'll do the trick – Tom Mar 24 '11 at 14:56

set something like this to run on a cron job and it'll make incremental backups with rsync via SSH:

rsync -azvr --rsh="ssh -l theusername -p 22" your.remote.ip.address.or.domain:/remote/path/ /local/path/on/backup/machine/

azvr meaning archive, compress, verbose and go recursively into directories, plus this gives the option of running on a different port (which I had a hard time finding an answer to), plus it saves files on the backup that you later delete on the original

share|improve this answer
What happens if the connection goes down half way though a large file or an entire job, is rysnc smart enough to carry on? – Tom Mar 24 '11 at 14:55
@Tom: yes, it's. Whole point of rsync is incremental transfers. – Olli Mar 24 '11 at 14:58
So will rsync actually detect that the connection is broken, wait a little while and restart or do I just run the same command again and it'll pick where it left of? – Tom Mar 24 '11 at 15:07
If it's on a cron job, it'll just pick it up again when your cron comes around again. But yeah, it'll pick up where it left off. I believe it's a byte-level copy so it'll detect the differences between files so it'll pick up where it left off. – jpea Mar 24 '11 at 15:10

You may want to look at backuppc which will do rsync backups. It can be configured for incremental and full backups. After the first backup, transfers are incremental. There is a good web-based interface for querying status, backups, and doing recoveries.

share|improve this answer

rsync have many powerfull options. check this link


rsync -avz --progress --stats -e ssh /home

Don'f forget to create SSH keys.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.