6 Using Multipathing for Efficient Storage
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.
Device Multipathing Sample Setup
You would be most likely to configure multipathing with a system that can access storage on a Fibre Channel-based storage area network (SAN). You can also use multipathing on an iSCSI initiator if redundant network connections exist between the initiator and the target.
Figure 6-1 shows a simple DM-Multipath configuration where two I/O paths are configured between a server and a disk on a SAN-attached storage array:
-
Between host bus adapter
hba1
on the server and controllerctrl1
on the storage array. -
Between host bus adapter
hba2
on the server and controllerctrl2
on the storage array.
Figure 6-1 DM-Multipath Mapping of Two Paths to a Disk over a SAN
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
.
You can configure the multipathing service
(multipathd
) to handle I/O from and to a
multipathed device in one of the following ways:
- Active/Active
-
I/O is distributed across all available paths, either by round-robin assignment or dynamic load-balancing.
- Active/Passive (standby failover)
-
I/O uses only one path. If the active path fails, DM-Multipath switches I/O to a standby path. This is the default configuration.
Note:
DM-Multipath can provide failover in the case of path failure, such as in a SAN fabric. Disk media failure must be handled by using either a software or hardware RAID solution.
Configuring Multipathing
The following procedure describes how to set up a simple multipath configuration on a server with access to SAN-attached storage.
-
Install the
device-mapper-multipath
package.sudo yum install device-mapper-multipath
-
Initiate the basic configuration settings of the multipathing feature.
sudo mpathconf --enable --with_multipathd y
This command also creates the
/etc/multipath.conf
file. -
(Optional) To determine the status of multipathing, use the following command:
sudo mpathconf
-
Edit
/etc/multipath.conf
, as required.For details, see Working With the Multipathing Configuration File.
If you want to display the current multipath configuration, use the multipath -ll command, for example:
sudo multipath -ll
The command displays output similar to the following, when multipath is configured properly:
mpath1(360000970000292602744533030303730) dm-0 SUN,(StorEdge 3510|T4 size=20G features=‘0’ hwhandler=‘0’ wp=rw |-+- policy=‘round-robin 0’ prio=1 status=active | ‘- 5:0:0:2 sdb 8:16 active ready running ‘-+- policy=‘round-robin 0’ prio=1 status=active ‘- 5:0:0:3 sdc 8:32 active ready running
The previous output shows that
/dev/mapper/mpath1
subsumes two paths (/dev/sdb
and/dev/sdc
) to 20 GB of storage in an active/active configuration using the round-robin I/O path selection. The WWID that identifies the storage is360000970000292602744533030303730
and the name of the multipath device undersysfs
isdm-0
.For more information, see the
mpathconf(8)
,multipath(8)
,multipathd(8)
,multipath.conf(5)
, andscsi_id(8)
manual pages.
Working With the Multipathing Configuration File
By using the /etc/multipath.conf
file, you
can add a combination of definitions that customizes
multipathing according to your system environment setup. You can
obtain a commented example configuration from
/usr/share/doc/device-mapper-multipath/multipath.conf
.
The /etc/multipath.conf
file is divided into
the following typical sections:
-
defaults
-
Defines default multipath settings, which can be overridden by settings in the
devices
section, and which in turn can be overridden by settings in themultipaths
section. -
blacklist
-
Defines devices that are excluded from multipath topology discovery. Blacklisted devices cannot subsumed by a multipath device.
The example shows the three ways that you can use to exclude devices: by WWID (
wwid
), by device name (devnode
), and by device type (device
). -
blacklist_exceptions
-
Defines devices that are included in multipath topology discovery, even if the devices are implicitly or explicitly listed in the
blacklist
section. -
multipaths
-
Defines settings for a multipath device that is identified by its WWID.
The
alias
attribute specifies the name of the multipath device as it will appear in/dev/mapper
instead of a name based on either the WWID or the multipath group number.To obtain the WWID of a SCSI device, use the scsi_id command:
sudo scsi_id --whitelisted --replace-whitespace --device=device_name
-
devices
-
Defines settings for individual types of storage controller. Each controller type is identified by the
vendor
,product
, and optionalrevision
settings, which must match the information insysfs
for the device.You can find details of the storage arrays that DM-Multipath supports and their default configuration values in
/usr/share/doc/device-mapper-multipath-version/multipath.conf.defaults
, which you can use as the basis for entries in the/etc/multipath.conf
file.To add a storage device that DM-Multipath does not list as being supported, obtain the vendor, product, and revision information from the
vendor
,model
, andrev
files under/sys/block/device_name/device
.
The following entries in the
/etc/multipath.conf
file would be appropriate
for setting up active/passive multipathing to an iSCSI LUN with
the specified WWID.
defaults { user_friendly_names yes uid_attribute ID_SERIAL } multipaths { multipath { wwid 360000970000292602744533030303730 } }
In this standby failover configuration, I/O continues through a remaining active network interface if a network interfaces fails on the iSCSI initiator.
Note:
If you edit the /etc/multipath.conf
file,
restart the multipathd
service to make so
that the file is re-read.
For more information about configuring entries in
/etc/multipath.conf
, refer to the
multipath.conf(5)
manual page.