> From: tech-boun...@lists.lopsa.org [mailto:tech-boun...@lists.lopsa.org]
> On Behalf Of Edward Ned Harvey (lopser)
> 
> Just before midnight, I destroyed the machine. And then I started doing the
> restore. Guess what time the backup script runs? Midnight. Guess what its
> behavior is? It notices the filesystem is completely different, so it sends a
> new "Full" and clobbers the backup destination. Hooray! :-)

BTW, every mode of backup is prone to failure, so I generally like to use more 
than one type of backup. In this case, I had the machine snapshots, and I also 
periodically export the config (it's a firewall VM). So I was able to rebuild 
the machine from scratch and then restore the config.

So what kind of backup script clobbers the backup destination? It's my own 
script, and here's the algorithm: 

foreach filesystem as "fs" on source:
    if fs exists on dest:
        if source fs and dest fs have a snapshot in common:
            send incremental source fs to dest fs
        else:
            rename dest "fs" to "fs_to_destroy"
            send full source fs to dest fs
            if send completed successfully:
                destroy fs_to_destroy from dest
            else:
                // put it back the way it was
                rename dest "fs_to_destroy" to "fs"
    else:
        send full source fs to dest fs

As you can see, the backup script worked as designed. It saw a brand new 
filesystem on the source, whose name exactly matched a filesystem on the 
destination, but had no matching snapshots. So it made a brand new full backup 
of the source. It preserved the backup destination until after it confirmed a 
new full backup had sent successfully.

Here is the change I'm going to make to the scripts, moving forward:

foreach filesystem as "fs" on source:
    if fs exists on dest:
        if source fs and dest fs have a snapshot in common:
            send incremental source fs to dest fs
        else:
            alert
            abort
    else:
        send full source fs to dest fs

_______________________________________________
Tech mailing list
Tech@lists.lopsa.org
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to