设备 /dev/mapper/mpathb1 被过滤器排除

设备 /dev/mapper/mpathb1 被过滤器排除

在 CentOS 7 上尝试使用 mpath 设备创建物理卷。但它抛出此错误消息。

如何解决这个问题呢?

 pvcreate /dev/mapper/mpathb1
  Device /dev/mapper/mpathb1 excluded by a filter.

# grep 'filter =' /etc/lvm/lvm.conf |grep -v  "#"
        filter = [ "a|^/dev/sda[1-9]$|", "a|/dev/mapper/.*|" ]


 fdisk -l /dev/mapper/mpathb

Disk /dev/mapper/mpathb: 1099.5 GB, 1099511627776 bytes, 2147483648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 8192 bytes / 33553920 bytes
Disk label type: dos
Disk identifier: 0x00086488

             Device Boot      Start         End      Blocks   Id  System
/dev/mapper/mpathb1           65535  2147483647  1073709056+   5  Extended
Partition 1 does not start on physical sector boundary.

更新1:

我重新创建了分区并更新了 lvm 过滤器。还是同样的错误。

# sgdisk -p /dev/mapper/mpathb
Disk /dev/mapper/mpathb: 2147483648 sectors, 1024.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 4AEDF958-9100-48BF-817E-01200483FA3A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 2147483614
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048      2147483614   1024.0 GiB  8E00  Linux LVM


# grep 'filter =' /etc/lvm/lvm.conf |grep -v  "#"
        filter = [ "a|^/dev/sda[1-9]$|","a|^/dev/sdd[1-9]$|","a|^/dev/dm*|", "a|^/dev/mapper/*|", "r|^/dev/*|" ]

本地连接的磁盘

# lsscsi
[0:0:0:0]    disk    DGC      VRAID            4201  /dev/sda
[0:0:0:1]    disk    DGC      VRAID            4201  /dev/sdb
[0:0:1:0]    disk    DGC      VRAID            4201  /dev/sdc
[0:0:1:1]    disk    DGC      VRAID            4201  /dev/sdd


# multipath -l
mpathb (36006016072b0460093c3485ba71944fa) dm-4 DGC     ,VRAID
size=1.0T features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| `- 0:0:0:1 sdb 8:16 active undef unknown
`-+- policy='service-time 0' prio=0 status=enabled
  `- 0:0:1:1 sdd 8:48 active undef unknown
mpatha (36006016072b046008c5c305bcc0c5bf1) dm-0 DGC     ,VRAID
size=100G features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=0 status=active
| `- 0:0:0:0 sda 8:0  active undef unknown
`-+- policy='service-time 0' prio=0 status=enabled
  `- 0:0:1:0 sdc 8:32 active undef unknown

答案1

这篇文章为我提供了解决问题的信息。

https://serverfault.com/questions/87710/debian-lenny-san-lvm-fail

我使用切片 1 来创建 PV。

# pvcreate /dev/mapper/mpathb1
  Physical volume "/dev/mapper/mpathb1" successfully created.

仅供参考:使用此脚本创建磁盘分区

# cat a.sh
#!/bin/bash
sgdisk -og $1
partprobe $1
ENDSECTOR=`sgdisk -E $1`
sgdisk -n 1:2048:$ENDSECTOR -c 1:"Linux LVM" -t 1:8e00 $1
partprobe $1
sgdisk -p $1

答案2

可能的原因:过滤器配置有问题。参见[1]。 cat /proc/partitions验证内核是否已读取分区表。如果没有,请使用partprobekpartx

[1]https://www.thegeekdiary.com/pvcreate-fails-with-error-device-dev-mapper-mpatha-not-found-or-ignored-by-filtering/

相关内容