Configure Multipathing in Linux (RHEL7/CentOS7)


After you have assigned LUN (usually configured in storage) to the specific client, below is the steps on how to configure multipath on client machine (RHEL7/CentOS7.

Install device-mapper-multipath

[root@www ~]# yum -y install device-mapper-multipath

Generate multipath configuraton

[root@www ~]# mpathconf --enable

Install iSCSI Initiator.

[root@www ~]# yum -y install iscsi-initiator-utils

Configure multipath.conf. comment line “find_multipaths yes”

[root@www ~]# vim /etc/multipath.conf 
# comment or remove below line
# find_multipaths yes

Configure iSCSI Initiator

[root@www ~]# vi /etc/iscsi/initiatorname.iscsi
# change to the same IQN you set on the iSCSI target server

Discover target (server is

[root@www ~]#iscsiadm -m discovery -t st -p,-1

Confirm status after discovery

[root@www ~]# iscsiadm -m node -o show

Login to the target

root@www ~]# iscsiadm -m node --login

Confirm the established session

root@www ~]# iscsiadm -m session -o show
tcp: [1],1 (non-flash) 
tcp: [2],1 (non-flash)

Restart iscsid and mulptipathd

[root@www ~]# systemctl restart multipathd
[root@www ~]# systemctl status iscsid

Check attached disk

[root@www ~]# multipath -ll
mpathb (36589cfc0000007b06bdc809ab3ad6dc2) dm-2 FreeNAS ,iSCSI Disk
size=5.0G features='0' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
 `- 3:0:0:0 sdb 8:16 active ready running

Edit /etc/multipathd.conf. Add below line at the bottom

multipaths {
        multipath {
                wwid 36589cfc0000007b06bdc809ab3ad6dc2
                alias DATA01

Restart iscsid and mulptipathd

[root@www ~]# systemctl restart multipathd

Create new path

[root@www ~]# mkdir -p /data01

Print disk format disk

[root@www ~]# parted /dev/mapper/DATA01 print 
Error: /dev/mapper/DATA01: unrecognised disk label 
Model: Linux device-mapper (multipath) (dm)                               
Disk /dev/mapper/DATA01: 5369MB 
Sector size (logical/physical): 512B/16384B
Partition Table: unknown
Disk Flags:

Label disk

[root@www ~]# parted /dev/mapper/DATA01 mklabel gpt

Print again to check label

root@www ~]# parted /dev/mapper/DATA01 print

Configure disk to use all space

[root@www ~]# parted /dev/mapper/DATA01p1 mkpart DATA01 xfs 1 5369MB

Format disk (I’m using xfs as my file system)

[root@www ~]# mkfs.xfs -f /dev/mapper/DATA01p1

Check the block id (and copy the UUID as we will use it in the further step)

[root@www ~]# blkid /dev/mapper/DATA01p1
/dev/mapper/DATA01p1: UUID="909a097e-6e01-490a-9d50-f4727c3efc04" TYPE="xfs"

Mount disk at boot using fstab (note: use _netdev)

[root@www ~]# vim /etc/fstab
UUID=909a097e-6e01-490a-9d50-f4727c3efc04       /data01	xfs	_netdev	0 0

Mount new disk

[root@www ~]# mount -a

To test your newly mounted disk, try to create any file (using touch or vi) in /data01 partition. If success then your disk is ready to work.

Now time to reboot your server and check either your /data01 is automatically mounted or not. If everything is fine, then your are golden.


This entry was posted in Linux and tagged , , , , , , . Bookmark the permalink.