Using rsync as an incremental backup

Larry Irwin mkitwrk at
Fri Jun 24 14:34:10 MDT 2011

  We handle it via 2 scripts.
One script (on the server side) does daily rotations mid-morning on 
successfully completed rsyncs from the night before.
(i.e. removes daily.7, moves daily.6 to daily.7, etc... - if the rsync 
was successful)
The client side always sends to "daily.0" and uses the "daily.1" folder 
as the link-dest.
To make the rsync as "completed successfully", the client script parses 
the log and uses sftp to send a summary file to the "daily.0" folder.
The server side script checks the content of that summary file to see if 
it should nuke "daily.7" and proceed with the rotation.
I'm using a heavily modified version of the rsyncsnapshot scripts with 
automated email reporting from both client and server sides.

On 6/24/2011 10:38 AM, Carlos Carvalho wrote:
> Scott Baker (scott at wrote on 23 June 2011 15:30:
>   >I'm using rsync to do an incremental backup of my desktop here, to a
>   >remote server as follows:
>   >
>   >#/usr/bin/bash
>   >
>   >old=$(date -d 'now - 1 week' +%Y-%m-%d)
>   >new=$(date +%Y-%m-%d)
>   >
>   >rsync -avP --delete --link-dest=../$dir /home/bakers
>   >bakers at$new/
>   >
>   >This is actually working GREAT! The only problem is that sometimes the
>   >cronjob won't complete (internet is down, something like that). When it
>   >tries to run the next week it does --link-dest against a dir that
>   >doesn't exist. It happily complies and transfers EVERY file because
>   >there is no source to hardlink from.
>   >
>   >I'd really like rsync to exit and throw an error if the --link-dest
>   >isn't present. I can't find anything in the man page about any fancy
>   >--list-dest options. Am I missing it?
> You should handle it in your script. You can pass several directories
> with link-dest and rsync will search for the file in all of them, in
> the order you gave. If it doesn't find one for hardlinking it pulls
> the file through the net.
> We do it here in our backup script to avoid useless copying, both when
> the backup machine starts the process and when the source of the files
> starts it.

More information about the rsync mailing list