% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={san-multipath},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{san-multipath}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{san-multipath}{%
\section{san-multipath}\label{san-multipath}}

Multipath \#\#\#\#\#\#\#\#\#\#

What is multipath? In computer storage, multipath I/O is a
fault-tolerance and performance enhancement technique whereby there is
more than one physical path between the CPU in a computer system and
it's mass storage devices through the buses, controllers, switches, and
bridge devices connecting them.

Futher reading (multipath): http://en.wikipedia.org/wiki/Multipath\_I/O

What problem does multipath software solve? When we have multiple paths
to a disk, our operating system views each path as a separate device.
For example if we have 2 paths to a Logical Unit (LUN), linux will see
\emph{/dev/sdb} and \emph{/dev/sdc}. We need the operating system to
treat these multiple paths as one logical device. We do this with
multipath software.

The multipath software will detect multiple paths to the LUN and map
these paths to one device which we use like a normal disk.

.. contents::

\hypertarget{multipath-architecture-example}{%
\section{Multipath Architecture
Example}\label{multipath-architecture-example}}

The industry standard for a fabric switched environment is 4 paths to a
LUN. We describe this fault-tolerant architecture in the example below -

\textbf{lhost999}: an example server with two HBA ports (A \& B)

\begin{itemize}
\item
  HBA \emph{A}
\item
  Fabric Switch A
\item
  HBA \emph{B}
\item
  Fabric Switch B
\end{itemize}

\textbf{SAN}: an example SAN with two Controllers, each with two HBA
ports

\begin{itemize}
\item
  Controller 1
\item
  Fabric Switch A
\item
  Fabric Switch B
\item
  Controller 2
\item
  Fabric Switch A
\item
  Fabric Switch B
\end{itemize}

This architecture supplies lhost999 with 4 paths to the disk.

We could loose \emph{Controller 2} and \emph{Fabric Switch A} and still
have a single path to the disk between the host and the LUN::

lhost999 -\textgreater{} Fabric Switch B -\textgreater{} Controller 1
-\textgreater{} SAN -\textgreater{} LUN

Multipathing software not only maintains a logical device for the
multiple paths, but also gracefully switches between paths during
outages.

\hypertarget{multipath-architecture-definitions}{%
\section{Multipath Architecture
Definitions}\label{multipath-architecture-definitions}}

\textbf{HBA} In computer hardware, a host controller, host adapter, or
host bus adapter connects a host system (the computer) to other network
and storage devices.

Futher reading (HBA): https://en.wikipedia.org/wiki/Host\_adapter

\textbf{Fabric Switch} Switched fabric, switching fabric, or just
fabric, is a network topology where network nodes connect with each
other via one or more network switches (particularly via crossbar
switches, hence the name).

Further reading (Fabric networking):
http://en.wikipedia.org/wiki/Switched\_fabric

\hypertarget{install-multipath-software}{%
\section{Install Multipath Software}\label{install-multipath-software}}

The following sub-sections will document how to install multipathing
software on various operating systems:

\hypertarget{ubuntu}{%
\subsection{Ubuntu}\label{ubuntu}}

The following procedure will install multipathing software on an Ubuntu
12.04 LTS server:

Install Software::

apt-get install -y multipath-tools apt-get install -y
multipath-tools-boot

Enable the multipathd service if needed.

\hypertarget{redhat}{%
\subsection{Redhat}\label{redhat}}

The following procedure will install multipathing sofware on a Redhat
Enterprise Linux 5 server:

Install Software::

yum install device-mapper-multipath

Enable the multipathd service if needed.

\hypertarget{ask-for-and-verify-multiple-paths}{%
\subsection{Ask for and verify multiple
paths}\label{ask-for-and-verify-multiple-paths}}

\begin{enumerate}
\item
  After you \texttt{Install\ Multipath\ Software}\_ ask SAN admins to
  present multiple paths to server or blade profile. They may ask for
  the servers HBA WWNs.
\item
  Wait for SAN admins to respond in the affirmative.
\item
  Scan for SAN presented devices or reboot the host.
\item
  Verify 4 paths to the device::

  multipath -ll multipath -v2
\end{enumerate}

\hypertarget{admin-commands-for-san-device}{%
\section{Admin Commands for SAN
device}\label{admin-commands-for-san-device}}

This section documents a list of useful SAN device administration
commands.

\hypertarget{list-the-hbas}{%
\subsection{List the HBAs}\label{list-the-hbas}}

.. code-block:: bash

lspci \textbar{} grep HBA

.. code-block:: bash

06:00.0 Fibre Channel: QLogic Corp.~ISP2432-based 4Gb Fibre Channel to
PCI Express HBA (rev 03) 06:00.1 Fibre Channel: QLogic
Corp.~ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)
2a:00.0 Fibre Channel: QLogic Corp.~ISP2432-based 4Gb Fibre Channel to
PCI Express HBA (rev 03) 2a:00.1 Fibre Channel: QLogic
Corp.~ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 03)

.. code-block:: bash

sudo grep -i qlogic /var/log/dmesg

.. code-block:: bash

QLogic Fibre Channel HBA Driver QLogic Fibre Channel HBA Driver:
8.03.01.04.05.05-k QLogic QLE2462 - QLogic 4GB FC Dual-Port PCI-E HBA
for IBM System x QLogic Fibre Channel HBA Driver: 8.03.01.04.05.05-k
QLogic QLE2462 - QLogic 4GB FC Dual-Port PCI-E HBA for IBM System x
QLogic Fibre Channel HBA Driver: 8.03.01.04.05.05-k QLogic QLE2462 -
QLogic 4GB FC Dual-Port PCI-E HBA for IBM System x QLogic Fibre Channel
HBA Driver: 8.03.01.04.05.05-k QLogic QLE2462 - QLogic 4GB FC Dual-Port
PCI-E HBA for IBM System x

\hypertarget{view-the-paths-and-health}{%
\subsection{View the paths and health}\label{view-the-paths-and-health}}

.. code-block:: bash

multipath -ll multipath -v2

.. code-block:: bash

mpath0 (350002ac0343408b4) dm-6 3PARdata,VV {[}size=100G{]}{[}features=1
queue\_if\_no\_path{]}{[}hwhandler=0{]} \_ round-robin 0
{[}prio=0{]}{[}active{]} \_ 3:0:0:0 sdb 8:16 {[}active{]}{[}undef{]} \_
5:0:0:0 sdc 8:32 {[}active{]}{[}undef{]}

As you can see this server only seems to have 2 paths to the LUN.

\hypertarget{determine-a-lun-identifier}{%
\subsection{Determine a LUN
identifier}\label{determine-a-lun-identifier}}

.. code-block:: bash

ls -hal /dev/disk/by-id/

\hypertarget{determine-scsi_host-or-fc_host-ids}{%
\subsection{Determine scsi\_host or fc\_host
IDs}\label{determine-scsi_host-or-fc_host-ids}}

These ids are used when scanning the bus for devices:

.. code-block:: bash

ls /sys/class/scsi\_host/ \textbar{} grep host ls /sys/class/fc\_host/
\textbar{} grep host

\hypertarget{scan-for-presented-devices}{%
\subsection{Scan for presented
devices}\label{scan-for-presented-devices}}

Any of the following commands may be used to scan storage interconnects:

\begin{enumerate}
\item
  Scan or rescan for presented LUNS without rebooting host:

  .. code-block:: bash

  echo `- - -' \textgreater{} /sys/class/scsi\_host/host0/scan echo `- -
  -' \textgreater{} /sys/class/scsi\_host/host1/scan
\item
  Perform a Loop Initialization Protocol (LIP) which scans the
  interconnect and causes the SCSI layer to be updated to reflect the
  devices currently on the bus.

  .. code-block:: bash

  sudo echo ``1'' \textgreater{} /sys/class/fc\_host/host3/issue\_lip
  sudo echo ``1'' \textgreater{} /sys/class/fc\_host/host4/issue\_lip
\end{enumerate}

\hypertarget{issue-with-pxe-booting-debian}{%
\section{Issue with PXE Booting
Debian}\label{issue-with-pxe-booting-debian}}

On the UCS blade servers, only one path to the boot LUN should be
presented to a host when pxe-booting. This only becomes an issue when
rebuilding an existing system who had multiple paths configured. To
resolve, message SAN and ask them to only present one path to the boot
LUN.

further reading (Debian Installer):
https://wiki.debian.org/DebianInstaller/MultipathSupport

\end{document}
