Configuring Automatic Snapshot Retention on a Target (CLI)

Use this procedure to set a different number of retained automatic snapshots on the replication target than what was set on the source appliance. Before performing this procedure, you must set a replication action on a project or share, and schedule automatic snapshots.

When performing this task, modify the replication action and the snapshot schedule from the appropriate project or share. If the replication action and snapshot schedule are set at different levels, edit the replication action at the same level where the schedule is configured, as shown in the following table:

Action Snapshot Schedule Modify automatic snapshot retention on:

Project level

Project level

Action configured at the project level.

Share level

Share level

Action configured at the share level.

Project level

Share level

Action visible at the share level. (Project-level action inherited by share.)

Share level

Project level

Action configured at the share level.

See Replication Automatic Snapshot Management for more information.

Before You Begin

Before configuring automatic snapshot retention on a target, you must first do the following:

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 an automatic snapshot schedule: scheduleSnap

  • Modify the retention hold value from off to locked: scheduleLockedSnap

  • Modify the retention hold value from locked to off: releaseSnapRetention

  1. Source appliance: Go to shares and select the appropriate project or share with the replication action and snapshot schedule.
    hostname:> shares select MyProject
    hostname:shares MyProject> select MyShare
    hostname:shares MyProject/MyShare>
  2. Enter replication, then enter show to display existing actions.
    hostname:shares MyProject/MyShare> replication
    hostname:shares MyProject/MyShare replication> show
    Properties:
                         inherited = false
    
    Actions:
    
                TARGET          STATUS     NEXT
    action-000  local           idle       Thu Jan 03 2019 12:04:00 GMT+0000 (UTC)
  3. Select the action for which you want to modify retention settings.
    hostname:shares MyProject/MyShare replication> select action-000
    hostname:shares MyProject/MyShare action-000>
  4. Enter autosnaps, then enter show to display snapshot schedules.

    Note if property autosnaps_retention_policies is set to synchronized or independent.

    hostname:shares MyProject/MyShare action-000> autosnaps
    hostname:shares MyProject/MyShare action-000 autosnaps> show
    Properties:
      autosnaps_retention_policies = independent
    
    Automatics:
    
    NAME           FREQUENCY      DAY             HH:MM KEEP
    automatic-000  hour           -                -:04    3
  5. If property autosnaps_retention_policies is set to synchronized, change it to independent and enter commit.
    hostname:shares MyProject/MyShare action-000 autosnaps> set autosnaps_retention_policies=independent
                              autosnaps_retention_policies = independent (uncommitted)
    hostname:shares MyProject/MyShare action-000 autosnaps> commit
  6. Select the automatic snapshot schedule that you want to modify.
    hostname:shares MyProject/MyShare action-000 autosnaps> select automatic-000
    hostname:shares MyProject/MyShare action-000 automatic-000>
  7. Use the ls command to show the schedule's properties. Note if property retentionpolicy is set to off or locked.
    hostname:shares MyProject/MyShare action-000 automatic-000> ls
    Properties:
                         frequency = hour
                               day =
                              hour =
                            minute = 04
                              keep = 10
                     retentionhold = 0
                   retentionpolicy = off
  8. Set property keep to the number of automatic snapshots to be retained on the target.
    hostname:shares MyProject/MyShare action-000 automatic-000> set keep=10
                              keep = 10 (uncommitted)
  9. Set the retention policy property to one of the following options:
    • off - To not set a retention policy for this snapshot, set property retentionpolicy to off.

    • locked - To lock the snapshot schedule, set property retentionpolicy to locked, and set property retentionhold to the number of snapshots that should be locked and, thus, protected from manual deletion. The number for the retentionhold property must be the same or smaller than the number for the keep property. When all locked snapshots for this schedule have exceeded the keep property value, the retention hold changes from locked to off.

    hostname:shares MyProject/MyShare action-000 automatic-000> set retentionpolicy=locked
                              retentionpolicy = locked (uncommitted)
    hostname:shares MyProject/MyShare action-000 automatic-000> set retentionhold=2
                              retentionhold = 2 (uncommitted)
  10. Enter commit to save the latest changes, and enter show to verify the changes.
    hostname:shares MyProject/MyShare action-000 automatic-000> commit
    hostname:shares MyProject/MyShare action-000 automatic-000> show
    Properties:
                         frequency = hour
                               day =
                              hour =
                            minute = 04
                              keep = 10
                     retentionhold = 2
                   retentionpolicy = locked

    Note:

    Automatic snapshot retention for replication has special processing during reverse replication. For more information, see Replication Snapshot Management.