Mastering Linux DM Multipathing and iSCSI Block Storage on Red Hat Enterprise Linux
Linux Device Mapper Multipath (DM Multipath) is a feature used in enterprise storage environments to provide redundancy and improved performance by allowing a system to access storage devices over multiple physical paths.
For this post I will use iSCSI block storage provided by a Microsoft iSCSI Target server to show how we can set up DM multipath on Red Hat Enterprise Linux.
Finally we connect an iSCSI target (virtuell disk) to Red Hat Enterprise Linux by using multiple NICs/IP addresses on the iSCSi Target server to provide at least two physical paths to connect the disk and showing how DM Multipathing works.
In my previous post we will see how to set up DM multipath on SUSE Linux Enterprise Server.
Set up the iSCSI Target Server
About how to set up a Microsoft iSCSI Target Server step by step you can also read my following post.





Set up the iSCSI Initiator on Red Hat Enterprise Linux
An iSCSI initiator forms a session to connect to the iSCSI target. By default, an iSCSI service is lazily started and the service starts after running the iscsiadm command. If root is not on an iSCSI device or there are no nodes marked with node.startup = automatic then the iSCSI service will not start until an iscsiadm command is executed that requires iscsid or the iscsi kernel modules to be started.
Execute the systemctl start iscsid.service command as root to force the iscsid daemon to run and iSCSI kernel modules to load.
# systemctl start iscsid.service # systemctl restart iscsi.service

Create an iSCSI initiator to connect to the iSCSI target to access the storage devices on the server.
Install iscsi-initiator-utils on client machine if not already intalled.
# yum install iscsi-initiator-utils
Check the initiator name:
cat /etc/iscsi/initiatorname.iscsi

Restart the iscsid service and check if it is running.
# systemctl restart iscsid # systemctl status iscsid

Connect to iSCSI Target
We first discover the target and log in to the target with the displayed target IQN.
# iscsiadm -m discovery -t st -p 10.0.0.40 # iscsiadm -m node -T iqn.1991-05.com.microsoft:iscsi-01-virtual-target02-target -l

Because so far we not enabled DM multipathing and the iSCSI Target server target is available through multiple NICs/IP addresses, the disk is now shown up twice, sdc and sdd.

Therefore I will first logout the iSCSI target by using the following command.
# iscsiadm -m node -T iqn.1991-05.com.microsoft:iscsi-01-virtual-target02-target --logout

Enable Multipathing
Before setting up DM Multipath on your system, ensure that your system has been updated and includes the device-mapper-multipath package.
You set up multipath with the mpathconf utility, which creates the multipath configuration file /etc/multipath.conf.
If the /etc/multipath.conf file already exists, the mpathconf utility will edit it.
If the /etc/multipath.conf file does not exist, the mpathconf utility will use the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf file as the starting file.
If the /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf file does not exist the mpathconf utility will create the /etc/multipath.conf file from scratch.
I will create the /etc/multipath.conf file by hand and already exclude my boot loader and root file sytem disk from multipathing.
We should avoid multipathing the root/boot device unless specifically required.

Rebuild initramfs (If Root is on Multipath or for Boot Support)
This setup guarantees that multipath devices are available early in the boot process, which is crucial for maintaining the integrity of the storage setup and preventing potential issues.
defaults { user_friendly_names yes find_multipaths yes } blacklist { devnode "^sda" # Avoid multipathing the local boot disk devnode "^sdb" }
Checking if multipath is enabled and running.
# systemctl status multipathd

We can now connect the iSCSI Target as previously and this time the disk should only appear once. We can first run the discovery command to determine the IQN of the iSCSI target we want to connect.
# iscsiadm -m discovery -t st -p 10.0.0.40 # iscsiadm -m node -T iqn.1991-05.com.microsoft:iscsi-01-virtual-target02-target -l
Looks good, because multipath is enabled, the disk connected through the iSCSI Target servers both IP addresses (iSCSI Targets), the disk is shown up just once and its device mappers name mpatha (mpathN).

The multipath -ll command also shows the iSCIS Target managed by DM multipath.

Below we can see the device mapper path we can use to finally mount the disk.
]# ls -la /dev/mapper/

We can now mount the disk and create the file system if not already done.
# mount /dev/mapper/mpatha /data/
More about you will see in my following post.
Links
Configuring an iSCSI initiator
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/managing_storage_devices/configuring-an-iscsi-initiator_managing-storage-devicesSetting Up DM Multipath
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/dm_multipath/mpio_setup