I’ve finished writing the next round of features for my
ZFS Automatic Snapshots SMF Service
prototype. You can download this as
zfs-auto-snapshot-0.6.tar.gz

The main new features in this release are:

The send/receive support means that if you want it to, the service can send backups of each snapshot, either full streams or incremental streams, depending on how the service is configured. The service will also send snapshots of all child filesystems, if required, though without the send -r support in ZFS, this is a little unweildy a at the moment.

There’s a SMF property which the user can set to the command which should recover the backup stream. Typically, this would be a “zfs receive”, but there’s no reason why you couldn’t simply cat the output to a unique file on an NFS server. I’ve altered the bundled GUI to also ask for these new options when it’s constructing a new manifest:

The multiple schedules per filesystem feature allows the user to assign an optional label to each snapshot schedule, allowing multiple schedules for the same dataset. For example, for a given filesystem you might choose to take monthly full backups, sent to a remote server (and backed up to tape as a flat file), but also daily incremental backups, perhaps via zfs send/receive to a different server.

The label is also useful to quickly tell which services are running for which filesystems. For example, here’s the configuration on my desktop at the moment:

root@haiiro[236] svcs | grep zfs
online         Aug_31   svc:/system/filesystem/zfs/auto-snapshot:space-archive
online         Aug_31   svc:/system/filesystem/zfs/auto-snapshot:tank-root_filesystem
online         13:28:27 svc:/system/filesystem/zfs/auto-snapshot:space-timf
online         17:47:37 svc:/system/filesystem/zfs/auto-snapshot:default
online         18:00:02 svc:/system/filesystem/zfs/auto-snapshot:tank-new,backup
online         18:01:02 svc:/system/filesystem/zfs/auto-snapshot:tank-new,moreoften

I’ve updated the documentation and README for these new features, but let me know if anything’s unclear.

Finally, I’m trying hard to do the right thing in the face of failure. The service will move to maintenance should a backup fail for any reason, and the cron job should be removed in that case. Also, I’m doing some basic locking, to see if zfs send commands are still running before attempting to send another backup stream from the same instance. Unfortunately, there doesn’t seem to be an atomic way to set/get properties from SMF from what I can see, but feedback is welcome.

I hope you find this stuff useful, and if you run into problems, bug reports would be great!

ps. Chris is also doing some pretty snazzy stuff with ZFS snapshots – over on his blog : well worth checking out!

[ update here ]

Advertisements