LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync question (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-question-4175599709/)

babag 02-14-2017 12:58 AM

rsync question
 
i want to back up certain files but want to keep ALL versions of the sources in the backup directory and haven't been able to find a good method. the gui based offerings don't seem to have the depth or, if they do, they'd require so many switches that it seems like just going to a script would be better.

i keep a series of files with ideas for projects. i'm constantly amending these files. being that this is something of a creative process, there are often a lot of changes, additions, deletions to these files. it would be nice to be able to have my backup directory keep all of the various iterations of these files so that i can go back in time if it seems like i might have gotten side-tracked somewhere and want to go back and re-orient myself.

does rsync have anything that will allow for keeping many copies of the same file, maybe using the timestamp to differentiate?

thanks,
BabaG

pan64 02-14-2017 02:34 AM

rsync can use different directories day by day for example. probably you can use this as a starting point: http://www.mikerubel.org/computers/rsync_snapshots/
by the way if you want to handle source files you ought to go with git.

Turbocapitalist 02-14-2017 02:49 AM

Several options can be used together in doing incremental backups to avoid wasting space on unchanged files:

https://rsync.samba.org/examples.html
https://blog.interlinked.org/tutoria...e_machine.html

agillator 02-14-2017 09:26 AM

Take a look at rsnapshot. It sounds as if it does exactly what you describe and you wouldn't have to reinvent the wheel. It uses rsync and hard links.

TenTenths 02-14-2017 09:44 AM

Take a look at dirvish this works quite well for giving you a folder structure where you can easily go back to specific points in time.

suicidaleggroll 02-14-2017 11:14 AM

Yes rsync can do this, you want the "--link-dest" flag. Every backup you do should go to a new, clean directory, and use --link-dest to point to the previous backup. Rsync will compare the source file to the same file in the previous backup, if they're the same, it will hard link the file from the previous backup to the new backup. If they are different, rsync will copy the file fresh from the source to the new backup. The end result is you have two completely independent and navigable backup directories for the two days, but they only take up the space of one full backup plus the files that changed between the two backups.

rknichols 02-14-2017 12:41 PM

There is also rdiff-backup, which combines the best features of a mirror and an incremental backup, working by maintaining history as a series of reverse diffs working back from a current mirror. It is not without its faults, being essentially unmaintained since 2009, but is considered good enough and unique enough to be used as the back end for a new project, safekeep.

TenTenths 02-14-2017 03:08 PM

Quote:

Originally Posted by suicidaleggroll (Post 5670409)
Yes rsync can do this, you want the "--link-dest" flag. Every backup you do should go to a new, clean directory, and use --link-dest to point to the previous backup. Rsync will compare the source file to the same file in the previous backup, if they're the same, it will hard link the file from the previous backup to the new backup. If they are different, rsync will copy the file fresh from the source to the new backup. The end result is you have two completely independent and navigable backup directories for the two days, but they only take up the space of one full backup plus the files that changed between the two backups.

This is the underlying mechanism that dirvish uses, it's effectively a wrapper script around rsync.


All times are GMT -5. The time now is 04:39 PM.