pvcreate fails while using multipath device

Latest response

I am trying to use a multpath device (SAN) to create a logical volume using LVM. But the pvcreate fails to initialize the disk

# pvcreate /dev/mapper/mpathb
  Device /dev/mapper/mpathb not found (or ignored by filtering).

So then I tried adding a partition and re-attempted to initialize the disk. It still failed.
~~~

# parted /dev/mapper/mpathb print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/mpathb: 22.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      2097kB  22.0TB  22.0TB               primary  lvm

# pvcreate -v /dev/mapper/mpathbp1
  Device /dev/mapper/mpathbp1 not found (or ignored by filtering).

Status of mulitpath device:

# multipath -l mpathb
mpathb (36000d31000afae00000000000000000e) dm-2 COMPELNT,Compellent Vol
size=20T features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=0 status=active
  |- 1:0:0:1 sdc 8:32  active undef running
  |- 3:0:0:1 sdb 8:16  active undef running
  |- 1:0:3:1 sdh 8:112 active undef running
  `- 3:0:3:1 sdi 8:128 active undef running

Any help/advice is appreciated?

Responses

this is because of device exclusion in /etc/lvm/lvm.conf file.. check if you see an entry like this:

filter = [ "r|/dev/mapper|" ]

If so, then either comment out that line or modify it so that any lvm operation would include your multipath devices as well.

Thanks for replying. Here's the filter in use in my case:

filter = [ "a|/dev/sda|", "r/block/", "r/disk/", "r/sd.*/", "a/.*/" ]

What does "ls -l /dev/mapper/mpathb*" show?

Typically the mpath device in /dev/mapper is a symbolic link to a dm-* device. When I had this issue long ago I was able to do pvcreate on the linked dm-* device to solve the issue.

could you add "/dev/mapper" filter explicitly and check if that works :

filter = [ "a|/dev/sda|", "a|/dev/mapper/*|" , "r/block/", "r/disk/", "r/sd.*/", "a/.*/" ]

Had a similar issue (RHEL 8.4) but had no filtering. Used parted to create a new partition but created it on /dev/sdx, rather than on /dev/mapper/mapthx. the muilt path address for it was not detected. Running:

parted /dev/mapper/mpathx print

Then the new partition got picked up and was able to run

pvcreate /dev/mapper/mpathxn