Intro and Configuration Linux Multipathing
Intro and Configuration Linux Multipathing
hello guys
this is hossein mehrara
i’m trying to create simple but resourceful documentation on storage and
multipathing in linux
hba cards has the optical interfaces generally transmit data through optical fiber
cables called sfp , it’s high speed module to communicate with san switch.
hba cards like nic cards have verity if models from single port to quad port
using hba cards and multipathing give us multiple paths to storage devices provide
connection redundancy, failover capability, load balancing, and improved
performance. device-mapper multipath (dm-multipath) is a multipathing tool that
enables you represent multiple i/o paths between a server and a storage device as
a single path.
without dm-multipath, the system treats each path as being separate even though
it connects the server to the same storage device. dm-multipath creates a single
multipath device, /dev/mapper/mpathn, that subsumes the underlying
devices, /dev/sdc and /dev/sdf.
each hba cards has wwn / wwnp and some more identification which for now you
just need to know the wwn.
wwn – world wide name
wwnn – world wide node name
wwpn – world wide port name
wwid – world wide identifier
oui – organizationally unique identifier
# ls -l /sys/class/fc_host
total 0
lrwxrwxrwx 1 root root 0 oct 26 17:10 host1 ->
../../devices/pci0000:00/0000:00:02.0/0000:03:00.0/host1/fc_host/host1
lrwxrwxrwx 1 root root 0 oct 26 17:10 host2 ->
../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host2
lrwxrwxrwx 1 root root 0 oct 26 17:10 host3 ->
../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host3
lrwxrwxrwx 1 root root 0 oct 26 17:10 host4 ->
../../devices/pci0000:00/0000:00:02.2/0000:04:00.0/host2/fc_host/host4
the ‘fc_transport’ determines the correct host, channel, and target information from
currently presented lun:
# ls -lrt /sys/class/fc_transport/
you can verify a list of ‘wwn’number of the fc host (hba card) using the following
file:
# cat /sys/class/fc_host/host?/port_name
0x500143802426baf2
0x500143802426baf3
0x500143802426baf4
0x500143802426baf5
0x500143802426baf2
To find the status of HBA ports, use the below file (online/offline):
# more /sys/class/fc_host/host?/port_state
::::::::::::::
/sys/class/fc_host/host1/port_state
::::::::::::::
online
::::::::::::::
/sys/class/fc_host/host2/port_state
::::::::::::::
online
::::::::::::::
/sys/class/fc_host/host3/port_state
::::::::::::::
online
::::::::::::::
/sys/class/fc_host/host4/port_state
::::::::::::::
online
port_name = "0x500143802426baf2"
port_name = "0x500143802426baf3"
port_name = "0x500143802426baf4"
port_name = "0x500143802426baf5"
port_state = "online"
port_state = "online"
port_state = "online"
port_state = "online"
If you want to check wwn number of a specific fc host , run the following command:
# systool -c fc_host -v -d host2 | grep port_name
now that we know the cards and cables are connected to SAN storage let’s start a
senario
my DBA team asked me to get new FAST external Disk from Storage and mount
it to my Linux server , so here’s what we do :
First in need to manage the external disk with package Device Mapper Multipath .
I will install the device-mapper-multipath package.
# yum install device-mapper-multipath
or
ls /sys/class/fc_host
or
echo “1” > /sys/class/fc_host/host0/issue_lip
also I can easly install following package and run this script
yum install sg3_utils
/usr/bin/rescan-scsi-bus.sh
this with scan our hba card initiator and find disks , to check if we have got the disk
run : multipath -ll
you can see we have a disk called mpatha with 100G size
# multipath -ll
mpatha (3600601f0d057000018fc7845f46fe011) dm-1 dgc,raid 0
size=98g features='0' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| - 11:0:0:0 sdd 8:128 active ready running
| - 10:0:0:0 sde 8:64 active ready running
-+- policy='round-robin 0' prio=0 status=enabled
|- 8:0:0:0 sdc 8:32 active ready running
- 9:0:0:0 sdf 8:80 active ready running
note that multipathing gave you single 100gb name / mpatha instead of 4 * 100gb
disk (sdc,sdd,sde,sdf) or as we call path from storage.
i will explain the modes of this multipathing like active/avtive and active/passive
later .
ok now what to do ?
just like same local disk format approuch we do
# fdisk /dev/mapper/maptha