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