Question: PV called “/dev/sdb” that was created over a single device path, need to set this PV to have effective multipath functionalities (Migration of PV from single path to multipath names)
How to configure existing lvm volume group to use DM-Multipath?
It is required to use the existing Volume Group and the existing Logical Volume configuration to ensure that the server-side configuration does not cause any referencing problems for any underlying application (mount points, etc…).
Deactivate logical volumes using underlying path devices of any multipath device, before this make sure, LVM are unmounted and not used by any application,
Deactivate the VG:
# vgchange -an Name_of_your_VG
Once multipath is configured, the logical volumes will be re-activated using the multipath devices, refer below post on how to configure multipath on the server.
Configure LVM to work on top of multipath devices. Change the following two configuration parameters in /etc/lvm.conf:
- filter
- preferred_names
Changing filter line
Change the filters line to “accept” multipath devices, and any other devices that contain LVM PVs, and reject all other devices. For example, the following filter line causes LVM to scan multipath devices with user_friendly_names, as well as local ATA devices, but skip scanning all other devices:
filter = [ "a|/dev/mapper/mpath.*|", "a|/dev/hd|", "r|.*|" ]
Changing the “preferred_names”
The preferred_names line only affects the output of LVM commands, but should be changed as follows, so that multipath devices are used before path devices.
In later versions on LVM2 you are no longer required to set this parameter, as multipath names will be used by default. However, as it causes no harm and is relevant to some older system, it remains here for completeness.
This example causes multipath devices with user_friendly_names to be used:
preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
– Use pvscan to scan for LVM devices using the new filter settings. The output of ‘pvscan’ should show multipath devices.
– Use vgchange -ay or lvchange -ay to activate the logical volumes based on the multipath devices.
– Verify the LVM commands, pvs, vgs, and lvs, show all physical volumes, volume groups, and logical volumes correctly.
– Rebuild the initrd using below post:
CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
From my server Use scsi_id to Return Unique Device Identifiers, this need to black list. For example:
#/lib/udev/scsi_id --whitelisted --device=/dev/sda 3600144f0adf5cc4c0000514a72c10003
Determine which disks are the internal disks and mark them as the ones to blacklist. In this example, /dev/sda is the internal disk. Note that as originally configured in the default multipath configuration file, executing the ‘multipath -v2‘ command shows the local disk, /dev/sda, in the multipath map.
Run ‘multipath -v2 -d’ without blacklist it will show sda in that.
# vi /etc/multipath.conf
In order to prevent the device mapper from mapping /dev/sda in its multipath maps, edit the blacklist section of the /etc/multipath.conf file to include this device. Although could blacklist the sda device using a devnode type, that would not be a safe procedure since /dev/sda is not guaranteed to be the same on reboot. To blacklist individual devices, you can blacklist using the WWID of that device.
Note that in the output to the multipath -v2 command, the WWID of the /dev/sda device is 3600144f0adf5cc4c0000514a72c10003. To blacklist this device, include the following in the /etc/multipath.conf file.
blacklist { wwid SIBM-ESXSST336732LC____F3ET0EP0Q000072428BX1 }
After updated the /etc/multipath.conf file, must manually reload the file. The following command reloads the updated /etc/multipath.conf file.
# systemctl reload multipathd.service