Red Hat Enterprise Linux natively supports storage that has multiple paths presented to the OS. Configuring CentOS/RHEL to use the multipath functionality is a straightforward process:
Installation
If not already installed, install the device-mapper-multipath package:
# yum install device-mapper-multipath
Location of multipath devices
When devices are brought under the control of device-mapper-multipath the new multipathed devices can be seen in three different places under the /dev directory:
1. /dev/dm-N
2. /dev/mapper/mpathN
3. /dev/mpath/mpathN
The /dev/dm-N devices are internal to device mapper and should never be used. These devices are not persistent. Starting with CentOS/RHEL 5, these devices are no longer created by udev. The /dev/mpath/mpathN devices are provided in RHEL 4 and 5 so that all the multipathed devices can be seen in one place; this directory no longer exists in RHEL 6. However, these device nodes may not be created on boot before the system needs to access them. Therefore they should not be used for creating Physical Volumes for Volume Groups or partitions with filesystems in those releases where it is available.
The /dev/mapper/mpathN devices are persistent and they are created early in the boot process. Therefore these are the device names that should be used to access the multipathed devices.
Enabling device mapper multipath
Generate a default /etc/multipath.conf file using the mpathconf command. To determine the default settings for the installed version use the –help option:
# mpathconf --help usage: /usr/sbin/mpathconf [command] Commands: Enable: --enable Disable: --disable Set user_friendly_names (Default n): --user_friendly_names [y|n] Set find_multipaths (Default n): --find_multipaths [y|n] Load the dm-multipath modules on enable (Default y): --with_module [y|n] start/stop/reload multipathd (Default n): --with_multipathd [y|n] chkconfig on/off multipathd (Default y): --with_chkconfig [y|n]
Options that default to the required value do not need to be specified on the command line. For example, to enable multipath with the user-friendly names feature leaving all other options set to the default values, issue the following command:
# mpathconf --enable --user_friendly_names y
Blacklisting the devices
Device mapper multipath supports a number of mechanisms to allow blacklisting of devices that match certain criteria. A blacklisted device will be skipped when detecting and creating multipath devices. One use for this mechanism is to exclude local devices (built-in disks, or removable media, for example) from the multipath configuration. This allows those devices to continue to be used as normal single-path devices without interference from the multipath subsystem.
Device mapper multipath also includes a built-in blacklist to exclude devices that do not support multiple paths. This list is preconfigured and does not need to be included in multipath.conf to be effective. The current set of built-in blacklists is as follows:
blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" }
find_multipaths Feature
Versions of device mapper multipath in Red Hat Enterprise Linux 6 and later include the ‘find_multipaths’ feature. This excludes any device from multipath configuration until at least two paths to the device have been detected simultaneously. This is an effective alternative to manual blacklisting that requires less configuration and maintenance for common scenarios. The feature is enabled by adding the following line to the global ‘defaults’ section of multipath.conf:
defaults { ... find_multipaths yes ... }
Detecting and configuring multipath devices
A basic multipath.conf file has now been created and populated with appropriate settings for the system post the installation of the required packages. Run the multipath command to detect and configure multipath devices:
# multipath mpatha (3600601f0d057000018fc7845f46fe011) dm-1 DGC,RAID 0 size=98G features='0' hwhandler='1 emc' wp=rw |-+- policy='round-robin 0' prio=1 status=active | - 11:0:0:0 sdd 8:128 active ready running | - 10:0:0:0 sde 8:64 active ready running -+- policy='round-robin 0' prio=0 status=enabled |- 8:0:0:0 sdc 8:32 active ready running - 9:0:0:0 sdf 8:80 active ready running
The command can print additional information which may be of use in diagnosing problems or creating custom configurations. This includes information on blacklist settings and the matching of storage devices to built-in configurations. Specifying a verbose option with the -v[number] option enables this additional output:
Nov 04 16:48:56 | Found matching alias [mpatha] in bindings file. Setting wwid to 3600601608e661a00e4710bf88370e211 Nov 04 16:48:56 | ram0: device node name blacklisted Nov 04 16:48:56 | ram1: device node name blacklisted Nov 04 16:48:56 | ram2: device node name blacklisted Nov 04 16:48:56 | ram3: device node name blacklisted Nov 04 16:48:56 | ram4: device node name blacklisted Nov 04 16:48:56 | ram5: device node name blacklisted Nov 04 16:48:56 | ram6: device node name blacklisted Nov 04 16:48:56 | ram7: device node name blacklisted Nov 04 16:48:56 | ram8: device node name blacklisted Nov 04 16:48:56 | ram9: device node name blacklisted Nov 04 16:48:56 | ram10: device node name blacklisted Nov 04 16:48:56 | ram11: device node name blacklisted Nov 04 16:48:56 | ram12: device node name blacklisted Nov 04 16:48:56 | ram13: device node name blacklisted Nov 04 16:48:56 | ram14: device node name blacklisted Nov 04 16:48:56 | ram15: device node name blacklisted Nov 04 16:48:56 | loop0: device node name blacklisted Nov 04 16:48:56 | loop1: device node name blacklisted Nov 04 16:48:56 | loop2: device node name blacklisted Nov 04 16:48:56 | loop3: device node name blacklisted Nov 04 16:48:56 | loop4: device node name blacklisted Nov 04 16:48:56 | loop5: device node name blacklisted Nov 04 16:48:56 | loop6: device node name blacklisted Nov 04 16:48:56 | loop7: device node name blacklisted Nov 04 16:48:56 | sr0: device node name blacklisted Nov 04 16:48:56 | sda: device node name blacklisted Nov 04 16:48:56 | sdc: not found in pathvec Nov 04 16:48:56 | sdc: mask = 0x3f Nov 04 16:48:56 | sdc: dev_t = 8:32 Nov 04 16:48:56 | sdc: size = 10485760 Nov 04 16:48:56 | sdc: subsystem = scsi Nov 04 16:48:56 | sdc: vendor = DGC Nov 04 16:48:56 | sdc: product = RAID 5 Nov 04 16:48:56 | sdc: rev = 0220 Nov 04 16:48:56 | sdc: h:b:t:l = 3:0:0:1 Nov 04 16:48:56 | sdc: tgt_node_name = 0x50060160ba601693 Nov 04 16:48:56 | sdc: serial = FCNPR063600652 Nov 04 16:48:56 | sdc: get_state Nov 04 16:48:56 | loading /lib64/multipath/libcheckemc_clariion.so checker
Display and review the configuration by specifying the ‘-l’ or ‘-ll’ options to the multipath command:
# multipath -ll mpatha (3600601f0d057000018fc7845f46fe011) dm-1 DGC,RAID 0 size=98G features='0' hwhandler='1 emc' wp=rw |-+- policy='round-robin 0' prio=1 status=active | - 11:0:0:0 sdd 8:128 active ready running | - 10:0:0:0 sde 8:64 active ready running -+- policy='round-robin 0' prio=0 status=enabled |- 8:0:0:0 sdc 8:32 active ready running - 9:0:0:0 sdf 8:80 active ready running