How to configure Fibre Channel (FC) Storage Multipath in Linux CentOS 7/RHEL 7

In computer storage, multipath I/O is a fault-tolerance and performance-enhancement technique that defines more than one physical path between the CPU in a computer system and its mass-storage devices through the buses, controllers, switches, and bridge devices connecting them. As an example, a SCSI hard disk drive may connect to two SCSI controllers on the same computer, or a disk may connect to two Fibre Channel ports. Should one controller, port or switch fail, the operating system can route the I/O through the remaining controller, port or switch transparently and with no changes visible to the applications, other than perhaps resulting in increased latency. Multipath software layers can leverage the redundant paths to provide performance-enhancing features, including dynamic load balancing, traffic shaping, automatic path management, and dynamic reconfiguration.

Step 1:  The multipath is by default installed in CentOS7 and if its not you may need to install it using this below command

# yum install device-mapper-multipath



multipath0

Step 2: enable the multipath deamon at systemboot and start the service now by running the command

# systemctl enable multipathd


# systemctl start multipathd



Step 3: copy the default configuration from /usr/share/doc/device-mapper-multipath and place it to /etc/

# cp /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/


# multipath -ll



multipath2

Step 4: run the /sbin/mpathconf to check the status of the multipath service daemon

# /sbin/mpathconf



multipath3

Step 5: after copying the file check if you able to see the FC_SAN storage now using this

# multipath -v2


# multipath -ll



multipath4

Step 6: configure the multipath.conf using your favorite editor and enable only the necessary for this I’m using two storage LUN0 and LUN1

# vim /etc/multipath.conf



multipath5

Step 7: Now check the LUN0 and LUN1 if its detected using the ‘multipath -ll’

# multipath -ll



multipath6

and to verify all link is up you can run this below command

# lsblk



multipath7

Step 8-A: And now we need to create partition and format the disk to be usable as this this is more than 2TB we can not use the native ‘fdisk’ instead we will use the ‘parted’

for ‘fdisk’

# ls -l /dev/mapper/LUN0

# fdisk /dev/mapper/LUN0

m
n
p
1
enter
enter
m
v
w

And use this command partprobe To inform the OS of partition table changes

# partprobe /dev/mapper/LUN0


# mkdir /Storage01


# mkfs.xfs -f /dev/mapper/LUN0p1

 

[[email protected]~]# mkfs.xfs -f /dev/mapper/LUN0p1
                        meta-data=/dev/mapper/LUN0p1     isize=256    agcount=32, agsize=16777088 blks                                  =                       sectsz=512   attr=2, projid32bit=1                                  =                       crc=0        finobt=0                         data     =                       bsize=4096   blocks=536866815, imaxpct=5                                  =                       sunit=4      swidth=4096 blks                         naming   = version 2              bsize=4096   ascii-ci=0 ftype=0                         log      = internal log           bsize=4096   blocks=262144, version=2                                 =                       sectsz=512   sunit=4 blks, lazy-count=1                         realtime =none                   extsz=4096   blocks=0, rtextents=0

And its ready to mount the LUN0p1 to /Storage

# mount /dev/mapper/LUN0p1 /Storage01



Then edit the ‘fstab’ to auto mount the LUN0p1 when the CentOS boot

# vim /etc/fstab


    /dev/mapper/LUN0p1 /Storage01                  xfs     defaults        0 0

Step 8-B If the disk is more than 2TB in size you can use parted. To find out the current Disk Size type the below command

# fdisk -l /dev/sdb



Now to create a partition using parted to get started:

# parted /dev/sdb



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

Creates a new GPT disklabel i.e. partition table:

(parted) mklabel gpt



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)

Next, set the default unit to TB, enter:

(parted) unit TB

To create a 3TB partition size, enter:

(parted) mkpart primary 0.00TB 3.00TB

To check or to verify the partition type print

(parted) print

Model: ATA ST330067351AB (scsi)
Disk /dev/sdb: 3.00TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 0.00TB 3.00TB 3.00TB ext4 primary

(parted) quit

Then format the disk using XFS file system format and follow Step 8-A to mount the new partition

# mkfs.xfs -f /dev/mapper/LUN0p1


[[email protected]~]# mkfs.xfs -f /dev/mapper/LUN0p1
                        meta-data=/dev/mapper/LUN0p1     isize=256    agcount=32, agsize=16777088 blks                                  =                       sectsz=512   attr=2, projid32bit=1                                  =                       crc=0        finobt=0                         data     =                       bsize=4096   blocks=536866815, imaxpct=5                                  =                       sunit=4      swidth=4096 blks                         naming   = version 2              bsize=4096   ascii-ci=0 ftype=0                         log      = internal log           bsize=4096   blocks=262144, version=2                                 =                       sectsz=512   sunit=4 blks, lazy-count=1                         realtime =none                   extsz=4096   blocks=0, rtextents=0

Step 9: To rescan the FC Storage if there’s another new LUN you need to scan using below command. For my Lab server it start with host1/host2 your maybe different

# [[email protected] ~]# echo “1” > /sys/class/fc_host/host1/issue_lip


# [[email protected] ~]# echo “1” > /sys/class/fc_host/host2/issue_lip



Then check again using

# multipath -ll



if it doe not show then you might want to restart the multipath service

# service multipathd reload


# multipath -ll


Be the first to comment on "How to configure Fibre Channel (FC) Storage Multipath in Linux CentOS 7/RHEL 7"

Leave a comment

Your email address will not be published.