Setting the iSCSI qualified name for the Linux host
To correctly specify the iSCSI qualified name (IQN) for the Linux® host, the initiator name that you choose must match the iSCSI name that is given to the host object for this system.
- Edit the /etc/iscsi/initiatorname.iscsi file to specify the IQN name. The
following example shows a sample
name:
InitiatorName= iqn.1986-03.com.ibm:iscsihost.0 - After you change the initiator name, you must start the iSCSI-initiator service again.
Configuring more than one Linux host Ethernet port for iSCSI
If you want to configure more than one Linux host Ethernet port for iSCSI, methods are available to improve routing and maintain optimal redundancy in cases of dynamic discovery.
- About this task
- You can use one of the following two methods:
- Configure different subnet IP addresses for the host ports and the system ports. Each target IP of a system node is accessible only from one host IP of the corresponding subnet. As a result, pairs of host and system ports are in separate subnets.
- In the /etc/iscsi/ifaces subdirectory, create a separate iface configuration file for each network object that you want to bind a session to. Each iface config file must have a unique name that is less than or equal to 64 characters in length.
- Procedure
- The following iface example shows a simple case with two network devices (eth0 and eth1):
- Edit the /etc/iscsi/ifaces/eth0 file to specify the
iface.net_ifacename:
iface.net_ifacename = eth0 - Similarly, edit the /etc/iscsi/ifaces/eth1
file:
iface.net_ifacename = eth1
- Edit the /etc/iscsi/ifaces/eth0 file to specify the
iface.net_ifacename:
iSCSI target discovery for Linux hosts
- Send Targets
- Internet storage name service (iSNS)
After discovery, you use the iscsiadm command to log in to or log out of a specific portal on a discovered target.
- Discovering iSCSI targets by using send targets
-
You can discover iSCSI target portals by using the send targets method. The iscsiadm command returns the IQN and target portals that are associated with the system node.
Run the discovery command:
where x.x.x.x is the IP address of a node Ethernet port on the system.iscsiadm --mode discovery --type sendtargets --portal x.x.x.xTip: You can substitute-mfor--mode,-tfor--type, and-pfor--portalin the discovery command.Command output similar to the following example is displayed:x.x.x.x:3260, 1 iqn.1986-03.com.ibm:2145.china5.hlnc111874 - Discovering iSCSI targets on your Linux host by using iSNS
-
You can discover iSCSI target portals by using the internet storage name service (iSNS) method. Before you use the iSNS discovery, you must do the following tasks:
- Configure the system to use iSCSI.
- Configure the system to use your iSNS server.
- Verify that the system nodes registered their target portals with the iSNS server. If the node iSCSI addresses are visible to the iSNS server, this registration occurs automatically.
To discover iSCSI targets by using iSNS, complete the following steps:- Modify the iSNS server settings in the /etc/iscsi/iscsid.conf file by
entering the IP address and the port number that is used by your iSNS
server:
isns.address = <iSNS server IP address> isns.port = <iSNS server port> - Make the iSNS configuration changes effective by restarting the iSCSI initiator service.
- Run the iSNS discovery command to generate a list of all iSCSI target portals that are
registered with the iSNS server:
iscsiadm --mode discovery --type isns
- Logging in to discovered targets
-
You can connect to a specific portal on a discovered target by using the iscsiadm command. The system supports only one iSCSI session between an initiator and a target. Ensure that you do not attempt to connect to the same target node more than once.
Log in the iSCSI initiator to your selected system targets by using the following appropriate command examples:
For SLES:
For example:iscsiadm --mode node --target target_IQN --portal x.x.x.x --loginiscsiadm --mode node --target iqn.1986-03.com.ibm:2145.cluster10g1.node1 --portal 192.168.64.191 --login.For RHEL:
For example:iscsiadm --mode node --targetname target_IQN --portal x.x.x.x --loginiscsiadm --mode node --targetname iqn.1986-03.com.ibm:2145.cluster10g1.node1 --portal 192.168.64.191 --login.When the login command completes, the host can access the volumes that are mapped to the host from the target after the SCSI devices are rescanned.
- Logging out from targets
-
You can log out of a specific system target or you can log out of all established sessions.Note: After you log out of a system target, the iSCSI volumes that it serves are no longer available to the host.
- To log out of a specific system target, enter the following
command:
iscsiadm --mode node --target <IQN> --portal x.x.x.x --logout - To log out of all your established sessions, enter the following
command:
iscsiadm --mode node --logoutall=all
- To log out of a specific system target, enter the following
command:
iSCSI timeout configuration settings for the system
You can set the timeout value for disks. The disk timeout is set in the /sys/block/<device>/device/timeout file. Depending on operating system and OS version, increase the default value of 30 or 60 seconds to 120 in most situations.
[root@R64SRV6 ~]#echo -n 60 > /sys/block/sdc/device/timeoutudev rules file
cat /etc/udev/rules.d/99-ibm-2145.rules
# Set SCSI command timeout to 120s (default == 30 or 60) for IBM 2145 devices
SUBSYSTEM=="block", ACTION=="add", ENV{ID_VENDOR}=="IBM",
ENV{ID_MODEL}=="2145", RUN+="/bin/sh -c 'echo 120 > /sys/block/%k/device/timeout'"multipath -ll | grep sd to locate the block device paths. Also, check with
cat /sys/block/sd<x>/device/timeout for 120 seconds, where
<x> is a 2145 path. For example:
edam:~ # multipath -ll | grep sd | tail -1
`- 10:0:0:4 sdl 8:176 active ready running
edam:~ # cat /sys/class/block/sdl/device/timeout
120
edam:~ #