How to configure Device Mapper Multipath in RHEL 6, 7, 8 & 9?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 6, 7, 8 & 9
  • Device-Mapper-Multipath (DM-multipath)

Issue

  • How to configure device-mapper-multipath to set up multipathing for SAN storage in Red Hat Enterprise Linux 6, 7, 8 & 9?
  • How to setup dm-multipath in Red Hat Enterprise Linux 6?
  • We need to configure Storage Area Network(SAN) on RHEL 6, what are the steps to setup this?
  • How the multipath.conf should be configured to setup multipath for my SAN storage?
  • What is blacklist keyword in multipath.conf and how to remove a LUN from dm-multipath in RHEL 6?
  • What are general steps to enable DM-Multipath in Red Hat Enterprise Linux 6?

Resolution

TIP

For a simple and automated approach to setting up multipath devices then please try the Multipath Helper Lab Application.

Installation


If not already installed, install the `device-mapper-multipath` package:
# yum install device-mapper-multipath

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
    

Starting DM-multipath

  • Start the multipathd.service once the configuration is complete:

      # systemctl start multipathd
    

Blacklisting

  • 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. For more information on using the blacklist feature to exclude certain devices from multipath configuration refer to the solution "How to blacklist external hard drive taken by multipath".

  • 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]*"     
       }
    
  • 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
      ...
      }
    

Storage configuration and customization

  • Device-mapper-multipath will apply different settings based on the make (vendor) and model (product) of storage in use. The default values for any given release may be found in the file /usr/share/doc/device-mapper-multipath-*/multipath.conf.defaults.

  • Review this file to determine the recommended settings for the storage devices attached to the host. Changes may be made by copying the appropriate settings to /etc/multipath.conf and modifying parameters as desired.

    Note: In most cases no customization is required - the default parameters are carefully selected to work correctly with most deployments. One exception to this is arrays that may be configured to operate in multiple failover modes (for instance standards-based ALUA mode or a proprietary failover mode specific to the array vendor). In this case array-specific configuration steps may be required. Refer to the storage vendor for information on supported failover modes for a given device and check for the existence of product-specific knowledge content, for example, "How do I configure device-mapper-multipath for EMC CLARiion or VNX with ALUA mode in RHEL 6?".

  • To determine the make and model of any storage device attached to the system review the information provided in the /proc and /sys file systems.

  • To view all attached SCSI devices:

      # cat /proc/scsi/scsi
    
  • For example, a system attached to an EMC CLARiiON storage array may include entries similar to the following:

      Attached devices:
      Host: scsi11 Channel: 00 Id: 00 Lun: 00
        Vendor: DGC      Model: RAID 0           Rev: 0851
        Type:   Direct-Access                    ANSI  SCSI revision: 04
      ...   
    
  • To determine vendor and model (product) strings for a specific SCSI disk device (replace sda with the device in question):

      # cat /sys/block/sda/device/vendor
      DGC
      
      # cat /sys/block/sda/device/model
      RAID 5
    
  • Review the configuration and amend as necessary based on device configuration and vendor recommendations.

Detecting and configuring multipath devices

  • A basic multipath.conf file has now been created and populated with appropriate settings for the system.

  • 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
    

Root Cause

  • External storage often permits devices to be accessed by multiple physical paths. This improves redundancy and availability.
  • Red Hat Enterprise Linux provides the device-mapper-multipath component to manage multipath capable storage and to present multipath devices to applications running on the system.
  • Device-mapper-multipath includes built-in support for common storage arrays. The supported devices and configuration defaults can be found in the in /usr/share/doc/device-mapper-multipath-*/multipath.conf.defaults file.
SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.