rsync script for snapshot backups
dennis at lightandshadow.tv
Sun Jun 19 18:16:21 UTC 2016
Am 19.06.2016 um 19:27 schrieb Simon Hobson:
> Dennis Steinkamp <dennis at lightandshadow.tv> wrote:
>> i tried to create a simple rsync script that should create daily backups from a ZFS storage and put them into a timestamp folder.
>> After creating the initial full backup, the following backups should only contain "new data" and the rest will be referenced via hardlinks (-link-dest)
>> Well, it works but there is a huge flaw with his approach and i am not able to solve it on my own unfortunately.
>> As long as the backups are finishing properly, everything is fine but as soon as one backup job couldn`t be finished for some reason, (like it will be aborted accidently or a power cut occurs)
>> the whole backup chain is messed up and usually the script creates a new full backup which fills up my backup storage.
> Yes indeed, this is a typical flaw with many systems - you often need to throw away the partial backup.
> One option that comes to mind is this :
> Create the new backup in a directory called (for example) "new" or "in-progress". If, and only if, the backup completes, then rename this to a timestamp. If when you start a new backup, if the in-progress folder exists, then use that and it'll be freshened to the current source state.
> Also, have you looked at StoreBackup ? http://storebackup.org
> I does most of this automagically, keeps a definable history (eg one/day for 14 days, one/week for x weeks, one/30d for y years), plus it keeps file hashes so can detect bit-rot in your backups.
Thank you for taking the time to answer me.
Your suggestion is what i also had in mind but i wasn`t sure if this
would be "best practice"
To build this idea into my script i probably need to hardcode the
target directory rsync writes to (e.g new or in-progress) and move the
directory name to a timestamp only after rsync gave a return code of 0,
am i correct? (or return code 0 and 24?)
As for StoreBackup, it really does sound nice but i have to do all of
this from the console of a 2bay synology nas, so its not that easy to
use 3rd party software that may has other dependencies, the synology
system doesn`t meet.
More information about the rsync