When adding disks used for mirroring among servers, configure iSCSI device according to this procedure.
When adding disks to both nodes, after performing this procedure on a node, perform the same procedure on the other node.
Add disks.
On the node where the disks are added, modify the target settings to add the information of the added disks.
2-1. Execute targetcli to enter the interactive mode.
# targetcli
2-2. Register a disk or a partition of a local node where the mirroring among servers is performed.
/> /backstores/block/ create storage_name device_path
Point
Specify any character string for storage_name.
For device_path, specify the path for the by-id file of a disk or a partition on a local node which is used for the mirroring among servers.
In an Azure environment, a NIFCLOUD environment, or an environment where the by-id file does not exist, do not specify the path for the by-id file, but create a partition in the disk where the gpt disk label is set, and specify the path for the by-partuuid file for that partition.
Execution example
/> /backstores/block/ create storage1 /dev/disk/by-id/scsi-3500000e111c56611
2-3. Confirm iqn name.
/> /iscsi/ ls
Execution example
/> /iscsi/ ls o- iscsi ..................................................................... [Targets: 1] o- iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98 .................... [TPGs: 1] o- tpg1 ........................................................ [no-gen-acls, no-auth] o- acls ................................................................... [ACLs: 0] o- luns ................................................................... [LUNs: 0] o- portals ............................................................. [Portals: 0]
This example shows that iqn name is "iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98".
2-4. Connect the device registered in step 2-2.
/> /iscsi/iqn_name/tpgX/luns create /backstores/block/storage_name
Point
Specify the iqn name confirmed in step 2-3 to iqn_name.
Specify the directory name (such as tpg1) created in iqn_name directory to tpgX.
Specify the storage name registered in step 2-2 to storage_name.
Execution example
/> /iscsi/iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98/tpg1/luns create \ /backstores/block/storage1
2-5. End the interactive mode of targetcli. This operation records the settings.
/> exit
Execute the following on both nodes to rescan iSCSI session.
# iscsiadm -m session --rescan
Confirm that LUN was added on both nodes.
# iscsiadm -m session -P 3
Execution example
# iscsiadm -m session -P 3
iSCSI Transport Class version xxxxxxxx
version xxxxxxxx
Target: iqn.2003-01.org.linux-iscsi.node2.x8664:sn.c585c8864f22
Current Portal: 192.168.56.10:3260,1
Persistent Portal: 192.168.56.10:3260,1
**********
Interface:
**********
...
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
...
************************
Attached SCSI devices:
************************
Host Number: 12 State: running
scsi12 Channel 00 Id 0 Lun: 0
Attached scsi disk sdd State: running
...
Target: iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98 (*1)
Current Portal: 192.168.56.20:3260,1
Persistent Portal: 192.168.56.20:3260,1
**********
Interface:
**********
...
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
...
************************
Attached SCSI devices:
************************
Host Number: 13 State: running
scsi13 Channel 00 Id 0 Lun: 0
...
scsi13 Channel 00 Id 0 Lun: 2 (*2)
Attached scsi disk sde State: running (*3)
...
This example shows that sde (*3) for LUN2 of (*2) was added in the target "iqn.2003-01.org.linux-iscsi.node1.x8664:sn.2613f8620d98" of (*1).