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 its mass storage devices through the buses, controllers, switches, and bridge devices connecting them.
A simple example would be a SCSI disk connected to two SCSI controllers on the same computer or a disk connected to two Fibre Channel ports. Should one controller, port or switch fail, the operating system can route I/O through the remaining controller transparently to the application, with no changes visible to the applications, other than perhaps incremental latency.
This is useful for:
- Dynamic load balancing
- Traffic shaping
- Automatic path management
- Dynamic reconfiguration
Linux device-mapper
In the Linux kernel, the device-mapper serves as a generic framework to map one block device onto another. It forms the foundation of LVM2 and EVMS, software RAIDs, dm-crypt disk encryption, and offers additional features such as file-system snapshots.
Device-mapper works by processing data passed in from a virtual block device, that it itself provides, and then passing the resultant data on to another block device.
How do I setup device-mapper multipathing in CentOS / RHEL 4 update 2 or above?
Open /etc/multipath.conf file, enter:
# vi /etc/multipath.conf
Make sure following line exists and commented out:
devnode_blacklist { devnode "*" }
Make sure default_path_grouping_policy option in the defaults section set to failover. Here is my sample config:
defaults { multipath_tool "/sbin/multipath -v0" udev_dir /dev polling_interval 10 default_selector "round-robin 0" default_path_grouping_policy failover default_getuid_callout "/sbin/scsi_id -g -u -s /block/%n" default_prio_callout "/bin/true" default_features "0" rr_min_io 100 failback immediate }
Save and close the file. Type the following command to load drivers:
# modprobe dm-multipath
# modprobe dm-round-robin
Start the service, enter:
# /etc/init.dmultipathd start
multipath is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them:
# multipath -v2
Turn on service:
# /sbin/chkconfig multipathd on
Finally, create device maps from partition tables:
# kpartx -a /dev/mapper/mpath#
You need to use fdisk on the underlying disks such as /dev/sdc.
References:
- man page kpartx,multipath, udev, dmsetup and hotplug