rsync-time-backup
rsync-time-backup copied to clipboard
Snippet to make a differential backup
I needed to leave my backup in a differential like manner, each timestamp directory only have differences between last backup, only lastest one will have entire backup, previous ones will not.
I writed this, so far it works very well, I had a folder on a Server that users tend to use to see older versions of excel sheets, so with this they only see modifications made and not repetitions of each folder.
https://gist.github.com/braian87b/f77a696852324ebe7826e56d671beac5
I was thinking that this can be undone easily using a for-loop, and by each directory rsync'ing creating hardlinks for non-existing files starting from latest directory one until oldest one... Hope someone have time and want to do it.
on the Server users can see something like this:
2018-03-10 16:40\
file1.xls
2018-03-11 10:20\
file1.xls
file2.xls
2018-03-11 15:30\
file2.xls
latest-> 2018-03-22 17:45\
file1.xls
file2.xls
file3.xls
file4.xls
instead of
2018-03-10 16:40\
file1.xls
file2.xls (hardlink)
file3.xls (hardlink)
file4.xls (hardlink)
(...) (no modifications here, but several useless backup folders between)
2018-03-11 10:20\
file1.xls
file2.xls
file3.xls (hardlink)
file4.xls (hardlink)
(...) (no modifications here, but several useless backup folders between)
2018-03-11 12:20\ (no modifications here, but a useless backup folder)
file1.xls (hardlink)
file2.xls (hardlink)
file3.xls (hardlink)
file4.xls (hardlink)
(...) (no modifications here, but several useless backup folders between)
2018-03-11 15:30\
file1.xls (hardlink)
file2.xls
file3.xls (hardlink)
file4.xls (hardlink)
(...) (no modifications here, but several useless backup folders between)
latest-> 2018-03-22 17:45\
file1.xls
file2.xls
file3.xls
file4.xls