NAME ZFS Automatic Backup SMF Service, version 0.2 DESCRIPTION This is a prototype of a simple SMF service which you can configure to take automatic backups of ZFS filesystems whenever a given USB disk is plugged into your system. It does this using a simple D-Bus monitor script, which watches for HAL events generated whenever a disk is inserted. If that disk volume name matches the one configured in the SMF service, it starts a backup program, which looks for ZFS filesystems to backup, or starts backing up pre-configured filesystems. To use the service, the user must add the package TIMFauto-backup which import the default SMF instance and enables the service. The user can then optionally create additional instances (if a user wanted to turn on/off particular filesystem groups, this would be the easiest way to do it) As of version 0.9 there is a simple GUI that allows the user to configure which filesystems are to be included in the backups. This GUI is installed in the GNOME menu under: Administration -> Automatic Backups Documentation for the service instance is contained in the manifest file, zfs-auto-backup.xml. INSTALLATION To install, run "make" then pkgadd -d `pwd`/proto TIMFauto-backup As an alternative to running the gui administration program mentioned above, you can also do the following from the command line: # svccfg -s \ svc:/system/filesystem/zfs/auto-backup setprop zfs/volume = astring: "MYVOL" # svcadm refresh svc:/system/filesystem/zfs/auto-backup Where "MYVOL" is the pcfs volume name of a USB disk you want to backup to. Setting the zfs property "com.sun:auto-backup" to "true" on selected filesystems will cause ZFS backup streams to be sent to the storage media whenever it is plugged into the system. Eg. # zfs set com.sun:auto-backup space/timf As properties are inherited, all subfilesystems of space/timf above would also have this property set, the GUI admin tool unfortunately doesn't reflect inherited properties yet. By default, we do incremental backups to the media - if a previous snapshot is not available on the media, a full backup is initiated. The service will try it's best to do incremental snapshots however - so if an older snapshot is available on the disk, it will use that as the "-i" option to zfs send. The following SMF properties can be used when creating new instances or modifying the default instance: fs-name : A space separated list of the names of the filesystems we want to backup. A special filesystem name '//' tells the script to pick all filesystems that have the zfs:auto-backup property set to 'true' (this is the default) backup : The type of zfs sends we want to do, either "full" or "incremental". When doing incremental sends, if a matching snapshot is't found on the storage device, we default to doing a full send. volume : The volume name we monitor in order to perform backups. verbose : Set to false by default, setting to true results in the service printing more detail in the log about what it's doing. gui : Whether we should have gui notifications, via libnotify. I did my best to make the gui as unintrusive as possible, thoughts welcome - scary code there, sorry. An example instance manifest is included in this archive. To allow users to choose which filesystems they can mark for backup, delegate the "userprop" permission to them, eg. # zfs allow timf userprop space/timf TODO Currently the GNOME GUI is primitive - it needs to be enhanced so that there's more flexibility when selecting snapshots to configure. Because it runs under gksu, it allows the user to mark *any* filesystem on the machine for backups, rather than just the filesystem that have been delegated to the current user. Also Network-facing backups would be nice, for example hooks into nwam such that when a network comes up, auto-backups are triggered. SEE ALSO More background about this service, along with implementation comments can be found in web log posts at: http://blogs.sun.com/timf/entry/zfs_backups_to_usb_mass http://blogs.sun.com/timf/entry/zfs_automatic_backup_0_1 http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people The ZFS Automatic Backup SMF Service is released under the terms of the CDDL.