I recently researched the ONTAP functionality to reverse a SnapMirror and as I didn’t found any useful blog post or even user guide explaining how to perform it on CLI I thought it’s worth to share on my own blog. In this post you will see two ONTAP systems where CDOT01 is the primary and CDOT02 is the secondary. My source volume here is called “datalunwindows” on the source SVM “SVMSRC” and my destination volume is named “SVMSRC_datalunwindows_mirror” on the destionation SVM “SVMDST”. Everything was tested with ONTAP 9.2.
What means reverse SnapMirror?
By that I mean changing the direction of the SnapMirror. The most likely best example is if you want to failback from a secondary ONTAP to the primary after a disaster.
CDOT01/volumesource -> CDOT02/volumesdestination
Needed replication after a disaster:
CDOT02/volumesdestination -> CDOT01/volumesource
The change includes different steps an pre-requirements such as a broken SnapMirror relationship and that the source volume is still available and not completely lost. If you primary system is completeley lost you need to re-initialize to a new volume/system.
How do I perfrom a reverse SnapMirror?
The first and maybe easiest way would be to use the system manager as the latest version have the option to reverse a SnapMirror. But in my case I was looking for the way to do it on CLI as I was building some scripting around it.
1. Make sure your SnapMirror from CDOT01 to CDOT02 is broken and your data on CDOT02 is online.
##Check if mirror is broken snapmirror show -destination-path SVMDST:SVMSRC_datalunwindows_mirror -fields state ##Check if volume is now in RW status (DP before) volume show -volume SVMSRC_datalunwindows_mirror -fields type ##Check if volume is now online volume show -volume SVMSRC_datalunwindows_mirror -fields status
2. Be aware that changing the direction will overwrite the current source data on the volume so don’t execute the commands without knowing what you do. To sucessfully execute a reverse, there needs to be at least one common Snapshot on the source and destionation volume which will be used as the baseline Snapshot. If there is no common Snapshot the command will fail.
3. Execute the resync command on the source ONTAP (CDOT01) to get data from the secondary. Yes you see right, the reverse is simply done by using the rescny command but on the source (new destionation) instead of the destionation (now source).
snapmirror resync -destination-path SVMSRC:datalunwindows -source-path SVMDST:SVMSRC_datalunwindows_mirror -force true
4. Check if the SnapMirror is now reversed. You should see that CDOT01 now has an active SnapMirror relation and CDOT02 is a source.
5. The reverse is already done now.
Optional: Ususally customers now want to make the source the primary now again and reverse the SnapMirror again to have the initial CDOT01->CDOT02 relation in place again. Therefore follow the steps below:
##Quiesce the relation on the source cluster (CDOT01) snapmirror quiesce -destination-path SVMSRC:datalunwindows ##Break the snapmirror on the source cluster (CDOT01) snapmirror break -destination-path SVMSRC:datalunwindows ##Mount the data back to your environment ##Resync the relation back from CDOT01 to CDOT02 snapmirror resync -destination-path SVMDST:SVMSRC_datalunwindows_mirror -source-path SVMSRC:datalunwindows -force true ##Cleanup the Snapmirror resync on source CDOT01 snapmirror delete -destination-path SVMSRC:datalunwindows ##Cleanup the Snapmirror resync on destination CDOT02 snapmirror release -destination-path SVMSRC:datalunwindows -force true
That’s it for this post. I hope it was useful for some of you. Feel free to comment or share on any channel.
See u next time.