16.12 Using LVM2 on Multipath Devices

Ensure that the configuration file for lvm.conf points to the multipath-device names instead of fixed path names. This should happen automatically if boot.multipath is enabled and loads before boot.lvm.

16.12.1 Adding a Multipath Device Filter in the /etc/lvm/lvm.conf File

By default, LVM2 does not recognize multipathed devices. To make LVM2 recognize the multipathed devices as possible physical volumes, you must modify /etc/lvm/lvm.conf to scan multipathed devices through the multipath I/O layer.

Adding a multipath filter prevents LVM from scanning and using the physical paths for raw device nodes that represent individual paths to the SAN (/dev/sd*). Ensure that you specify the filter path so that LVM scans only the device mapper names for the device (/dev/disk/by-id/dm-uuid-.*-mpath-.*) after multipathing is configured.

To modify /etc/lvm/lvm.conf for multipath use:

  1. Open the /etc/lvm/lvm.conf file in a text editor.

    If /etc/lvm/lvm.conf does not exist, you can create one based on your current LVM configuration by entering the following at a terminal console prompt:

    sudo lvm dumpconfig > /etc/lvm/lvm.conf
  2. Change the filter and types entries in /etc/lvm/lvm.conf as follows:

    filter = [ "a|/dev/disk/by-id/.*|", "r|.*|" ]
    types = [ "device-mapper", 1 ]

    This allows LVM2 to scan only the by-id paths and reject everything else.

    If you are using user-friendly names, specify the filter path so that only the Device Mapper names are scanned after multipathing is configured. The following filter path accepts only partitions on a multipathed device:

    filter = [ "a|/dev/disk/by-id/dm-uuid-.*-mpath-.*|", "r|.*|" ]

    To accept both raw disks and partitions for Device Mapper names, specify the path as follows, with no hyphen (-) before mpath:

    filter = [ "a|/dev/disk/by-id/dm-uuid-.*mpath-.*|", "r|.*|" ]
  3. If you are also using LVM2 on non-multipathed devices, make the necessary adjustments in the filter and types entries to suit your setup. Otherwise, the other LVM devices are not visible with a pvscan after you modify the lvm.conf file for multipathing.

    You want only those devices that are configured with LVM to be included in the LVM cache, so ensure that you are specific about which other non-multipathed devices are included by the filter.

    For example, if your local disk is /dev/sda and all SAN devices are /dev/sdb and above, specify the local and multipathing paths in the filter as follows:

    filter = [ "a|/dev/sda.*|", "a|/dev/disk/by-id/.*|", "r|.*|" ]
    types = [ "device-mapper", 253 ]
  4. Save the file.

  5. Add dm-multipath to /etc/dracut.conf.d/01-dist.conf by adding the following line:

  6. Make a new initrd to ensure that the Device Mapper Multipath services are loaded with the changed settings. Running dracut is needed only if the root (/) device or any parts of it (such as /var, /etc, /log) are on the SAN and multipath is needed to boot.

    Enter the following at a terminal console prompt:

    dracut -f --add-drivers multipath
  7. Reboot the server to apply the changes.