Open In App

How to Configure Multipathing in Linux?

Last Updated : 01 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Multipathing is a process that allows us to combine different physical connections between the server and a storage location into a single virtual device. The main idea behind multipathing is to provide a more flexible connection to the storage location for improved performance.

The RHEL supports this process of multipathing by taking the help of the dm-multipath subsystem. It takes the help of the device mapper system present in the kernel to create virtual devices which are then looked after by the multipathd daemon and multipath CLI.

Steps to configure Multipathing in Linux

Step 1: Install the device mapper multipath package

yum -y install device-mapper-multipath 

 

Confirm the installation by typing the below command:

rpm -q device-mapper-multipath

 

Step 2: Generating and Exploring the default device mapper configuration file:

To generate a default config file we can take the help of the mpathconf command. This command along with the –help flag will let us know about the default values that should be used in the file. Create the file in the /etc/mpath.conf location. 

mpathconf  --help

 

The devices which are set by default need not to be set again. The below example shows what this means:

mpathconf  --enable  --find_multipaths  y

The above command will only set the find_multipaths flag while leaving all the other settings to default. This will create a sample multipath.conf file at the /etc/multipath.conf location.

If you want to edit the file which is already there then change the directory to, /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf :

cd /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf 

 

Use the Cat command to see the contents of the .conf file.

cat multipath.conf

 

Step 3. Editing the multipath.conf file:

The below command will generate a file in the multipath directory. Keep in mind that only the entries that we have mentioned will change, the rest will be as they were. 

 mpathconf --enable --user_friendly_names  y

 

Step 4. Enabling the Multipathd service:

systemctl start multipathd
systemctl enable multipathd

 

Step 5. Blacklisting of some devices:

Certain devices that match specific criteria can be blacklisted, this can be mentioned in a short piece of code. These devices will be skipped when the detection of multipath devices would be carried on. The device mapper also provides the facility of a built-in blacklist so that the unsupported devices are excluded automatically.

blacklist {     
  devnode vda
}

In the above example, the device vda will be ignored or blacklisted during the multi-mapper search.

So this is how you can configure multipathing in Linux.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads