Chapter 3. Configuring DM Multipath
Configure DM Multipath by using the mpathconf utility, which creates or edits the /etc/multipath.conf configuration file to set up basic failover and additional storage options.
This utility creates or edits the /etc/multipath.conf multipath configuration file based on the following scenarios:
-
If the
/etc/multipath.conffile already exists, thempathconfutility will edit it. -
If the
/etc/multipath.conffile does not exist, thempathconfutility will create the/etc/multipath.conffile from scratch.
3.1. Checking for the device-mapper-multipath package Copy linkLink copied to clipboard!
Verify that the device-mapper-multipath package is installed on your system to ensure all necessary components are available before configuring multipathing. This prevents potential failures caused by missing core software.
Procedure
Check if your system includes the
device-mapper-multipathpackage:# rpm -q device-mapper-multipathdevice-mapper-multipath-current-package-versionIf your system does not include the package, it prints the following:
package device-mapper-multipath is not installedIf your system does not include the package, install it by running the following command:
# dnf install device-mapper-multipath
3.2. Setting up basic failover configuration with DM Multipath Copy linkLink copied to clipboard!
Establishing a basic failover configuration for DM Multipath provides path redundancy and enhances storage reliability. It ensures that I/O operations continue through alternate paths if one fails, preventing downtime or data loss.
Prerequisites
- Administrative access.
Procedure
Enable and initialize the multipath configuration file:
# mpathconf --enableOptional: Edit the
/etc/multipath.conffile.Most default settings are already configured, including
path_grouping_policywhich is set tofailover.Optional: The default naming format of multipath devices is set to
/dev/mapper/mpathnformat. If you prefer a different naming format:Configure DM Multipath to use the multipath device WWID as its name, instead of the mpath_n_ user-friendly naming scheme:
# mpathconf --enable --user_friendly_names nReload the configuration of the DM Multipath daemon:
# systemctl reload multipathd.service
Start the DM Multipath daemon:
# systemctl start multipathd.service
Verification
Confirm that the DM Multipath daemon is running without issues:
# systemctl status multipathd.serviceVerify the naming format of multipath devices:
# ls /dev/mapper/
3.3. Ignoring local disks when generating multipath devices Copy linkLink copied to clipboard!
To prevent DM Multipath from using local Small Computer System Interface (SCSI) disks, you can configure it to ignore these devices during multipath device generation. Setting find_multipaths to on simplifies this process; otherwise, manual exclusion is required in the configuration file.
Procedure
Identify the internal disk by using known parameters such as the device’s model, path, or vendor. Determine its WWID by using the following options:
Display existing multipath devices:
# multipath -v2 -lmpatha (WDC_WD800JD-75MSA3_WD-WMAM9FU71040) dm-2 ATA,WDC WD800JD-75MS size=33 GB features="0" hwhandler="0" wp=rw `-+- policy='round-robin 0' prio=0 status=active |- 0:0:0:0 sda 8:0 active undef runningDisplay additional multipath devices that DM Multipath could create:
# multipath -v2 -d: mpatha (WDC_WD800JD-75MSA3_WD-WMAM9FU71040) dm-2 ATA,WDC WD800JD-75MS size=33 GB features="0" hwhandler="0" wp=undef `-+- policy='round-robin 0' prio=1 status=undef |- 0:0:0:0 sda 8:0 undef ready runningDisplay device information:
# multipathd show paths raw format "%d %w" | grep sdasda WDC_WD800JD-75MSA3_WD-WMAM9FU71040In this example,
/dev/sdais the internal disk and its WWID isWDC_WD800JD-75MSA3_WD-WMAM9FU71040.
Edit the
blacklistsection of the/etc/multipath.conffile to ignore this device by using its WWID attribute:blacklist { wwid WDC_WD800JD-75MSA3_WD-WMAM9FU71040 }WarningAlthough you can identify the device by using its
devnodeparameter, such as sda, this is not safe. The/dev/sdaidentifier is not guaranteed to refer to the same device on reboot.Check for any configuration errors in the
/etc/multipath.conffile:# multipath -t > /dev/nullTo see the full report, do not discard the command output:
# multipath -t-
Remake the initramfs if the disk is included in
initramfs. For more information, see Configuring multipathing in initramfs. Reload the
/etc/multipath.conffile by reconfiguring themultipathddaemon:# systemctl reload multipathdNoteMultipath devices on top of local disks cannot be removed when in use. To ignore such device, stop all users of the device. For example, by unmounting any filesystem on top of it and deactivating any logical volumes using it. If this is not possible, you can reboot the system to remove the multipath device.
Verification
Verify that the internal disk is ignored and it is not displayed in the multipath output:
List the multipathed devices:
# multipath -v2 -lList the additional devices that DM Multipath could create:
# multipath -v2 -d
3.4. Configuring additional storage with DM Multipath Copy linkLink copied to clipboard!
By default, DM Multipath includes built-in configurations for the most common storage arrays, which support DM Multipath. If your storage array does not already have a configuration, you can add one by editing the /etc/multipath.conf file.
Add additional storage devices during the initial configuration to align the setup with your anticipated needs. DM Multipath enables adding devices later for scalability or upgrades, but this approach may require adjusting configurations to ensure compatibility.
Procedure
View the default configuration value and supported devices:
# multipathd show configEdit the
/etc/multipath.conffile to set up your multipath configuration. Below is an example for the DM Multipath configuration for HP OPEN-V Storage Device:# Set default configurations for all devices managed by DM Multipathdefaults { # Enable user-friendly names for devices user_friendly_names yes } devices { # Define configuration for HP OPEN-V storage device { vendor "HP" pproduct "OPEN-V" no_path_retry 18 } }- Save your changes and close the editor.
Update the multipath device list by scanning for new devices:
# multipath -r
Verification
Confirm that the multipath devices are recognized correctly:
# multipath -ll
3.5. Configuring multipathing in initramfs Copy linkLink copied to clipboard!
Setting up multipathing in the initramfs ensure multipath devices are available early in the boot process. This is essential for storage setups requiring redundancy and load balancing, helping maintain system integrity and avoid issues during startup.
Prerequisites
- Configured DM multipath on your system.
Procedure
Rebuild the
initramfsfile system with the multipath configuration files:# dracut --force --add multipathNoteWhen using multipath in the
initramfsand modifying its configuration files, remember to rebuild theinitramfsfor the changes to take effect. If your root device employs multipath, thedracutcommand will automatically include the multipath module in theinitramfs.Optional: If multipath in the
initramfsis no longer necessary:Remove the multipath configuration file:
# rm /etc/dracut.conf.d/multipath.confRebuild the
initramfswith the added multipath configuration:# dracut --force --omit multipath
Verification
Check if multipath-related files and configurations are present:
# lsinitrd /path/to/initramfs.img -m | grep multipath
While verification steps provided can give you an indication of success, you must perform a final test boot-up to ensure that the configuration works as expected.
After the reboot, confirm that the multipath devices are recognized correctly:
# multipath -ll