pvcreate出现错误:Device /dev/sdb1 not found (or ignored by filtering).

错误信息:

[root@compute2 ~]# pvcreate -vvv /dev/sdb1
……
Device /dev/sdb1 not found (or ignored by filtering).
No devices to process.
Unlocking /run/lock/lvm/P_orphans
_undo_flock /run/lock/lvm/P_orphans
lvmcache has no info for vgname "#orphans".
Setting global/notify_dbus to 1
Completed: pvcreate -vvv /dev/sdb1

解决思路:

1. 查看是否有/dev/sdb1的分区

如果没有分区,通过下面的命令创建分区:
fdisk /dev/sdb

附:如果想删除上面的分区重新做分区,可以用
dd if=/dev/urandom of=/dev/sdb bs=512 count=64


2. 如果步骤1没有问题,再看一下/etc/lvm/lvm.conf中的“devices”字段中的“filters”是否有a/sdb/。
# Configuration section devices.
# How LVM uses block devices.
devices {
……
# Configuration option devices/filter.
# Limit the block devices that are used by LVM commands.
# This is a list of regular expressions used to accept or reject block
# device path names. Each regex is delimited by a vertical bar '|'
# (or any character) and is preceded by 'a' to accept the path, or
# by 'r' to reject the path. The first regex in the list to match the
# path is used, producing the 'a' or 'r' result for the device.
# When multiple path names exist for a block device, if any path name
# matches an 'a' pattern before an 'r' pattern, then the device is
# accepted. If all the path names match an 'r' pattern first, then the
# device is rejected. Unmatching path names do not affect the accept
# or reject decision. If no path names for a device match a pattern,
# then the device is accepted. Be careful mixing 'a' and 'r' patterns,
# as the combination might produce unexpected results (test changes.)
# Run vgscan after changing the filter to regenerate the cache.
# See the use_lvmetad comment for a special case regarding filters.
#
# Example
# Accept every block device:
# filter = [ "a|.*/|" ]
# Reject the cdrom drive:
# filter = [ "r|/dev/cdrom|" ]
# Work with just loopback devices, e.g. for testing:
# filter = [ "a|loop|", "r|.*|" ]
# Accept all loop devices and ide drives except hdc:
# filter = [ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
# Use anchors to be very specific:
# filter = [ "a|^/dev/hda8$|", "r|.*/|" ]
#
# This configuration option has an automatic default value.
# filter = [ "a|.*/|" ]
#filter = [ "a/sda/", "r/.*/"]
filter = [ "a/sda/", "a/sdb/", "r/.*/"]

原文地址:https://www.cnblogs.com/double12gzh/p/10166100.html