netapp example lun failover snapmirror ontap 9.x

This is an example LUN failover. Two peered clusters (not discussed) Two peered svms. Two volumes in a snapmirror relationship. This is about changing the LUN serial number so that the initiator does not have to do a rescan of its disks.

#create two vservers, one on each cluster and peer them.cl1::> vserver create -vserver SRC -subtype default -rootvolume rv -aggregate n1_aggr1 

cl1::> vserver create -vserver SRC -subtype default -rootvolume rv -aggregate n1_aggr1 
-rootvolume-security-style unix

cl2::> vserver create DST -subtype default -rootvolume rv -aggregate aggr1 \
-rootvolume-security-style unix

cl1::> vserver peer create -vserver SRC -peer-vserver DST -applications snapmirror \
-peer-cluster cl2
cl2::> vserver peer accept -vserver DST -peer-vserver SRC

#create a 5g volume in both vservers. One RW and one DP
cl1::> vol create -volume SRCV -aggregate n1_aggr1 -size 5g -state online \
-junction-path /SRCV
cl2::> vol create -volume DSTV -aggregate aggr1 -size 5g -type dp

#setup a snapmirror relationship and initialize
cl2::> snapmirror create -source-cluster cl1 -source-vserver SRC -source-volume SRCV \
-destination-path DST:DSTV
cl2::> snapmirror initialize -destination-path DST:DSTV

#create a lif for each vserver
cl1::> net int create -vserver SRC -lif l1 -role data -data-protocol iscsi -home-node cl1-01 \
-home-port e0d -address 192.168.4.220 -netmask 255.255.255.0
cl2::> net int create -vserver DST -lif l1 -role data -data-protocol iscsi -home-node cl2_1 \
-home-port e0d -address 192.168.4.221 -netmask 255.255.255.0

#create the iscsi target for both vservers
cl1::> iscsi create -vserver SRC
cl2::> iscsi create -vserver DST

#from windows connect with both targets 220 and 221

#list the initiators on both vservers
cl1::> iscsi initiator show
Tpgroup Initiator
Vserver Name TSIH Name ISID Igroup Name
——- ——– —- ————–
SRC l1 6 iqn.1991-05.com.microsoft:win-dhn5u460s93

cl2::> iscsi initiator show
Tpgroup Initiator
Vserver Name TSIH Name ISID Igroup Name
——- ——- —————– —————–
DST l1 2 iqn.1991-05.com.microsoft:win-dhn5u460s93

#create an igroup for windows on both vservers
cl1::> igroup create -vserver SRC -igroup WING -protocol iscsi
-ostype windows

cl2::> igroup create -vserver DST -igroup WING -protocol iscsi
-ostype windows

#populate the igroups
cl1::> igroup add -vserver SRC -igroup WING -initiator iqn.1991-05.com.microsoft:win-dhn5u460s93
cl2::> igroup add -vserver DST -igroup WING -initiator iqn.1991-05.com.microsoft:win-dhn5u460s93

#create a lun on the source volume
cl1::> lun create -vserver SRC -path /vol/SRCV/LUN1 -size 1g -ostype windows

#run a snapmirror update
cl2::> snapmirror update -destination-path DST:DSTV

#map the lun on the SRC volume to the igroup
cl1::> lun map -vserver SRC -path /vol/SRCV/LUN1 -igroup WING

#on windows, go to computer management and rescan disks
#you should see a new disk
#online it initialize it and create a filesystem in it
#open disk and put a folder in it.

#break the snapmirror relationship
cl2::> snapmirror break -destination-path DST:DSTV

#get the lun serial-hex number
cl1::> lun show -vserver SRC -path /vol/SRCV/LUN1 -fields serial-hex
vserver path serial-hex
——- ————– ————————
DST /vol/DSTV/LUN1 7737555a473f4a73737a337a

#offline the lun on the destination volume (the break command onlined the lun)
cl2::> lun offline -path /vol/DSTV/LUN1

#modify the serial-hex of the destination lun
cl2::> lun modify -path /vol/DSTV/LUN1 -serial-hex 7737555a473f4a73737a337a

#on windows, create a second folder in the disk

#resync the relationship
cl2::> snapmirror update -destination-path DST:DSTV

#FAILOVER
#unmap the lun
cl1::> lun unmap -vserver SRC -path /vol/SRCV/LUN1 -igroup WING

#break the relationship
cl2::> snapmirror break -destination-path DST:DSTV

#map the lun to the igroup
cl2::> lun map -vserver DST -path /vol/DSTV/LUN1 -igroup WING

#online the lun
cl2::> lun online -path /vol/DSTV/LUN1

#resync the snapmirror in the other direction
cl1::> snapmirror resync -destination-path SRC:SRCV -source-path DST:DSTV

#DONE

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.