Installing and Configuring Iscsi on Debian Jessie for Equallogic on Debian Jessie

Hey guys, so here I will show you how to configure the Iscsi on Debian Jessie for work with Equallogic on Debian Jessie, to be sincere is easier then in the older version of Debian.

Requisites:

  1. Debian IP 01: 10.130.0.200
  2. Debian IP 02: 10.130.0.201
  3. Equalogic IP: 10.130.0.130

Here I will authorize the connection with the storage via iqn but you can configure it with CHAP authentication is easier then with iqn.

If you want to work with multipath as I will show here we need to have a least two interfaces to work with the storage because we will have multiple channels working on the same time.

Why to work with multipath: There will have an ip as 10.130.0.200 connected to the storage and the ip 10.130.0.201 will be connected on the another channel on the storage so if one of them fails we still have connection with the storage and we can fix the problem with the connection or the hardware.

You can use the following repositories if it suits you.

vim /etc/apt/sources.list
# http://httpredir.debian.org/
# OFFICIAL REPOSITORY
deb http://httpredir.debian.org/debian jessie main contrib non-free
deb-src http://httpredir.debian.org/debian jessie main contrib non-free

# SECURITY UPDATE REPOSITORY
deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

# PROPOSE UPDATE REPOSITORY
deb http://httpredir.debian.org/debian jessie-proposed-updates main contrib non-free
deb-src http://httpredir.debian.org/debian jessie-proposed-updates main contrib non-free

Before start the process of install all the needed packets we need to update the repositories and update the whole system.

aptitude update && aptitude dist-upgrade -y

Let's install the packages that will control the iscsi connection and the multipah configuration.

aptitude install open-iscsi  multipath-tools -y

We need to restart the service to the open-iscsi generate the new iqn that will need to be allowed in the Equallogic authorization.

systemctl restart open-iscsi

Let's change the iscsi initiator I will follow the pattern: iqn-year-month.fqdn:hex, more information about the iqn can be get in the following weblink: http://en.wikipedia.org/wiki/ISCSI

vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf

After change the file we need to reload the configuration

systemctl restart open-iscsi

Now we need to make sure the connection with the storage is reachable so let's ping to them.

ping -I eth0 10.130.0.130 -c 3
PING 10.130.0.130 (192.168.130.130) from 192.130.0.200 eth0: 56(84) bytes of data.
64 bytes from 10.130.0.130: icmp_req=1 ttl=255 time=4.23 ms
64 bytes from 10.130.0.130: icmp_req=2 ttl=255 time=0.055 ms
64 bytes from 10.130.0.130: icmp_req=3 ttl=255 time=0.048 ms

--- 10.130.0.130 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.048/1.444/4.230/1.970 ms

Sometimes we have a bunch of network interfaces and one is working properly is connected in the right VLAN and the connection is ok but, sometimes the connection with the another ones is not working, so we can test the ping by interfaces as follow.

ping -I eth1 10.130.0.130 -c 3
PING 10.130.0.130 (192.168.130.130) from 192.130.0.200 eth0: 56(84) bytes of data.
64 bytes from 10.130.0.130: icmp_req=1 ttl=255 time=4.23 ms
64 bytes from 10.130.0.130: icmp_req=2 ttl=255 time=0.055 ms
64 bytes from 10.130.0.130: icmp_req=3 ttl=255 time=0.048 ms

--- 10.130.0.130 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.048/1.444/4.230/1.970 ms

As we can see above the interface eth1 is reaching the storage too.

Here I will use the Jumbo Frame that will able as to work with packages bigger than 1500 that is the default one used by network interfaces, the Jumbo Frame will work with packages in the limit of 9000 MTU, to enable it we need to configure in the /etc/network/interfaces.

vim /etc/network/interfaces
[...]
# ISCSI 1
auto eth0
iface eth0 inet static
        address 10.130.0.200
        netmask 255.255.255.0
        network 10.130.0.0
        broadcast 10.130.0.255
        mtu 9000

# ISCSI 2
auto eth1
iface eth1 inet static
        address 10.130.0.201
        netmask 255.255.255.0
        network 10.130.0.0
        broadcast 10.130.0.255
        mtu 9000
[...]

We can reload all the configuration of the iscsi interfaces bring them down.

ifconfig eth0 down
ifconfig eth1 down

Now we need to brind them up again.

ifup eth0
ifup eth1

Now let's check out the new configuration of the interface eth0.

ifconfig eth0
eth0      Link encap:Ethernet  Endereço de HW a4:ba:db:23:fb:14  
          inet end.: 10.130.0.200  Bcast:10.130.0.255  Masc:255.255.255.0
          endereço inet6: fe80::a6ba:dbff:fe23:fb14/64 Escopo:Link
          UP BROADCASTRUNNING MULTICAST  MTU:9000  Métrica:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:1000 
          RX bytes:704 (704.0 B)  TX bytes:492 (492.0 B)
          IRQ:36 Memória:d2000000-d2012800 

Let's check out the configuration of the interface eth1.

ifconfig eth1
eth1      Link encap:Ethernet  Endereço de HW a4:ba:db:23:fb:16  
          inet end.: 10.130.0.201  Bcast:10.130.0.255  Masc:255.255.255.0
          endereço inet6: fe80::a6ba:dbff:fe23:fb16/64 Escopo:Link
          UP BROADCASTRUNNING MULTICAST  MTU:9000  Métrica:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          colisões:0 txqueuelen:1000 
          RX bytes:896 (896.0 B)  TX bytes:492 (492.0 B)
          IRQ:48 Memória:d4000000-d4012800 

Now we need to test the connectivity with the storage whether is working or not.

ping -I eth0 10.130.0.130 -c 3
PING 10.130.0.130 (192.168.130.130) from 192.130.0.200 eth0: 56(84) bytes of data.
64 bytes from 10.130.0.130: icmp_req=1 ttl=255 time=4.23 ms
64 bytes from 10.130.0.130: icmp_req=2 ttl=255 time=0.055 ms
64 bytes from 10.130.0.130: icmp_req=3 ttl=255 time=0.048 ms

--- 10.130.0.130 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.048/1.444/4.230/1.970 ms

As we can see above the connection is configured properly so let's test in the another one iscsi interface.

ping -I eth1 10.130.0.130 -c 3
PING 10.130.0.130 (192.168.130.130) from 192.130.0.200 eth0: 56(84) bytes of data.
64 bytes from 10.130.0.130: icmp_req=1 ttl=255 time=4.23 ms
64 bytes from 10.130.0.130: icmp_req=2 ttl=255 time=0.055 ms
64 bytes from 10.130.0.130: icmp_req=3 ttl=255 time=0.048 ms

--- 10.130.0.130 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.048/1.444/4.230/1.970 ms

Now we need to change the configuration of the iscsid.conf that will persist through the time boot.

vim /etc/iscsi/iscsid.conf
[...]
# To request that the iscsi initd scripts startup a session set to "automatic".
node.startup = automatic
#
# To manually startup the session set to "manual". The default is manual.
# node.startup = manual
# If you want to use the CHAP authentication use the following configuration.
[...]
# To enable CHAP authentication set node.session.auth.authmethod
# to CHAP. The default is None.
node.session.auth.authmethod = CHAP
# User authentication that will be used to valid the connection
node.session.auth.username = username
# Password used by the user authentication defined above.
node.session.auth.password = password
# Method use by the CHAP authentication to discovery the LUN
discovery.sendtargets.auth.authmethod = CHAP
# User that will used to discovery the LUN can the same as the authentication.
discovery.sendtargets.auth.username = username
# Password used by the user that will be used to discovery the LUN
discovery.sendtargets.auth.password = password
# To control how many commands the session will queue set
# node.session.cmds_max to an integer between 2 and 2048 that is also
# a power of 2. The default is 128.
node.session.cmds_max = 1024 
[...]
# To control the device's queue depth set node.session.queue_depth
# to a value between 1 and 1024. The default is 32.
node.session.queue_depth = 128
[...]
# Some targets like IET prefer after an initiator has sent a task
# management function like an ABORT TASK or LOGICAL UNIT RESET, that
# it does not respond to PDUs like R2Ts. To enable this behavior uncomment
# the following line (The default behavior is Yes):
#node.session.iscsi.FastAbort = Yes

# Some targets like Equalogic prefer that after an initiator has sent
# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that
# it continue to respond to R2Ts. To enable this uncomment this line
node.session.iscsi.FastAbort = No

Now let's restart the service to reload all the new configuration.

systemctl restart open-iscsi

Now we need to list the LUN available to us by the Storage.

iscsiadm -m discovery -t st -p 10.130.0.130:3260
10.130.0.130:3260,1 iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos

As we can see we got only one instance of the storage connection, then we need to enable both interface connection to use the multipath.

Let's enable the multipath setting up which interfaces needs to be used when need to connection in the storage.

iscsiadm -m iface -I eth0 -o new && iscsiadm -m iface -I eth1 -o new
New interface eth0 added
New interface eth1 added

Now we need to update the physical interface name that is the same as we use such as eth0 and eth1.

iscsiadm -m iface -I eth0 -o update -n iface.net_ifacename -v eth0
eth0 updated.

As we configured the interface eth0 we need to use the same process to the another one.

iscsiadm -m iface -I eth1 -o update -n iface.net_ifacename -v eth1 
eth1 updated.

Now we need to restart the multipath and the open-iscsi service to recognize the new configuration.

systemctl restart multipath-tools
systemctl restart multipath-tools-boot
systemctl restart open-iscsi

Now we need to logout of the enabled session.

iscsiadm -m node -u

Now we need to discovery the LUN again.

iscsiadm -m discovery -t st -p 10.130.0.130:3260
10.130.0.130:3260,1 iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos
10.130.0.130:3260,1 iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos

As we can see we have now two instances of the LUN because we enable the open-iscsi to work with the both interfaces.

Now let's connect in the storage.

iscsiadm -m node -l -T iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos -p 10.130.0.130:3260
Logging in to [iface: eth0, target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos, portal: 10.130.0.130,3260]
Logging in to [iface: eth1, target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos, portal: 10.130.0.130,3260]
Login to [iface: eth0, target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos, portal: 10.130.0.130,3260]: successful
Login to [iface: eth1, target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos, portal: 10.130.0.130,3260]: successful

Now we can check out the session that are open by the server on the storage.

iscsiadm -m session -P 2
Target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos
  Current Portal: 10.130.0.133:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth0
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.200
    Iface HWaddress: <empty>
    Iface Netdev: eth0
    SID: 5
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
  Current Portal: 10.130.0.134:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth1
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.201
    Iface HWaddress: <empty>
    Iface Netdev: eth1
    SID: 6
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1

Now we need to create a file that will control the multipath configuration by default this file does not exists, so we need to create it.

vim /etc/multipath.conf
blacklist {
   devnode "^sd[a]$"
}

multipaths {
   multipath {
      path_grouping_policy  "multibus"
      path_selector         "round-robin 0"
      failback              "immediate"
      rr_weight             "priorities"
      no_path_retry         5
   }
}

Now we need to restart the multipath service.

systemctl restart multipath-tools

Now we need to check out the multipath output.

multipath -ll
36090a078d0ca7e4225fb642f0714088a dm-0 EQLOGIC,100E-00
size=8.0T features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=2 status=active
  |- 11:0:0:0 sdb 8:16 active ready running
  `- 10:0:0:0 sdc 8:32 active ready running

Now we need to get the multipath id that is 36090a078d0ca7e4225fb642f0714088a to configure an alias into the multipath configuration file.

vim /etc/multipath.conf
#/etc/multipath.conf
blacklist {
   devnode "^sd[a]$"
}

multipaths {
   multipath {
      wwid                   36090a078d0ca7e4225fb642f0714088a
      alias                  arquivos
      path_grouping_policy  "multibus"
      path_selector         "round-robin 0"
      failback              "immediate"
      rr_weight             "priorities"
      no_path_retry         5
   }
}

I will not use a lot of options into the multipath because the defaults one are pretty good for what I need, but you can check out the default configuration for all kind of hardware available with the following command line.

multipath -t
defaults {
	verbosity 2
	polling_interval 5
	max_polling_interval 20
	reassign_maps "yes"
	multipath_dir "/lib/multipath"
	path_selector "service-time 0"
	path_grouping_policy "failover"
	uid_attribute "ID_SERIAL"
	prio "const"
	prio_args ""
	features "0"
	path_checker "directio"
	alias_prefix "mpath"
	failback "manual"
	rr_min_io 1000
	rr_min_io_rq 1
	max_fds "max"
	rr_weight "uniform"
	queue_without_daemon "no"
	flush_on_last_del "no"
	user_friendly_names "no"
	fast_io_fail_tmo 5
	bindings_file "/etc/multipath/bindings"
	wwids_file /etc/multipath/wwids
	log_checker_err always
	retain_attached_hw_handler no
	detect_prio no
}
blacklist {
	devnode "^xvd[a]$"
	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
	devnode "^(td|hd)[a-z]"
	devnode "^dcssblk[0-9]*"
	devnode "^cciss!c[0-9]d[0-9]*"
	device {
		vendor "DGC"
		product "LUNZ"
	}
	device {
		vendor "EMC"
		product "LUNZ"
	}
	device {
		vendor "IBM"
		product "Universal Xport"
	}
	device {
		vendor "IBM"
		product "S/390.*"
	}
	device {
		vendor "DELL"
		product "Universal Xport"
	}
	device {
		vendor "SGI"
		product "Universal Xport"
	}
	device {
		vendor "STK"
		product "Universal Xport"
	}
	device {
		vendor "SUN"
		product "Universal Xport"
	}
	device {
		vendor "(NETAPP|LSI|ENGENIO)"
		product "Universal Xport"
	}
}
blacklist_exceptions {
	property "(SCSI_IDENT_.*|ID_WWN)"
}
[...]

Another good one resouce is the man:

man multipath.conf

Now let's restart the multipath service.

systemctl restart multipath-tools

Now let's list the multipath topology

multipath -ll
arquivos (36090a078d0ca7e4225fb642f0714088a) dm-0 EQLOGIC,100E-00
size=8.0T features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=2 status=active
  |- 11:0:0:0 sdb 8:16 active ready running
  `- 10:0:0:0 sdc 8:32 active ready running

Now we can see we have an alias to work with rather than to work with the ID.

Now let's check if the device was created into /dev/mapper

ls -l /dev/mapper/*
lrwxrwxrwx 1 root root      7 Mai 25 17:59 /dev/mapper/arquivos -> ../dm-0
crw------- 1 root root 10, 59 Mai 25 17:37 /dev/mapper/control

If we are working with a LUN smaller then 2TB we can use the cfdisk or the fdisk to create the partitions in this case after create a new partition is a good practice restart the service.

Now we need to create the partition, as the partition I will work with is bigger than 2TB I shall need to use the parted to create it.

Let's install the parted

aptitude install parted -y

Now let's create the partition the device that will be used to be handle is /dev/mapper/arquivos.

parted /dev/mapper/arquivos
GNU Parted 2.3
Using /dev/mapper/arquivos
Welcome to GNU Parted Type 'help' to view a list of commands.
(parted)   

Now we need to set up the partition as GPT

(parted) mklabel gpt

Now we need to agree with the operation.

Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted)

Now let's set up the unit to be TB

(parted) unit TB

Now I will use all the size of the LUN to store the filesystem.

(parted) mkpart primary 0.00TB 8.00TB

Now let's check if the partition was created successfully.

(parted) print                                                            
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/arquivos: 8796GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      1049kB  8000GB  8000GB  ext4         primary

Now let's exit from the parted.

(parted) quit

Now we shall get a warning about the /etc/fstab configuration need to be done to bring up the new partition linked to a directory in the boot time.

Now we need to create the file system that will be used in this partition, here I will use the ext4 without any parameter in special.

Note: Is a good practice use the -m with 0 in a big partition because if you not use this option will be reserved 5% of the whole partition to the root user rescue in some cases this is not a lot of space but in some cases it can be a lot.

mkfs.ext4 /dev/mapper/arquivos-part1

After created the filesystem we can mount the partition, so let's do that.

mount /dev/mapper/arquivos-part1 /srv/

Now we can check out the mounted partitions.

df -Th
Sist. Arq.    Tipo    Size  Used Avail Use% Montado em
/dev/sda2     ext4    4,6G  264M  4,1G   6% /
tmpfs        tmpfs     24G     0   24G   0% /lib/init/rw
udev         tmpfs     24G  212K   24G   1% /dev
tmpfs        tmpfs     24G     0   24G   0% /dev/shm
/dev/sda1     ext4    184M   21M  155M  12% /boot
/dev/sda8     ext4     19G  172M   18G   1% /home
/dev/sda5     ext4    1,9G   35M  1,8G   2% /tmp
/dev/sda7     ext4     19G  510M   17G   3% /usr
/dev/sda6     ext4     19G  311M   18G   2% /var
/dev/mapper/arquivos-part1
              ext4    7,2T  1,6T  5,3T  23% /srv

If you can persist this configuration in the boot time we need to add a new line into the /etc/fstab to make sure the partition will be brought up in the boot time.

vim /etc/fstab
[...]
/dev/mapper/arquivos-part1 /srv  ext4  _netdev,defaults,noatime 0 0

Now we can restart the server to check if the partitions will used without any issue.

reboot

Let's list the partitions again.

df -Th
[...]
/dev/mapper/arquivos-part1 ext4    7,2T  198M  7,2T  1% /srv

Now we can test the multipath configuration to make sure that everything is work properly.

Let's bring down the eth0 network interface.

ifdown eth0

Now let's check the sessions with the storage.

iscsiadm -m session -P 2
Target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos
  Current Portal: 10.130.0.133:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth0
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.200
    Iface HWaddress: <empty>
    Iface Netdev: eth0
    SID: 5
    iSCSI Connection State: TRANSPORT WAIT
    iSCSI Session State: FAILED
    Internal iscsid Session State: REOPEN
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
  Current Portal: 10.130.0.134:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth1
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.201
    Iface HWaddress: <empty>
    Iface Netdev: eth1
    SID: 6
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1

As we can see we lost a channel with the storage however we still have access to the storage by the another channel, so we can test the channel creating a new directory into the storage partition.

mkdir /srv/eth0down

Now let's list the directories into the storage partition.

ls /srv/
eth0down  lost+found

As we can see even though we lost one channel with the storage our partition is still working. Now let's bring up the eth0 interface again.

Bringing up the eth0 network interface again.

ifup eth0

Now let's bring down the eth1 network interface.

ifdown eth1

Now let's check the channels with the storage again.

iscsiadm -m session -P 2
Target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos
  Current Portal: 10.130.0.133:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth0
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.200
    Iface HWaddress: <empty>
    Iface Netdev: eth0
    SID: 5
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
  Current Portal: 10.130.0.134:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth1
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.201
    Iface HWaddress: <empty>
    Iface Netdev: eth1
    SID: 6
    iSCSI Connection State: TRANSPORT WAIT
    iSCSI Session State: FAILED
    Internal iscsid Session State: REOPEN
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1

As we can see we have only one channel active and we lost the channel via eth1, so let's create another directory into the storage partition.

mkdir /srv/eth1down

Now let's list our directories.

ls -l /srv/
total 24
drwxr-xr-x 2 root root  4096 May 30 10:37 eth0down
drwxr-xr-x 2 root root  4096 May 30 10:42 eth1down
drwx------ 2 root root 16384 May 30 10:22 lost+found

As we can see our partition remains the same although without a channel. With it we will guarantee the availability of the partition with the multipath service.

Now let's bring up the eth1 network interface again and enable the both channels.

ifup eth1

Now let's check the session opened with the storage.

iscsiadm -m session -P 2
Target: iqn.2012-05.com.equallogic:0-8a0906-427ecad07-910814072f64fb46-arquivos
  Current Portal: 10.130.0.133:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth0
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.200
    Iface HWaddress: <empty>
    Iface Netdev: eth0
    SID: 5
    iSCSI Connection State: TRANSPORT WAIT
    iSCSI Session State: FAILED
    Internal iscsid Session State: REOPEN
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1
  Current Portal: 10.130.0.134:3260,1
  Persistent Portal: 10.130.0.130:3260,1
    **********
    Interface:
    **********
    Iface Name: eth1
    Iface Transport: tcp
    Iface Initiatorname: iqn.2012-05.br.com.douglasqsantos:4e67cb9a1aaf
    Iface IPaddress: 10.130.0.201
    Iface HWaddress: <empty>
    Iface Netdev: eth1
    SID: 6
    iSCSI Connection State: LOGGED IN
    iSCSI Session State: LOGGED_IN
    Internal iscsid Session State: NO CHANGE
    ************************
    Negotiated iSCSI params:
    ************************
    HeaderDigest: None
    DataDigest: None
    MaxRecvDataSegmentLength: 262144
    MaxXmitDataSegmentLength: 65536
    FirstBurstLength: 65536
    MaxBurstLength: 262144
    ImmediateData: Yes
    InitialR2T: No
    MaxOutstandingR2T: 1

As we can see everything is working properly.

Useful Commands

Log into all targets

iscsiadm –m node –l

To see the connection status

iscsiadm -m session

Login individual target

You can also Log into an individual target as below. You might see multiple iface because I have configured multipathing.

iscsiadm -m node -l -T iqn.2001-05.com.equallogic:0-8a0906-3a86b2a07-c4e150b3415519cb-centos-cluster -l -p 192.168.40.10:3260
Logging in to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-3a86b2a07-c4e150b3415519cb-centos-cluster, portal: 192.168.40.10,3260] (multiple)
Login to [iface: default, target: iqn.2001-05.com.equallogic:0-8a0906-3a86b2a07-c4e150b3415519cb-centos-cluster, portal: 192.168.40.10,3260] successful.

Logging out all targets.

iscsiadm –m node –u

Logging off an individual target.

Shown an example below

iscsiadm –m node –u –T iqn.2001-05.com.equallogic:0-8a0906-3a86b2a07-c4e150b3415519cb-centos-cluster –p <Group IP address>:3260

Find device name

Find the newly created device name, using the iscsiadm command. In this test configuration, the new volume is /dev/sdb. At the end of the output you could see attached scsi disk name.

iscsiadm -m session -P3

Delete session records

To manually delete the records sessions -o delete option. Be sure to enter the appropriate iscsi targetname

iscsiadm –o delete

To manually delete the records sessions -o delete option. Be sure to enter the appropriate iscsi targetname as follow

iscsiadm -m node -o delete -T iqn.2001-05.com.equallogic:0-8a0906-3a86b2a07-c4e150b3415519cb-centos-cluster –p <Group IP address>:3260

Rescan lun

When you expand the volume or disk, you might need to rescan. So the below command will help.

iscsiadm -m node -p 192.168.40.10 --rescan

Referências