Install Device Mapper Multipathing on SAN/NAS
This is an older article I have dusted off because some readers may not know what device-mapper multipathing is for. It provides multipathing for storage devices such as SAN or NAS, and supports load balancing or failover for storage access. Here is an example to make it clearer. Suppose we have a SAN connected through two fiber cables, so one can be used if the other fails. Once connected to Linux, the number of disks Linux sees doubles because both cables connect to the SAN. If we allocate one LUN (LUN A) to Linux, it sees two disks for that same LUN, such as sda and sdb. Both refer to the same LUN, so either can be accessed. If we mount sda and its cable eventually fails, it becomes unusable and we must mount sdb instead. Multipath software addresses this by creating a virtual device representing sda and sdb. The common modes are Fail-Over and Load-Balance. This article covers configuring device-mapper multipathing for Fail-Over as follows: Edit /etc/multipath.conf and comment out the entries as shown below:
# devnode_blacklist {
# devnode "*"
# }
Then uncomment:
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
}
blacklist {
wwid 26353900f02796769
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z][[0-9]*]"
devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]"
}
The configuration above makes multipathed operate in failover mode. Next run these commands in order:
modprobe dm-multipath
modprobe dm-round-robin
service multipathd start
multipath -v2
Run the following command to keep it enabled after a reboot:
[root@ezylinux ~]# chkconfig multipathd on
With this configuration, the system creates /dev/dm-X devices, where X is the multipathed group. You cannot run fdisk on /dev/dm-X, so use fdisk on the actual device, such as /dev/sda.