On Thu, Mar 31, 2011 at 12:25:20AM +0100, nev young wrote:
On 30/03/11 19:22, Chris G wrote:
I'm aiming to use rsync's --link-dest option to do some incremental backups but I'm not absolutely sure I've got its use correct.
What I'm going to do is maintain incremental backups for the last seven days, so they'll be in directories named for the days of the week. The script will work out values for today and yesterday and then do (example for today):-
rm -fr /backup/Wed rsync -a --link-dest=/backup/Tue fromSource /backup/Wed
Will this do what's intended? I'm less interested in detailed syntax errors but want to be sure I will get 7 days of incremental backups.
I think you will find it faster to not do the rm -rf and use --del as one of the rsync params. Then it will only remove what it needs to remove.
I don't think that does the same thing, what --link-dest does is to check whether the file you're copying is there already (in the directory specified by the --link-dest) and if it is there already a hard link is put into the destination directory.
Unless you start with a completely empty destination you can't be sure that all the files which can be hard links are created as hard links.
Using the rsync --delete option (which I may want to do as well) just means to delete files from the destination which have been deleted from the source.