How to clean Snapmirrors in clustered Data ONTAP

This Blog post lists the procedure used to clean up snapmirror relationships in clustered Data ONTAP.  In this scenario the destination cluster has large number of volumes that are snapmirror target

Drawing8

Source Cluster: SrcCluster
Destination Cluster: DstCluster
Source SVM: SrcVsv
Destination SVM: DstVsv

Use snapmirror show command to display source and destination paths

    DstCluster::*> snapmirror show -source-cluster SrcCluster
    Source Destination Mirror Relationship Total Last
    Path Type Path State Status Progress Healthy Updated
    ———– —- ———— ——- ————– ——— ——- ——–
    SrcVsv:src_vol_c0165 DP DstVsv:SrcCluster_src_vol_c0165r Snapmirrored Idle – false –
    SrcVsv:src_vol_c0180 DP DstVsv:SrcCluster_src_vol_c0180r Snapmirrored Idle – false –
    SrcVsv:src_vol_c0282 DP DstVsv:SrcCluster_src_vol_c0282r Snapmirrored Idle – false –
    SrcVsv:src_vol_c0284 DP DstVsv:SrcCluster_src_vol_c0284r Snapmirrored Idle – false –
    SrcVsv:src_vol_c0286 DP DstVsv:SrcCluster_src_vol_c0286r Snapmirrored Idle – true –
    SrcVsv:src_vol_c0313 DP DstVsv:SrcCluster_src_vol_c0313r Snapmirrored Idle – true –

Use snapmirror quiesce command to quiesce the snapmirror relations

    DstCluster::*> snapmirror quiesce -source-cluster SrcCluster -destination-path DstVsv:*
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0165r”.
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0180r”.
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0282r”.
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0284r”.
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0286r”.
    Operation succeeded: snapmirror quiesce for destination “DstVsv:SrcCluster_src_vol_c0313r”.

Break the snapmirror relations

    DstCluster::*> snapmirror break -source-cluster SrcCluster -destination-path DstVsv:*
    [Job 18594] Job succeeded: SnapMirror Break Succeeded
    [Job 18595] Job succeeded: SnapMirror Break Succeeded
    [Job 18596] Job succeeded: SnapMirror Break Succeeded
    [Job 18597] Job succeeded: SnapMirror Break Succeeded
    [Job 18598] Job succeeded: SnapMirror Break Succeeded
    [Job 18599] Job succeeded: SnapMirror Break Succeeded
    [Job 18600] Job succeeded: SnapMirror Break Succeeded

[ ON THE SOURCE CLUSTER ] : Use snapmirror list-destinations command to check valid  snapmirror relations

    SrcCluster::> snapmirror list-destinations -destination-vserver DstVsv
    Source Destination Transfer Last Relationship
    Path Type Path Status Progress Updated Id
    ———– —– ———— ——- ——— ———— —————
    SrcVsv:src_vol_c0165 DP DstVsv:SrcCluster_src_vol_c0165r – – – a58a0def-2c61-11e4-b66e-123478563412
    SrcVsv:src_vol_c0282 DP DstVsv:SrcCluster_src_vol_c0282r – – – a5cbb158-2c61-11e4-8fb5-123478563412
    SrcVsv:src_vol_c0284 DP DstVsv:SrcCluster_src_vol_c0284r Idle – – a908f9f0-2c61-11e4-a8c1-123478563412
    SrcVsv:src_vol_c0286 DP DstVsv:SrcCluster_src_vol_c0286r Idle – – a773c018-2c61-11e4-8fb5-123478563412
    SrcVsv:src_vol_c0313 DP DstVsv:SrcCluster_src_vol_c0313r Idle – – aaaa528e-2c61-11e4-8fb5-123478563412

Issue snapmirror release command from the source cluster

    SrcCluster::> snapmirror release -destination-vserver DstVsv -destination-volume *
    [Job 74850] Job succeeded: SnapMirror Release Succeeded
    [Job 74851] Job succeeded: SnapMirror Release Succeeded
    [Job 74852] Job succeeded: SnapMirror Release Succeeded
    [Job 74853] Job succeeded: SnapMirror Release Succeeded
    [Job 74854] Job succeeded: SnapMirror Release Succeeded
    [Job 74855] Job succeeded: SnapMirror Release Succeeded

Delete the snapmirror relations from Destination cluster

    DstCluster::*> snapmirror delete -source-vserver SrcVsv -destination-path DstVsv:*
    Operation succeeded: snapmirror delete for the relationship with destination “DstVsv:SrcCluster_src_vol_0043r”.
    Operation succeeded: snapmirror delete for the relationship with destination “DstVsv:SrcCluster_src_vol_0048r”.
    Operation succeeded: snapmirror delete for the relationship with destination “DstVsv:SrcCluster_src_vol_0070r”.
    Operation succeeded: snapmirror delete for the relationship with destination “DstVsv:SrcCluster_src_vol_0082r”.

NetApp Powershell toolkit can be very handy to automate large number of tasks

    Import Data ONTAP Module in Powershell command window
    Import-Module DataOnTap
    Connect to the Source cluster
    Connect-NcController SrcCluster -Credential admin
    Save a list of source volumes in a file called srcvolumes.txt. We will import the volumes in the variable $volumes and parse through each volume deleting snapshots with name “snapmirror*”
    $volumes = get-content C:\scripts\srcvolumes.txt
    foreach ($vol in $volumes) {Get-NcSnapshot $vol snapmi* | Remove-NcSnapshot -IgnoreOwners -Confirm:$false}
    Save a list of destination volumes in a file called dstvolumes.txt. we will import the volumes in a variable $volumes and we will offline and destroy each destination volume
    $volumes = get-content C:\scripts\dstvolumes.txt
    foreach ($vol in $volumes) {Dismount-NcVol $vol -VserverContext DstVsv -Confirm:$false}
    foreach ($vol in $volumes) {Set-NcVol $vol -Offline -VserverContext DstVsv -Confirm:$false}
    foreach ($vol in $volumes) {Remove-NcVol $vol -VserverContext DstVsv -Confirm:$false}

Leave a Reply

Your email address will not be published. Required fields are marked *