Centos

設備 /dev/mapper/mpathb1 被過濾器排除

  • December 24, 2018

在 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

這篇文章為我提供了解決問題的資訊。

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

可能的原因:過濾器配置有問題。看

$$ 1 $$. cat /proc/partitions驗證分區表是否已被核心讀取。如果不是,請使用partprobeor kpartx。 $$ 1 $$ https://www.thegeekdiary.com/pvcreate-fails-with-error-device-dev-mapper-mpatha-not-found-or-ignored-by-filtering/

引用自:https://unix.stackexchange.com/questions/455185