I finished the first version of the ZFS Automatic Backup Service that I mentioned a while back.

You can download the zfs-automatic-backup-0.1.tar.gz package, which contains this README.zfs-auto-backup.txt documentation.

The intent here, is to be able to automatically backup selected ZFS filesystems on your machine whenever a named USB volume is plugged into your system. The target audience here is developers & users of small systems who want a small safeguard against their machine being lost or damaged – a little more peace of mind in the face of a heartless world.

It’s pretty easy to setup – just copy the files to the right place, import the SMF manifest, and configure the name of the volume you want to backup to. Then use “zfs set com.sun:auto-backup=true <name of dataset>” to mark filesystems for backup.

On plugging the USB disk into the machine, the service takes a snapshot of the filesystems marked for backup, checks for the presence of an existing backup on the storage media, and kicks off either a full or incremental zfs send to the USB disk, depending on whether it finds a previous snapshot saved to the disk or whether you’ve explicitly asked for full backups all the time. More info in the README.

Here’s a few screenshots showing what appears on your desktop whenever you plug the configured USB disk into your machine (at the start, and end of the backup):






(zooming in on one of the above images)

The GUI notification is a bit hairy, an SMF service running as root writing something to the desktop session of a logged-in user, so apologies for that in advance (no, there’s no multi-seat support, yes this is a terrible hack). Walking the line between “annoying pop-ups” and “not enough information” is difficult, I admit – so let me know what you think. There’s a problem with text wrapping in the notification box – haven’t yet investigated that.

I’ve tested this on small numbers of small filesystems, but it should scale to multiple-gigabytes of backups, assuming there’s no bugs in my code (I was testing all this on a USB 1.0 card reader, so waiting around for gigabytes of data to copy wasn’t an option :-)

Once again, many thanks to pjd for the “ZFS Man” image. All comments, and especially bug reports would be great!

Advertisements