Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Hands_on_multipath_p1.pdf
1. simple hands on multipathing in linux part 1 :
hello guys
this is hossein mehrara
i’m trying to create simple but resourceful documentation on storage and
multipathing in linux
so what is a san : a san (storage area network) is a network of storage devices
that can be accessed by multiple servers or computers, providing a shared pool /
lun of storage space. each computer on the network can access storage on the
san as though hba cards.
2. hba cards or fc cards :
a host bus adapter (hba) is a circuit board or integrated circuit adapter that
connects a host system ( server ) to san storage.
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
hba and sfp
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
3. 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
to check the available hba ports, use the below file:
# ls -l /sys/class/fc_host
total 0
4. 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/
drwxr-xr-x 2 root root 0 may 27 09:40 target7:0:2
drwxr-xr-x 2 root root 0 may 27 09:40 target7:0:1
drwxr-xr-x 2 root root 0 may 27 09:40 target7:0:0
drwxr-xr-x 2 root root 0 may 27 09:40 target5:0:2
drwxr-xr-x 2 root root 0 may 27 09:40 target5:0:1
drwxr-xr-x 2 root root 0 may 27 09:40 target5:0:0
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
Use the following file to check a specific fc host wwn number:
# cat /sys/class/fc_host/host1/node_name
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
::::::::::::::
5. 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
Method-2: Checking wwn number using systool command
The systool is a tool that uses APIs provided by libsysfs to gather information. It
allows you to view system device information by bus, class, and topology.
When you run systool without parameters, it will present all available bus types,
device classes, and root devices.
How to install systool in Linux
systool can be easily installed from the distribution official repository.
For RHEL/CentOS 6/7 systems, use the yum command to install systool:
$ sudo yum install -y sysfsutils
For RHEL/CentOS 8 and Fedora systems, use the dnf command to install systool:
$ sudo dnf install -y sysfsutils
Once the sysfsutils package is installed on the Linux system, run the following
command to find the WWN number of fc host:
# systool -c fc_host -v | grep port_name
port_name = "0x500143802426baf2"
port_name = "0x500143802426baf3"
port_name = "0x500143802426baf4"
port_name = "0x500143802426baf5"
Run the following command to check the state of HBA ports:
# systool -c fc_host -v | grep port_state
port_state = "online"
6. 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
initiate the basic configuration settings of the multipathing feature.
# mpathconf --enable --with_multipathd y
This command also creates the /etc/multipath.conf , WWN file and bind file.
When devices are brought under the control of device-mapper-multipath the new
multipathed devices can be seen in three different places under the /dev directory:
1. /dev/dm-N
2. /dev/mapper/mpathN
3. /dev/mpath/mpathN
time to scan and get disks online without rebooting server :
I will first Identify the number of HBA adapters
systool -c fc_host -v
or
ls /sys/class/fc_host
which result is host0
7. then Use the below command to scan the LUNs
echo “- – -” > /sys/class/scsi_host/host0/scan
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