Skip to main content
A newer release of this product is available.

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 Snapshot copies are protected by vault relationships or define the schedule at which Snapshot copies are created on the SnapMirror destination. Rules which do not include a schedule are rules for protecting Snapshot copies. Rules which include a schedule are rules for creating Snapshot copies 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 copy selection for extended data protection (XDP) relationships. Only Snapshot copies 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, Snapshot copies 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 copy 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 Snapshot copies on the primary volume along with the newly created Snapshot copy 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 Snapshot copies of the primary volume are selected for transfer.

-keep <text> - Snapshot Copy Retention Count

Specifies the maximum number of Snapshot copies that are retained on the SnapMirror destination volume for a rule. The total number of Snapshot copies 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 copy retention count is reached on the SnapMirror vault destination for the rule. The default value is false , which means that the oldest Snapshot copy will be deleted to make room for new ones only if the number of Snapshot copies has exceeded the retention count specified in the "keep" parameter. When set to true , and when the Snapshot copies have reached the retention count, then an incremental SnapMirror vault update transfer will fail or if the rule has a schedule, Snapshot copies 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 Snapshot copies (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, Snapshot copies are directly created on the SnapMirror destination. The Snapshot copies created will have the same content as the latest Snapshot copy already present on the SnapMirror destination. Snapshot copies 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 copy 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> days|months|years}}] - Snapshot Copy Retention Period

This optional parameter specifies the duration for which the Snapshot copies associated with this rule will be locked. This parameter is only allowed for SnapMirror relationships between ONTAP source endpoints and object store destination endpoints. The parameter is specified as a number followed by a suffix. The valid suffixes are days , months , and years . For example, a value of 6months represents a retention period of 6 months. The minimum value of this parameter is 30days and maximum value is 100years . It cannot be specified if the value of the snapshot-lock-mode field in the SnapMirror policy is set to none . The default value is 30days when the value of the snapshot-lock-mode field in the SnapMirror policy is set to compliance or enterprise and the retention period is not specified.

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 Snapshot copies.

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