Beginners guide to Device Mapper (DM) multipathing

Multipathing Overview

A path is a connection between a server and the underlying storage. The path can be severed due to many reasons like faulty HBA, faulty cable etc. To avoid such single point of failures, multipathing exists. Multipathing ensures that the system uses multiple physical paths to provide redundancy and increased throughput. There are many vendor specific multipathing implementations like EMC’s powerpath and Symantecs VxDMP.

What is Device Mapper multipath

Device Mapper Multipathing (or DM-multipathing) is a Linux native multipath tool, which allows you to configure multiple I/O paths between server nodes and storage arrays into a single device. These I/O paths are physical SAN connections that can include separate cables, switches, and controllers. Multipathing aggregates the I/O paths, creating a new device that consists of the aggregated paths. Regardless of the vendor hardware in use, device mapper creates a block device under /dev/mapper/ for each LUN attached to the system.

Device Mapper components
The important components of Device Mapper multipathing are :

Component

Description

dm-multipath

kernel module responsible for making routing decisions under normal/failure conditions

multipath

Command used for viewing/listing multipath devices and for initial configuration

Multipathing Configuration

Before starting to configure the multipathing, make sure the device-mapper-multipath package is installed. If not installed, install it using yum :

# yum -y install device-mapper-multipath

The device mapper multipathing uses the configuration file /etc/multipath.conf for the configuration. If you make any changes to this file the multipath command must be run in order to reconfigure the multipathed devices. The easiest way to create this file is to use the mpathconf utility. If there is an existing configuration file mpathconf will edit it, if no such file exists it will copy /usr/share/doc/device-mapper-multipath-*/multipath.conf.

# mpathconf --enable --with_multipathd y --with_chkconfig y

The configuration file consists of 5 major sections as below :

Section

Description

defaults

system-level default configuration

blacklist

Blacklisted devies. Devices that should not be configured under DMMP

blacklist_exceptions

Exceptions to the blacklisted devices

devices

settings for individual storage controller devices

multipaths

fine-tune configuration of individual LUNs

Verifying Configuration

The multipath command can be used to verify the multipathinf configuration. To list the information about multipathed devices :

The output shows a multipathed LUN, mpath0. The number following it is the LUN’s WWID. The status active/ready indicates that the path is ready for I/O. If the path is showing faulty/failed then it needs to be repaired before using it for I/O. After the configuration is completed, we can start the multipathd persistently :

# /etc/init.d/multipathd start
# chkconfig multipathd on

User Friendly Device Names

In order to troubleshoot efficiently, device-mapper can be configured to have human readable, user friendly device names under /dev/mapper instead of using the WWIDs. The user friendly names like /dev/mapper/mpath0 can be created by enabling the user_friendly_names option in /etc/multipath.conf file :

defaults {
user_friendly_names yes
}

You can also control the name for a particular LUN by using the alias option :