After successfully setting up the ZFS auto snapshot package, I was at the point 
of implementing its backup functionality when I saw the announcement of the 
removal of that, and the associated uproar.  I looked deeper and discovered 
that the autosnap backup didn't really meet my needs after all, and couldn't 
find anything else out there that did, so I wrote my own script using the zfs 
send/receive functionality to replicate snapshots to another host.

It works as intended, but I'm sure it could be improved.  Something I know 
would be a good change would be converting it to an SMF service, and replacing 
the lockfile bit with SMF maintenance state, but I don't know SMF manifests 
that well, so hopefully someone can contribute one!  I also know the error 
handling could be abstracted out and improved somewhat.  I check for the 
failure cases I can think of and drop to maintenance in case any of those 
happen.

Description/rationale of the script (more detailed comments within the script):
# This supplements zfs-auto-snapshot, but runs independently.  I prefer that
# snapshots continue to be taken even if the backup fails.
#
# This aims to be much more robust than the backup functionality of
# zfs-auto-snapshot, namely:
# * it uses 'zfs send -I' to send all intermediate snapshots (including
#   any daily/weekly/etc.), and should still work even if it isn't run
#   every hour -- as long as the newest remote snapshot hasn't been
#   rotated out locally yet
# * 'zfs recv -dF' on the destination host removes any snapshots not
#   present locally so you don't have to worry about manually removing
#   old snapshots there.

I realize this doesn't meet everybody's needs but hopefully someone will find 
it useful.


Note: I'm running sol10u8.  I expect this to work fine on recent OpenSolaris 
also, but I have not tested that.  The only change required to make 
zfs-auto-snapshot v0.12 work on sol10u8 was changing ksh93 to dtksh in the 
shebang line.


Andrew Daugherity
Systems Analyst
Division of Research & Graduate Studies
Texas A&M University






Attachment: zfs-backup.sh
Description: Bourne shell script

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to