Skip to main content
ONTAP 9.16.1 commands

snapmirror policy add-rule

Contributors
Suggest changes

Add a new rule to SnapMirror policy

Availability: This command is available to cluster and Vserver administrators at the admin privilege level.

Description

The snapmirror policy add-rule command adds a rule to a SnapMirror policy. Rules define which snapshots are protected by vault relationships or define the schedule at which snapshots are created on the SnapMirror destination. Rules which do not include a schedule are rules for protecting snapshots. Rules which include a schedule are rules for creating snapshots on the SnapMirror destination. A rule with a schedule can only be added to SnapMirror policies of type vault or mirror-vault . A rule must not be added to a policy that will be associated with a SnapMirror data protection relationship. A policy that will be associated with a SnapMirror vault relationship must have at least one rule and at most ten rules. A SnapMirror policy with rules must have at least one rule without a schedule.

Parameters

-vserver <vserver name> - Vserver Name

Specifies the Vserver for the SnapMirror policy.

-policy <sm_policy> - SnapMirror Policy Name

Specifies the SnapMirror policy name.

-snapmirror-label <text> - Snapshot Copy Label

This parameter is primarily used for the purpose of snapshot selection for extended data protection (XDP) relationships. Only snapshots that have a SnapMirror label that matches this parameter will be transferred to the SnapMirror destination. However, when this parameter is associated with a rule containing a schedule, snapshots will be created on the SnapMirror destination using this snapmirror-label parameter. The label can be 31 or fewer characters in length. SnapMirror policies of type async-mirror and mirror-vault have a rule added for label sm_created at the time of policy creation. This rule cannot be removed or modified by the user. This rule when coupled with create-snapshot field set to true indicates that the SnapMirror relationship using this policy shall create a new snapshot and transfer it as part of a snapmirror update operation. SnapMirror policies of type async-mirror support one additional rule with SnapMirror label all_source_snapshots . This rule along with the rule for SnapMirror label sm_created indicates that all new snapshots on the primary volume along with the newly created snapshot are transferred as a part of a snapmirror update or snapmirror initialize operation. Rules with any other SnapMirror labels cannot be added to SnapMirror policies of type async-mirror . The rule for label sm_created when added to a snapmirror policy of type vault indicates that all SnapMirror created snapshots of the primary volume are selected for transfer.

-keep <text> - Snapshot Copy Retention Count

Specifies the maximum number of snapshots that are retained on the SnapMirror destination volume for a rule. The total number of snapshots retained for all the rules in a policy cannot exceed 1019. For all the rules in SnapMirror policies of type async-mirror , this parameter must be set to value 1 .

[-preserve {true|false}] - Snapshot Copy Preserve Enabled

Specifies the behavior when the snapshot retention count is reached on the SnapMirror vault destination for the rule. The default value is false , which means that the oldest snapshot will be deleted to make room for new ones only if the number of snapshots has exceeded the retention count specified in the "keep" parameter. When set to true , and when the snapshots have reached the retention count, then an incremental SnapMirror vault update transfer will fail or if the rule has a schedule, snapshots will no longer be created on the SnapMirror destination. For all the rules in SnapMirror policies of type async-mirror this parameter must be set to value false .

[-warn <integer>] - Warning Threshold Count

Specifies the warning threshold count for the rule. The default value is 0 . When set to a value greater than zero, an event is generated after the number of snapshots (for the particular rule) retained on a SnapMirror vault destination reaches the specified warn limit. The preserve parameter for the rule must be true to set the warn parameter to a value greater than zero.

[-schedule <text>] - Snapshot Copy Creation Schedule

This optional parameter specifies the name of the schedule associated with a rule. This parameter is allowed only for rules associated with SnapMirror policies of type vault or mirror-vault . When this parameter is specified, snapshots are directly created on the SnapMirror destination. The snapshots created will have the same content as the latest snapshot already present on the SnapMirror destination. snapshots on the source that have a SnapMirror label matching this rule will not be selected for transfer. The default value is - .

Note You define and name a schedule using the job schedule cron create command.
[-prefix <text>] - Snapshot Copy Creation Prefix

This optional parameter specifies the prefix for the snapshot name to be created as per the schedule. If no value is specified, then the snapmirror-label will be used as the prefix. The prefix parameter can only be specified for rules which have a schedule.

[-retention-period {{<integer> seconds|minutes|hours|days|months|years} | infinite}] - Snapshot Copy Retention Period

This optional parameter specifies the duration for which the snapshots associated with this rule will be locked. The parameter is specified as a number followed by a suffix. The valid suffixes are seconds , minutes , hours , days , months , and years . For example, a value of 6months represents a retention period of 6 months. It can also be set to a special value of infinite for infinite retention. The destination volume must have the snapshot-locking-enabled parameter set to true for this field to take effect else it will be ignored.

Examples

The following example adds a rule named nightly to the SnapMirror policy named TieredBackup on Vserver vs0.example.com . The rule will retain a maximum of 5 nightly snapshots.

vs0.example.com::> snapmirror policy add-rule -vserver vs0.example.com
       -policy TieredBackup -snapmirror-label nightly -keep 5