Editing a Snapshot Retention Policy (CLI)

Use the following procedure to edit a snapshot retention policy for a filesystem, LUN, or project. Snapshot retention policies are included in both manual snapshots and in automatic snapshot schedules.

After an automatic snapshot with a retention hold has been generated, it is not possible to delete or modify its schedule until all snapshots with a retention hold have expired.

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 make changes to a retention policy:

  • Modify a manual snapshot to a stricter hold type (off to unlocked): retainSnap

  • Modify a manual snapshot to a less strict hold type (unlocked to off): releaseSnapRetention

  • Modify an automatic snapshot schedule: scheduleSnap

  • Modify the retention hold value for an automatic snapshot: releaseSnapRetention

For information on editing authorizations for a role, see Editing Authorizations for a Role (CLI). To delete an automatic snapshot schedule, see Removing a Snapshot Schedule (CLI).

  1. Go to shares and select the project or share.
    hostname:> shares select myproject
    hostname:shares myproject> select demo_share
    hostname:shares myproject/demo_share>
  2. Enter the appropriate node:
    • Manual snapshot: Enter snapshots

    • Automatic snapshot: Enter snapshots automatic

  3. Select the snapshot to edit.
  4. Set property snapret_enabled to true to set a retention policy. To not set a retention policy, set snapret_enabled to false.
    hostname:shares myproject/demo_share> set snapret_enabled=true
  5. For a manual snapshot and to change the retention policy, enter the set retentionpolicy command followed by the appropriate retention policy option: either off to unlocked, or unlocked to off.

    If the snapshot is a project snapshot, this setting also applies to all of its shares.

  6. For an automatic snapshot and to change the number of snapshots retained before older snapshots are automatically deleted, set the keep property to a new value.

    If the schedule includes snapshots with a retention hold, the keep property can only be changed to a higher value. If no automatic snapshots have been generated with this schedule, or none of the snapshots have a retention hold, the keep property can be set to a lower value. If the snapshot is a project snapshot, this setting also applies to all of its shares.

  7. For an automatic snapshot and to change the retention hold if the retention hold type is off, set the retentionpolicy property to locked, and edit the retentionhold property for the schedule.

    The following guidelines apply to automatic snapshots:

    • If the retention hold type is locked, you cannot edit the retentionpolicy property. When all locked snapshots for this schedule have exceeded the keep property value, the retention hold value changes from locked to off.

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

    • If automatic snapshots containing a retention hold have been generated with this schedule, the retentionhold property must be set to a higher value to prevent early lock removal, but not higher than the keep property.

    • If no automatic snapshots have been generated with this schedule, the retention hold can be set to a lower value.

    • If the snapshot is a project snapshot, this setting also applies to all of its shares.

  8. Enter commit to save the changes.