ZFS + dedup + backups

Code:
-i snapshot
                 Generate an incremental stream from the -i snapshot to the
                 last snapshot.  The incremental source (the -i snapshot) can
                 be specified as the last component of the snapshot name (for
                 example, the part after the @), and it is assumed to be from
                 the same file system as the last snapshot.

                 If the destination is a clone, the source may be the origin
                 snapshot, which must be fully specified (for example,
                 pool/fs@origin, not just @origin).

-I snapshot
                 Generate a stream package that sends all intermediary snap-
                 shots from the -I snapshot to the last snapshot.  For exam-
                 ple, -I @a fs@d is similar to -i @a fs@b; -i @b fs@c; -i @c
                 fs@d.  The incremental source snapshot may be specified as
                 with the -i option.
 
Ah, got it. I will give this a try and see how it goes. Thanks!

What I'm thinking is: use my script as is (with the -i option) and then if I have a skipped backup then run it manually with -I. Is this correct?
 
Why the hassle? Simply use the -I flag and totally forget about a skipped backup as it will be picked up automatically (kind of "self healing" :) ). You will only have to intervene if the whole script fails for some reason.
 
da1 said:
Why the hassle? Simply use the -I flag and totally forget about a skipped backup as it will be picked up automatically (kind of "self healing" :) ). You will only have to intervene if the whole script fails for some reason.

That works great if I run it manually. If I take an incremental snapshot today and then I skip two days worth of incrementals the -L option lets me still do a zfs send/recv successfully.

The problem I have now is that when the automated script runs and I simulate skipping two days worth of incremental backups then the script fails as it is looking for today's date minus one, i.e.:
Code:
today=`date +"$type%Y.%m.%d"`
yesterday=`date -v -1d +"$type%Y.%m.%d"`

zfs snapshot -r zroot@Daily_`date +%Y.%m.%d`

zfs send -R -I zroot@Daily_$yesterday zroot@Daily_$today | zfs receive -duv tank/fs

Is there a way to build some logic into this so that it says, if yesterdays incremental doesn't exist then check for the most recent incremental snapshot and run as usual?

I'm so close! :stud
 
Is there a way to build some logic into this so that it says, if yesterdays incremental doesn't exist then check for the most recent incremental snapshot and run as usual?

Code:
zfs list -t snapshot -o name
The above command gives you a list of the names of all available snapshots which you can then break down with a script.

I run a very limited script in my environment which returns the last available snapshot but it requires all snapshots to be named as dates in the form of '131220'.

Code:
zfs list -t snapshot -o name | grep '/<filesystem name>@' | grep -o '[0-9]\{6\}' | tail -1
 
Back
Top