Configure ISCSI Multipathing in Linux

Loading

This blog will walk you through the procedure to configure multipathing in Linux using device mapper multipathing which is the native multipathing in Linux. Multipathing combines multiple I/O paths between servers and storage and creates a single device at the OS. As part of this install, I’ve already configured my ISCSI target server on a Microsoft Server and we will be attaching it to that ISCSI san.

1. Install ISCSI Initiator package.

yum -y install iscsi-initiator-utils.x86_64

2. Check installed  HBA modules  with  lspci

yum install -y pciutils
lspci |grep -i fibr

2. Start ISCSI Initiator service.

systemctl start iscsid.service

3. Get ISCSI ID Info

[root@virt-scale-03 ~]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:7f598a789f

4. Add the IQN to the SAN Array

4. Enable initiators to find targets (logical drives mapped to the host) by
specifying iSCSI host port addresses / Login to the ISCSI Server – Path A

root@virt-scale-04 ~]# iscsiadm -m discovery -t st -p 172.27.13.100
172.27.13.100:3260,1 iqn.1991-05.com.microsoft:win-opjkarsc1hv-esx-san-target
172.27.13.101:3260,1 iqn.1991-05.com.microsoft:win-opjkarsc1hv-esx-san-target

5. Enable initiators to find targets (logical drives mapped to the host) by
specifying iSCSI host port addresses/ Login to the ISCSI Server – Path B

[root@virt-scale-04 ~]# iscsiadm -m discovery -t st -p 172.27.13.101
172.27.13.101:3260,1 iqn.1991-05.com.microsoft:win-opjkarsc1hv-esx-san-target
172.27.13.100:3260,1 iqn.1991-05.com.microsoft:win-opjkarsc1hv-esx-san-target

6. Login to the iSCSI targets:

root@virt-scale-04 ~]# iscsiadm -m node -T iqn.1991-05.com.microsoft:win-opjkarsc1hv-esx-san-target -P 172.27.13.100 -l

7. Install Device Mapper Multipath package.

Install the device-mapper-multipath package.

[root@virt-scale-04 ~]# yum -y install device-mapper-multipath

8. Set the multipath daemon starts on bootup

chkconfig multipathd on

9. Basic Configuration of Linux Device Mapper Multipathing

Take a backup of the configuration file /etc/multipath.conf file and edit the configuration file to ensure you have the following entries

defaults {
user_friendly_names yes
find_multipaths yes
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]" devnode "^hd[a-z]" devnode "^cciss!c[0-9]d[0-9]"
}
multipaths {
 multipath {
           wwid                    360003ff44dc75adc95698676b2fbf9a0
           alias                   nsd-01
   }


   multipath {
           wwid                    360003ff44dc75adcbddbaa76e5d90368
           alias                   nsd-02
   }

   multipath {
           wwid                    360003ff44dc75adc92b0a3c4d0b82d17
           alias                   nsd-03
   }

}

The blacklist includes the devices which are not to be configured for Multipathing. Typically our OS installed disk is /dev/sd so the first entry in the blacklist will exclude it.

10. Start and Enable multipath daemons.

[root@virt-scale-04 ~]# systemctl start multipathd

Enable the multipath service to start on boot.

[root@virt-scale-04 ~]# systemctl enable multipathd

Check the status of the multipath service

[root@virt-scale-04 ~]# systemctl status multipathd

11. Check multipathing status.

Print the status of multipath devices using the command multipath -ll

12 Check if the device alias is appearing correctly

root@virt-scale-04 etc]# ll /dev/mapper/

12 Check multipathing IO by disabling a path on san

13 How to find the WWID of storage disk including a multipath device?

root@lnx03 doc]# lsscsi -i
[3:0:0:0]    cd/dvd  NECVMWar VMware SATA CD01 1.00  /dev/sr0   -
[32:0:0:0]   disk    LIO-ORG  disk01           4.0   /dev/sda   360014053c7523e7faeb41f8bb8b107db
[33:0:0:1]   disk    LIO-ORG  disk02           4.0   /dev/sdg   36001405a8213c3d09fb4f3992ea666fd
[33:0:0:2]   disk    LIO-ORG  disk03           4.0   /dev/sdh   360014056d147dfeeca44034937600170
[33:0:0:3]   disk    LIO-ORG  disk04           4.0   /dev/sdf   3600140540228bfc4b894a0b8a09a1f7a

or 

[root@lnx03 doc]# sg_inq -p 0x83 /dev/sda | grep "designator_type: NAA" -A 5
    designator_type: NAA,  code_set: Binary
    associated with the Addressed logical unit
      NAA 6, IEEE Company_id: 0x1405
      Vendor Specific Identifier: 0x3c7523e7f
      Vendor Specific Identifier Extension: 0xaeb41f8bb8b107db
      [0x60014053c7523e7faeb41f8bb8b107db]
or

# scsi_id -g -u /dev/sdh
36000097123456789abcdeffedcba9876
(Visited 49 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.