The other day, Roger asked for an additional feature to be added to the ZFS Automatic Snapshots SMF service that I wrote. The feature was, the ability to configure multiple snapshot schedules per filesystem.

For example, I have a ZFS filesystem for which I've configured a snapshot service to take weekly snapshots, and keep them on the system for a few months. However, during the day, I also want to have the system take automatic hourly snapshots of that filesystem, but only keep perhaps snapshots from the last 6 hours.

"Easy!", I thought - and started writing the suppport for the feature. Along the way, I also added support for the new snapshot -r ZFS feature now available in Solaris Nevada, which really speeds things up.

However, I quickly ran into a wall (ouch) when thinking about this feature. At the moment, each instance of the snapshot service configures a different set of automatic snapshots. For example, here's what's on my desktop :

root@haiiro[59] svcs auto-snapshot
STATE          STIME    FMRI
disabled       16:49:03 svc:/system/filesystem/zfs/auto-snapshot:space-test
online         16:08:55 svc:/system/filesystem/zfs/auto-snapshot:space-archive
online         16:08:55 svc:/system/filesystem/zfs/auto-snapshot:space-timf
online         16:08:55 svc:/system/filesystem/zfs/auto-snapshot:tank-root_files ystem
online         16:49:03 svc:/system/filesystem/zfs/auto-snapshot:default

The FMRI of each instance nicely delimits the boundaries of each set of snapshots - the instance names don't have any special significance, other than to show what's happening on the system at a glance. All the useful information I need in order to take snapshots are actually stored in instance-properties.

However, when I started to think about multiple instances for the same filesystem, I kept running into namespace clashes (other than these)

I can't create instance names "svc:/system/filesystem/zfs/auto-snapshot:space-timf:hourly" or "svc:/system/filesystem/zfs/auto-snapshot:space-timf@hourly" or "svc:/system/filesystem/zfs/auto-snapshot:space-timf$hourly" - SMF doesn't allow those characters in instance names.

I think I'm looking to subdivide the instance somehow - I'd thought of individual property groups inside each instance, each one corresponding to a different schedule for that filesystem, but then the granularity of the service breaks down: I couldn't disable hourly snapshots while keeping the monthly snapshots enabled for a given filesystem. Maybe that's okay ?

I'll keep thinking about it. Along with that, I'm also still trying to find the best way for my cron job to log snapshot status into the SMF log - simply redirecting output from the cron script into each FMRI's corresponding restarter/logfile doesn't seem like the right thing to do. Perhaps more coffee will help - but otherwise, all thoughts are welcome!


Comments:

Sorry to be commenting on my own blog - I found that SMF doesn't mind "," characters in instance names - that might do it (still risk a namespace clash, but I'll deal with it for the simplicity it'll provide)

root@haiiro[113] svcs -a | grep space-test
disabled       16:49:03 svc:/system/filesystem/zfs/auto-snapshot:space-test
disabled       18:40:57 svc:/system/filesystem/zfs/auto-snapshot:space-test,hourly

Posted by Tim Foster on August 31, 2006 at 06:44 PM IST #

Okay, got this mostly implemented now. Will also have support for incremental/full backups. In this first release, I'm not going to support recursive snapshot send/receive, as I'm waiting for the "zfs send -r" support. I'll post more when I'm able to get time to finish the work.

Posted by Tim Foster on September 01, 2006 at 10:14 AM IST #

You want to be looking at this entry now.

Posted by Tim Foster on November 20, 2006 at 05:16 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2010 by timf