[RSync] Re: How to delete files older than X on backup during sync?

Henri S henri at stmargarets.school.nz
Mon Nov 10 11:25:10 GMT 2008


>    1. delete the oldest backup (.7)
>    2. Increment all the other backups +1
>       (.6 -> .7, .5 -> .6, .4 -> .5, .3 -> .4, and .2 -> .3)
>    3. Create a hard link between .1 -> .2
>    4. Run rsync from the source into .1

This is esentially what LBackup is doing.

The LBackup project also supports various monitoring options. The
reporting features are a good reason to look at the LBackup project. As
there is no point in automating a backup, if you are not able to ensure it
is working correctly.

That said, you can certainly setup a notification system for a backup
script of your own creation.

Configuration of a basic backup is less than 10 minutes and there are some
screen casts online to help you get started.

Help with the LBackup project is warmly welcomed. Currently, anyone is
able create an account and improve the documentation.

Please keep in mind that the project is still in it's infancy.

Visit http://www.lucidsystems.org/tools/lbackup to download or help out
with the project.

>
>    This is rather similar to what I'm currently doing via a (shell) 
>script which uses rsync.  I have several servers that get backed up 
>every night, using a combination of hard links and multi-day retention.  
>Basically, let's say I want to keep a 7 day backup on a server, the 
>nightly process runs as follows:
>
>    1. delete the oldest backup (.7)
>    2. Increment all the other backups +1
>       (.6 -> .7, .5 -> .6, .4 -> .5, .3 -> .4, and .2 -> .3)
>    3. Create a hard link between .1 -> .2
>    4. Run rsync from the source into .1
>
>    So if a file disappears from the source, it still exists in backup 
>for another 6 days after that night's backup.  After that, it gets
>deletedt.
>
>    This process allows me to backup 15 different servers to one single 
>terabyte drive and keep 4 weeks worth of backup for each.  (NOTE: I'm 
>not backing up 100% of each server's content, just things like /etc, 
>/home, /var/www, /var/mail and the like.)

>> You could find these files using find. Then, copy these to another
>> directory and sycn the directory which has only the new files.
>> If you were cleaver you could hard link the files to save space before
>t he
>> sync. But maybe someone on this list will know how to do this with just
>> rsync.
>>
>> This is just one possiblity. Maybe somone has already written a tool to
>>do
>> the first step.



More information about the rsync mailing list