
List active iscsi sessions
iscsiadm -m session #Basic iscsiadm -m session -P 3 #Display more info
View iscsi statistics
iscsiadm -m node -s -T
Multipathing - Setting Devices
List connections
multipath -l
Show the multipath config
multipath -t
Example of adding an Acronis ACI storage device
vi /etc/multipath.conf
# Add the following for VStorage into the devices section
device {
vendor "VSTORAGE"
product "VSTOR-DISK"
features "2 pg_init_retries 50"
hardware_handler "1 alua"
path_grouping_policy group_by_node_name
path_selector "round-robin 0"
no_path_retry queue
user_friendly_names no
flush_on_last_del yes
failback followover
path_checker tur
detect_prio no
prio alua
}
# Reload multipath
systemctl reload multipathd
Multipathing - Setting limits
When enabling multipathing inside XenServer (or other Linux distros) the timeout values inside iscsid.conf need to be set. In the past we have had to set these to higher values when the SAN wouldn't failover quick enough, now with the new SAN being active/active requires multipathing as its HA with low timeouts.
View the timeouts
iscsiadm -m session -P 3 | grep Timeout

In this example the recovery timeouts are defaults, 5, 30, 30 and 15 which works well for multipathing
Modify the timeouts
vim /etc/iscsi/iscsid.conf # Time interval to wait for on connection before sending a ping. (set to 0 for unlimited) node.conn[0].timeo.noop_out_interval = 10 # To specify the time to wait for a Nop-out response before failing # the connection, edit this line. Failing the connection will # cause IO to be failed back to the SCSI layer. If using dm-multipath # this will cause the IO to be failed to the multipath layer. (set to 0 for unlimited) node.conn[0].timeo.noop_out_timeout = 15 # To specify the length of time to wait for session re-establishment # before failing SCSI commands back to the application when running # the Linux SCSI Layer error handler, edit the line. # The value is in seconds and the default is 120 seconds. # Special values: # - If the value is 0, IO will be failed immediately. # - If the value is less than 0, IO will remain queued until the session # is logged back in, or until the user runs the logout command. (was set to 120) node.session.timeo.replacement_timeout = 5
When the targets have already been logged in, you can update the configuration by running the following commands
iscsiadm -m node -T $target_name -p $target_ip:$port -o update -n node.session.timeo.replacement_timeout -v $timeout_value #Example iscsiadm -m node -T iqn.2000-01.com.emc:server.target-1.c76f957b36 -p 10.16.1.51:3260 \ -o update -n node.session.timeo.replacement_timeout -v 5
Or a basic reload (reloads the configuration without service interruption)
service iscsid reload
In this example we need to check the session error timeout and change on the fly without restarting the storage system
grep -n node.session.err_timeo.lu_reset_timeout /etc/iscsi/iscsid.conf
123:node.session.err_timeo.lu_reset_timeout = 86400 vi +123 /etc/iscsi/iscsid.conf Set the value to 30 iscsiadm -m session -P 3 | grep Timeout Still returns the large 86400 value as expected # Set the value to 30 using the following command iscsiadm -m node -T iqn.1992-04.com.emc:cx.cetv3183200046.a1 -p 10.16.1.12:3260 -o update -n node.session.err_timeo.lu_reset_timeout -v 30
# Restart iscsi service service iscsid restart
Other ISCSI Options
Discover available targets from a portal, mostly used
iscsiadm -m discovery -t sendtargets -p ipaddressTarget address configuration
Example:
# iscsiadm -m discovery -t sendtargets -p pps11
[ OK ]
20.12.1.147:3260,1 iqn.2015-01.com.fibrevillage.pps11:pps11.target1
Add a target address for dynamic discovery
iscsiadm add discovery-address 10.0.0.1:3260
Add a iSNS server address for dynamic discovery
iscsiadm add iSNS-server 10.0.0.1:3205
Add a static address for discovery
iscsiadm add static-config eui.5000ABCD78945E2B,10.0.0.1Target address discovery
For dynamic discovered address
iscsiadm modify discovery --sendtargets enable
For iSNS discovered address
iscsiadm modify discovery --iSNS enable
For static discovered address
iscsiadm modify discovery --static enableLog into a specific target
iscsiadm -m node -T targetname -p ipaddress -lLog out of a specific target
This command is equivelent to
/etc/init.d/iscsi start
Which calls
/sbin/iscsiadm -m node --loginall=automatic
Of course there is a different if you have multiple targets
iscsiadm -m node -T targetname -p ipaddress -uDisplay information about a target
Similar to login, it's equivelent to
/etc/init.d/iscsi stop
which calls
/sbin/iscsiadm -m node --logoutall=all
iscsiadm -m node -T targetname -p ipaddressDisplay statistics about a target
iscsiadm -m node -s -T targetname -p ipaddress
Remove the portal address to receive information or statistics about all targets.
Display list of all current sessions logged iniscsiadm -m sessionView iSCSI database regarding discovery
Example:
iscsiadm -m session
tcp: [2] 20.12.1.147:3260,1 iqn.2015-01.com.fibrevillage.pps11:pps11.target1 (non-flash)
It's similar to
/etc/init.d/iscsi status
which calls
iscsiadm -m session -P 3
-P 3 stands for mover verbal printlevel
iscsiadm -m discovery -o showView iSCSI database regarding targets to log into
iscsiadm -m node -o showView iSCSI database regarding sessions logged into
iscsiadm -m session -o show