LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backup of files which will be replaced during rsync (https://www.linuxquestions.org/questions/linux-newbie-8/backup-of-files-which-will-be-replaced-during-rsync-4175521181/)

vjlxmi 10-06-2014 07:25 AM

backup of files which will be replaced during rsync
 
hello,
i want to take a backup of those files which will be replaced during rsync.
i.e. newer or modified files in source will replace older files in destination, so i want to take the backup of the older files in the destination itself.
is it possible using rsync??

pan64 10-06-2014 07:38 AM

probably this helps: http://webgnuru.com/linux/rsync_incremental.php

cepheus11 10-06-2014 04:08 PM

If you want to have access to the files in their older versions, rsnaphot or rdiff-backup can do it. Rsnapshot uses rsync internally.

vjlxmi 10-07-2014 06:51 AM

Incremental backup would take the backup of files which have been changed i.e. the newer files. But in my case I need to backup the files which will be over-written i.e. the older files.

pan64 10-07-2014 07:00 AM

sorry guy, I do not understand. Those files will be lost if you did not make a backup before modification.

vjlxmi 10-07-2014 07:12 AM

yeah i know that once rsync is done the older data is lost. But before running the rsync command is there a way to just take backup of the files that will be changed?

Drakeo 10-07-2014 07:19 AM

ever looked at how "git" works. I mean your just adding to something then making a commit. then you will be able to go back to backup at will. you will be able to choose any of the times you put somthing in the git and commit.

and if you do branches and after a while you no longer need that branch you can delete it.
say branch-2013 and you will no longer need it get rid of it. you already have a brach-2014 started.
but that is a nice way of backing up and being able to look at changes.

pan64 10-07-2014 08:53 AM

Quote:

Originally Posted by vjlxmi (Post 5250149)
yeah i know that once rsync is done the older data is lost. But before running the rsync command is there a way to just take backup of the files that will be changed?

Sorry, still does not understand. rsync is used to make incremental backup. It means you will always save only the new/modified files, the old ones will not be backed up again. Every time you make a backup you will create it in a new directory, and all the earlier backups will remain intact.

suicidaleggroll 10-07-2014 11:39 AM

Quote:

Originally Posted by pan64 (Post 5250184)
Sorry, still does not understand. rsync is used to make incremental backup. It means you will always save only the new/modified files, the old ones will not be backed up again. Every time you make a backup you will create it in a new directory, and all the earlier backups will remain intact.

I think he wants to back up the old files on the destination before syncing them to the new files

In other words, he has machine A and machine B.
Machine A backs up to B using rsync
A backup is performed on Sunday
"filename.txt" on machine A is changed on Monday
Before he runs the rsync to sync up A and B, he wants to make a backup of "filename.txt" on B, so that when the backup is done, B has both copies of "filename.txt", the new one that matches A, and the old one from Sunday.

OP - look into the --link-dest flag in rsync. The basic idea is that you would perform a full backup from A to some dated directory on B, then the next time you did the backup, you would set --link-dest to the previous backup. Then when the backup is performed, any files that are UNCHANGED on the source, would simply be hard linked from the previous backup on the destination, while any files that are changed on the source are copied like normal. In the end, you have two full backups, one from the previous day and one from the current day, but it only takes up the hard drive space of one backup plus any files that changed between the two backups, since the unchanged files are hard-linked between the two.

cepheus11 10-07-2014 12:41 PM

Good description from suicidaleggroll, and rsnapshot is designed to automate exactly that. So if your concern is solely about disk usage with multiple backup time points, and you have many small files which do not change very often, this could be a solution.

It is not the right tool for often-changing large files like vm images, though.


All times are GMT -5. The time now is 04:18 AM.