Scheduling Snapshots (CLI)

Use the following procedure to configure automatic snapshots of a share and set a retention policy for those snapshots.

Automatic snapshots can be set on a project or a share, but not both. Otherwise, overlapping schedules and retention policies would make it impossible to guarantee both schedules. Removing an interval, or changing its retention policy, will immediately destroy any automatic snapshots not covered by the new schedule, unless the snapshots are under a retention hold. Automatic snapshots with clones are ignored.

Automatic snapshots can be taken half-hourly, hourly, daily, weekly, or monthly and are named .auto[-<snaplabel>]-<timestamp>. Snapshot creation times are stored and executed in UTC format, without regard to such conventions as daylight saving time. For example, a snapshot scheduled for 10:00 a.m. PST (UTC-8) is stored and executed at 18:00 UTC, and this is the time that will appear as the timestamp in the snapshot name.

Older versions of the software allowed for automatic snapshots at the frequency of a minute. To help users avoid placing undue stress on the system, this feature was removed with the 2010.Q3 release. If the software is rolled back, existing minutes will be preserved. Previous instances will expire according to the existing schedule, but no new snapshots will be taken. An alert will be posted if a share or project with this frequency is found.

Automatic snapshots can be kept forever (except for half-hourly and hourly snapshots, which are capped at 48 and 24, respectively), or they can be limited to a certain number. When the number of snapshots exceeds the number for the keep property, the oldest snapshots are deleted first. This is known as the "keep-at-most" scheme.

A retention hold can be placed on automatic snapshots to prevent deletion by locking them, which is especially beneficial for meeting internal retention and regulatory compliance needs. Because a retention policy is set at the parent level, the project and its shares are equally protected from deletion. However, filesystems, LUNs, and other snapshots within the share can be modified or deleted. Snapshot retention holds are preserved when moving the snapshot to another system via remote replication, NDMP (zfs format), or cloud snapshot backup (zfs format). However, retention holds cannot be added to original remote replication snapshots nor original NDMP snapshots.

When the threshold is met for the retentionhold property, the retention hold is set to off for excessive snapshots, and they are automatically deleted using the keep-at-most scheme. Also, a retention hold cannot be modified nor removed. Therefore, a snapshot schedule with a retention hold cannot be deleted until it is the oldest snapshot in the keep-at-most scheme. For a snapshot within a share, its share and project also cannot be deleted early.

To use the snapshot retention hold feature, apply deferred update "Support for Snapshot Retention." For information about deferred updates, see Deferred Updates in Oracle ZFS Storage Appliance Customer Service Manual, Release OS8.8.x.

The following user role authorizations are required to configure an automatic snapshot:

  • Schedule an automatic snapshot: scheduleSnap

  • Set a retention hold: scheduleLockedSnap

For information on editing authorizations for a role, see Editing Authorizations for a Role (CLI). For information on editing the retention hold value, see Editing a Snapshot Retention Policy (CLI).

  1. Go to shares and select the project or share you want to snapshot.
    hostname:> shares select myproject
    hostname:shares myproject> select demo_share
    hostname:shares myproject/demo_share>
  2. To enable the retention policy for automatic snapshots within the project or share, set property snapret_enabled to true.
    hostname:shares myproject/demo_share> set snapret_enabled=true
  3. Enter snapshots automatic.
    hostname:shares myproject/demo_share> snapshots automatic
    hostname:shares myproject/demo_share snapshots automatic>
  4. Enter the create command to enter an uncommitted schedule context.
    hostname:shares myproject/demo_share snapshots automatic> create
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)>
  5. Use the set command to set each field appropriately.
    1. Set the frequency to halfhour, hour, day, week, or month to indicate how often the snapshot is automatically taken.
    2. Set the day, hour, and minute to specify the precise time the snapshot is automatically taken.

      For half-hourly or hourly snapshots, you can choose how many minutes after the half-hour or hour the snapshot is taken. For daily snapshots, you can choose the hour and minute the snapshot is taken, and for weekly or monthly snapshots, you can specify the day, hour, and minute.

    3. To set a retention policy, set the retentionpolicy property to locked.

      The default for the retentionpolicy property is off.

    4. To set the retention policy value, set the keep property to the number of snapshots to keep before older snapshots are automatically deleted.

      If multiple snapshot schedules end at the same time, only the snapshot with the strictest retention hold is generated.

    5. To set a retention hold, set the retentionhold property to the number of snapshots that should be locked and, thus, protected from deletion.

      The number for the retentionhold property must be the same or smaller than the number for the keep property.

    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set frequency=day
                         frequency = day (uncommitted)
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set hour=14
                              hour = 14 (uncommitted)
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set minute=30
                            minute = 30 (uncommitted)
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set keep=7
                              keep = 7 (uncommitted)
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set retentionhold=3
                     retentionhold = 3 (uncommitted)
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> set retentionpolicy=locked
                     retentionhold = 3 (uncommitted)

    You can use the get command to view the current uncommitted settings.

    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> get
                         frequency = day (uncommitted)
                               day = (unset)
                              hour = 14 (uncommitted)
                            minute = 30 (uncommitted)
                              keep = 7 (uncommitted)
                     retentionhold = 3 (uncommitted)
                   retentionpolicy = locked (uncommitted)
  6. Enter commit to commit the changes, and create the automatic snapshot schedule.
    hostname:shares myproject/demo_share snapshots automatic (uncommitted)> commit

    You can use the list command to view the new schedule.

    hostname:shares myproject/demo_share snapshots automatic> list
    NAME                 FREQUENCY       DAY           HH:MM KEEP
    automatic-000        day             -             14:30    7
  7. Enter done to finish.
    hostname:shares myproject/demo_share snapshots automatic> done
    hostname:shares myproject/demo_share snapshots>