• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure Existing Lvm Volume Group to Use DM-Multipath

by admin

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…).

Note: Always good to have full backup of data to avoid any issue.

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.

How to Install and Configure Device Mapper Multipath in CentOS/RHEL 6,7

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 6 : How to rebuild Initial Ramdisk Image
CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
Note: If rootvg on local disk so you have to blacklist that in multipath.conf on this server.

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

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. who Command Examples in Linux
  2. CentOS / RHEL 7 : How to add a kernel parameter only to a specific kernel
  3. CentOS / RHEL : How to add Physical Volume (PV) to a Volume group (VG) in LVM
  4. file Command Examples in Linux
  5. How to copy directories recursively using rsync while excluding specific files
  6. qemu does not launch : vnc server started
  7. Linux OS Service ‘psacct’
  8. How to Change Default Port of Apache On RHEL/CentOS 7
  9. How To Open A Port In CentOS / RHEL 7
  10. How to Create An LVM Snapshot Of The Root Filesystem And Restore To An Earlier State

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright