In this post:
We create a source svm and a destination svm of the type
dp-destination (svmdr)
The source svm maps a lun to a linux (centos) machine.
The source svm is snapmirror to the destination svm.
The relationship is broken, the source svm is stopped and
the destination svm is started.
The client accesses the lun that is presented from the
destination svm.
Prerequisite: the two clusters are peered.
1. create source svm
cl1::> vserver create -vserver vm_iscsi -subtype \
default -rootvolume rv -aggregate n1_aggr1 \
-rootvolume-security-style unix
2. create source volume
cl1::> vol create -vserver vm_iscsi -volume \
lvol -aggregate n1_aggr1 -size 1g
3. install iscsi-utils on linux and get the initiator-id
[root]# yum -y install iscsi-initiator-utils
[root]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:37f0c74df813
4. create igroup
cl1::> igroup create -vserver vm_iscsi -igroup ling \
-protocol iscsi -ostype linux -initiator \
iqn.1994-05.com.redhat:d3afd1eed5f8
5. create iscsi in the svm
cl1::> iscsi create -vserver vm_iscsi
6. create lun
1::> lun create -vserver vm_iscsi -path /vol/lvol/l1 \
-size 800m -ostype linux -space-reserve disabled
Created a LUN of size 800m (838860800)
7. create two iscsi lifs (1 per node)
cl1::> net int create -vserver vm_iscsi -lif l212 \
-role data -data-protocol iscsi -home-node cl1-01 \
-home-port e0d -address 192.168.4.212 -netmask \
255.255.255.0 -status-admin up
cl1::> net int create -vserver vm_iscsi -lif l213 \
-role data -data-protocol iscsi -home-node cl1-02 \
-home-port e0d -address 192.168.4.213 -netmask \
255.255.255.0 -status-admin up
8. map the lun
cl1::> lun map -vserver vm_iscsi -path /vol/lvol/l1 -igroup ling
9. access the lun from linux
(first login to the svm target)
[root]# iscsiadm -m discovery -t sendtargets \
-p 192.168.4.212
[root]# iscsiadm -m node --login
(restart iscsi and check for a new disk)
[root@lin70 iscsi]# service iscsi restart
Redirecting to /bin/systemctl restart iscsi.service
[root@lin70 iscsi]# fdisk -l |grep sd
Disk /dev/sdc: 838 MB, 838860800 bytes, 1638400 sectors
10. partition the disk, create fs, mountpoint and mount
[root]# fdisk /dev/sdc
(create a primary partition that spans the whole disk)
[root]# mkfs /dev/sdc1
[root]# mkdir /iscsidisk
[root]# mount /dev/sdc1 /iscsidisk
This concludes the setup on the source svm and linux.
11. create dp-destination svm
cl2::> vserver create -vserver vm_iscsi_dr -subtype \
dp-destination
12. create a peer relation.
(cluster peering is already set up)
cl2::> vserver peer create -vserver vm_iscsi_dr \
-peer-vserver vm_iscsi -applications snapmirror \
-peer-cluster cl1
cl1::> vserver peer accept -vserver vm_iscsi \
-peer-vserver vm_iscsi_dr
13. cl2::> snapmirror create -source-path vm_iscsi: \
-destination-path vm_iscsi_dr:
cl2::> snapmirror initialize -destination-path vm_iscsi_dr:
cl2::> vol show -vserver vm_iscsi_dr
vm_iscsi_dr lvol s1_aggr1 online DP 1GB 959.5MB 6%
vm_iscsi_dr rv s1_aggr1 online RW 20MB 18.82MB 5%
14. create a lif on the dp-destination svm
cl2::> net int create -vserver vm_iscsi_dr -lif l1 \
-role data -data-protocol iscsi -home-node cl2 -home-port \
e0c -address 192.168.4.215 -netmask 255.255.255.0 \
-status-admin up
15. create iscsi on the dp-destination svm
cl2::> iscsi create -vserver vm_iscsi_dr
17. map the lun to the igroup on the dp-destination svm
cl1::> lun map -vserver vm_iscsi_dr -path /vol/lvol/l1 -igroup ling
18. stop the source svm
cl1::> vserver stop -vserver vm_iscsi
19. break the snapmirror relation and
start the dp-destination svm
cl2::> snapmirror break -destination-path vm_iscsi_dr:
cl2::> vserver start -vserver vm_iscsi_dr
20. login to the vm_iscsi_dr
[root]# iscsiadm -m discovery -t sendtargets -p 192.168.4.215
[root]# iscsiadm -m node --login
(note : -- login may have to be typed manually because this -- is not represented as -- -- or - -)
21. find out the mapped disk
[root]# fdisk -l|grep sd
/dev/sdd1 2048 1638399 818176 83 Linux
22. mount the disk
[root]# umount -f /dev/sdc1
[root]# mount /dev/sdd1 /iscsidisk
done.