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.
The procedures are different depending on OS version.
[RHEL6]
Add disks.
Modify the /etc/tgt/targets.conf file to add the disk information on the node where the disks were added. For the description, refer to "4.8.3 Creating iSCSI Target."
[Example before changing]
<target target-0101> initiator-address 192.168.56.20 initiator-address 192.168.56.10 write-cache off <backing-store /dev/disk/by-id/scsi-3500000e114784363> lun 1 scsi_id SDX01 </backing-store> </target>
[Example after changing]
<target target-0101> initiator-address 192.168.56.20 initiator-address 192.168.56.10 write-cache off <backing-store /dev/disk/by-id/scsi-3500000e114784363> lun 1 scsi_id SDX01 </backing-store> <backing-store /dev/disk/by-id/scsi-3500000e111c56611> lun 2 scsi_id SDX02 </backing-store> </target>
When a node that was added a disk is an operation node, switch over the cluster application.
Restart a node that was added a disk.
Rescan an iSCSI session on a node which has not been restarted.
# 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: target-0201
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
scsi12 Channel 00 Id 0 Lun: 1
Attached scsi disk sdd State: running
...
Target: target-0101 (*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 "target-0101" of (*1).
[RHEL7]
Add disks.
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 by-id file of a disk or a partition on a local node which is used for the mirroring among servers.
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).