I know about --ignore-existing
option and wonder if there's something slightly different.
My situation is: I have a webserver with large amount of user-uploaded pictures. It's about 2TB now. Usually these files are not modified at all. I use rsync and backup them to other server.
But what if some file becomes broken? Suppose, a half of a file disappeared. It will copied to backup and overwrites previous correct file, so backup becomes broken as well.
I may use --ignore-existing
. But what if some file was still changed (that's very rarely but possible). With this option backup will not have this new file.
I would like to have all versions of a file on backup if it changes. Is it possible? That is: if rsync defines that file already exists, it moves existing old file to some ../previous-TIMESTAMP/oldFileHere
and after that puts the new file on the place of an old one.
Is there a way to achieve this?
If you don't want to use rsnapshot you can use destination files with suffixes like this:
rsync --backup --suffix=`date +'.%F_%H-%M'` ~/life_story.txt /media/myusername/backupdrive/life_story.txt
Note:
--backup-dir
) but I haven't tried that myself.