1 2 NAME 3 4 ZFS Automatic Snapshot SMF Service, version 0.12 5 6 7 DESCRIPTION 8 9 This is a simple SMF service which can will take automatic, 10 scheduled snapshots of given ZFS filesystems and can perform simple 11 incremental or full backups of those filesystems. 12 13 Documentation for the service is contained in the manifest file, 14 zfs-auto-snapshot.xml. 15 16 Version 0.11 removes the simple GUI applications that were used to 17 create manifests, or select which filesystems should be included 18 in the canned instances. These are superceded by the time-slider-setup 19 application. 20 21 INSTALLATION 22 23 To install, as root, pkgadd SUNWzfs-auto-snapshot. This package now contains 24 several canned SMF instances. These are: 25 26 online 1:17:43 svc:/system/filesystem/zfs/auto-snapshot:hourly 27 online 1:17:46 svc:/system/filesystem/zfs/auto-snapshot:monthly 28 online 1:17:46 svc:/system/filesystem/zfs/auto-snapshot:daily 29 online 1:17:48 svc:/system/filesystem/zfs/auto-snapshot:frequent 30 online 1:17:49 svc:/system/filesystem/zfs/auto-snapshot:weekly 31 online 1:17:49 svc:/system/filesystem/zfs/auto-snapshot:event 32 33 These instances use the special "//" fs-name to determine which filesystems 34 should be included in each snapshot schedule. See the description for "fs-name" 35 below. 36 37 The included instances have the following properties: 38 39 frequent snapshots every 15 mins, keeping 4 snapshots 40 hourly snapshots every hour, keeping 24 snapshots 41 daily snapshots every day, keeping 31 snapshots 42 weekly snapshots every week, keeping 7 snapshots 43 monthly snapshots every month, keeping 12 snapshots 44 event no automatic snapshots taken, keeps all snapshots 45 46 The :default service instance does not need to be enabled. 47 48 Additional instances of the service can also be created, for example to group 49 related sets of filesystems under a single service instance. 50 51 The properties each instance needs are: 52 53 zfs/fs-name The name of the filesystem. If the special filesystem 54 name "//" is used, then the system snapshots only 55 filesystems with the zfs user property 56 "com.sun:auto-snapshot:<label>" set to true, so to take 57 frequent snapshots of tank/timf, run the following zfs 58 command: 59 60 # zfs set com.sun:auto-snapshot:frequent=true tank/timf 61 62 The "snap-children" property is ignored when using this 63 fs-name value. Instead, the system automatically determines 64 when it's able to take recursive, vs. non-recursive snapshots 65 of the system, based on the values of the ZFS user properties. 66 67 zfs/interval [ hours | days | months | none] 68 When set to none, we don't take automatic snapshots, but 69 leave an SMF instance available for users to manually 70 fire the method script whenever they want - useful for 71 snapshotting on system events. This is used by the 72 svc:/system/filesystem/zfs/auto-snapshot:event instance. 73 74 zfs/keep How many snapshots to retain - eg. setting this to "4" 75 would keep only the four most recent snapshots. When each 76 new snapshot is taken, the oldest is destroyed. If a snapshot 77 has been cloned, the service will drop to maintenance mode 78 when attempting to destroy that snapshot. Setting to "all" 79 keeps all snapshots. 80 81 zfs/period How often you want to take snapshots, in intervals 82 set according to "zfs/interval" 83 (eg. every 10 days) 84 85 zfs/offset The time from the start of the current interval at which 86 snapshots should be taken, expressed in seconds. For example 87 to take snapshots hourly at 15 minutes into the hour, 88 zfs/offset = 900 (60 sec. * 15) To take daily snapshots at 89 15:43, zfs/offset = 56580. 90 91 zfs/snapshot-children "true" if you would like to recursively take snapshots 92 of all child filesystems of the specified fs-name. 93 This value is ignored when setting zfs/fs-name='//' 94 95 zfs/backup [ full | incremental | none ] 96 97 zfs/backup-save-cmd The command string used to save the backup stream. 98 99 zfs/backup-lock You shouldn't need to change this - but it should be 100 set to "unlocked" by default. We use it to indicate when 101 a backup is running. 102 103 zfs/label A label that can be used to differentiate this set of 104 snapshots from others, not required. If multiple 105 schedules are running on the same machine, using distinct 106 labels for each schedule is needed - otherwise one 107 schedule could remove snapshots taken by another schedule 108 according to it's snapshot-retention policy. 109 (see "zfs/keep") 110 111 112 zfs/verbose Set to false by default, setting to true makes the 113 service produce more output about what it's doing. 114 115 zfs/avoidscrub Set to false by default, this determines whether 116 we should avoid taking snapshots on any pools that have 117 a scrub or resilver in progress. 118 More info in the bugid: 119 6343667 need itinerary so interrupted scrub/resilver 120 doesn't have to start over 121 122 zfs/sep A character used to separate components of the snapshot 123 name generated by the service. Set to '_' by default. 124 (the original character ':' caused problems for CIFS 125 clients) 126 127 zfs/auto-include Set to true by default, this determines whether we should 128 set a property on all new pools (pools where com.sun:auto-snapshot 129 isn't already set) telling the system to automatically include 130 all datasets in that pool in the default schedules. Setting to 131 false will prevent newly imported pools from being snapshotted. 132 133 134 An example instance manifest is included in this archive. 135 136 137 ZFS PROPERTIES 138 139 See the description of 'zfs/fs-name' above for details on the com.sun:auto-snapshot 140 property, used to select datasets for inclusion into each snapshot schedule. 141 142 The 'com.sun:auto-snapshot-desc' property is set on every snapshot taken 143 by the service. Values for this property are not defined and are left to the individual 144 user. The service sets a value of 'Missed snapshot' in this property when snapshots 145 are taken on service start (due to a previous scheduled snapshot being missed) 146 147 Similarly, users can invoke the method script with an optional string which is then set 148 as a value to this property. 149 150 eg. 151 152 # /lib/svc/method/zfs-auto-snapshot svc:/system/filesystem/zfs/auto-snapshot:event "Samba connect" 153 # zfs get com.sun:auto-snapshot-desc rpool/timf@zfs-auto-snap_event-2009-06-22-1240 154 NAME PROPERTY VALUE SOURCE 155 rpool/timf@zfs-auto-snap_event-2009-06-22-1240 com.sun:auto-snapshot-desc Samba connect local 156 157 158 SECURITY 159 160 The service is run by a restricted role "zfssnap", which is created when installing 161 the service if it doesn't already exist. It has the "ZFS File System Administration" 162 RBAC Profile, as well as the solaris.smf.manage.zfs-auto-snapshot Authorization. 163 In order to see what the service is doing, you can view the SMF log files in 164 /var/svc/log for each service instance and syslog, with more detailed logging output 165 being sent to syslog when the "zfs/verbose" option is enabled. 166 167 168 SEE ALSO 169 170 171 More background about this service, along with implementation comments can be 172 found in web log posts at: 173 174 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_prototype_1 175 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_smf_service 176 http://blogs.sun.com/timf/entry/and_also_for_s10u2_zfs 177 http://blogs.sun.com/timf/entry/smf_philosophy_more_on_zfs 178 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_now_with 179 http://blogs.sun.com/timf/entry/zfs_automatic_snapshot_service_logging 180 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_8 181 http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people 182 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_10 183 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_11 184 http://blogs.sun.com/timf/entry/zfs_automatic_snapshots_0_12 185 186 The ZFS Automatic Snapshot SMF Service is released under the terms of the CDDL. 187 188