backup changed files only.
Trying to work out whether the following is possible.
Day 1: Backup all files Day 2: Backup only those files changed from Day 1 Day 3: Backup only files changed from Day 2 Day 4: etc... Day 8: Full backup... Therefore to get back to Day 3 you restore your Day 1, 2 and 3 backups in sequence. rsync --backup seems to do the reverse of what I want - i.e. I get a folder with all the Day 1 files, a folder with Day 1 + Day 2 files, a folder with Day 1, Day2 + Day 3 files... Any pointers? |
I use Backuppc to do just this. It utilizes rsync as well.
|
There are similar cases to this on the rsync examples page: http://rsync.samba.org/examples.html
Or an alternative approach described here: http://www.mikerubel.org/computers/r...s/#Incremental |
I can only get the the rsync examples to do the reverse of what I want.
For example if files have not changed over the week, then I get 7 copies of same file (1 in each incremental folder). I only want those files in the Day 1 backup. Will check the other suggestions. |
Which method do you use?
|
Code:
BACKUPDIR=~/test/backups/`date +%R:%S` If you run the above without changing anything in testsrc you get a new "dated" folder identical to "current" |
Are you sure you aren't looking at hard links? You may have a single copy of an unchanged file and the folder with the image of all the directory structure on the next occasion has a hard link to it because it hasn't changed. For files that changed, it may remove the link and then copy the new file in. I'm speculating from your description, but this is the way some procedures work.
|
Definatly not links.
Steps as follows: 1) Create folder in ~ called test 2) Create folder ~/test/testsrc and ~/test/backups 3) Create script containing only the code given above 4) touch testsrc/test1.txt 5) Run the script 6) touch testsrc/test2.txt At this point you should have the following tree in backups: ~/test/backups/current/test1.txt ~/test/backups/current/test2.txt ~/test/backups/10:45:00/test1.txt Edit test1.txt in current and it has no effect on test1.txt and vice versa |
What I meant was links between your multiple backups. The explicit example you just gave is only one backup.
However, looking into it a bit more, it's pretty clear this isn't the issue. You are simply creating new directories and doing new full backups. Check out the link mathewg42 gave to Mike Rubel's web page. Or get a copy of the O'Reilly book "Backup & Recovery" by W. Curtis Preston. This is all spelled out in Chapter 7 which covers rsync with snapshots, rsnapshot, rdiff, etc. rsnapshot implements the whole procedure and may be available with your distribution. If you want to script it yourself with rsync, the basic idea is to first create a full backup with rsync. Then replicate the full backup using only hardlinks. Then rsync to the replicate letting it delete the links for those files that have changed and copy the new files in. Repeat the process on the most recent replicate of the backup. I would also change the -rv that you are using to -av. That catches more options that you want for a backup. so, initially Code:
BACKUPDIR=~/test/backups/`date +%R:%S` Code:
NEWDIR=~/test/backups/`date +%R:%S` {this will be different now} |
In the end I found a script example using find and tar taht does what I want.
So now if it's a Sunday I do a full backup of the source tree, and every other day do the same for files changed in the last 24 hours. Thanks for the help Dan |
All times are GMT -5. The time now is 08:30 PM. |