我正在接受新的实习,并被要求扩展一个卷组,这似乎很好:
vgextend [my_group] /dev/sdb
但现在我收到一条错误消息告诉我:
Device /dev/sdb excluded by a filter`
有人能帮我找出问题所在吗,或者指导我如何设置过滤器。
答案1
就我而言,我遇到了这个问题:
[root@test ~]# pvcreate /dev/vdb
Device /dev/vdb excluded by a filter.
[root@test ~]# pvcreate /dev/vdb -vvv
...
/dev/vdb: size is 385 sectors
/dev/vdb: Skipping: Too small to hold a PV
Closed /dev/vdb
...
于是我检查了磁盘的大小并感到惊讶:
[root@test ~]# fdisk -l /dev/vdb
Disk /dev/vdb: 0 MB, 197120 bytes, 385 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
为了解决这个问题,我做了以下事情:
最初当我创建磁盘时,我使用以下命令创建它:
[root@kvmserver ~]# virsh attach-disk test --source /secret/test_disk1 --target vdb --persistent
这是错误的,所以我读了一些资料并发现我必须使用驱动程序(因为想象元数据)所以我做了以下操作:
[root@kvmserver ~]# virsh detach-disk test /secret/test_disk1 --config Disk detached successfully
[root@kvmserver ~]# virsh attach-disk test --source /secret/test_disk1 --target vdb --persistent --subdriver qcow2
Disk attached successfully
现在一切正常:
[root@test ~]# fdisk -l /dev/vdb
Disk /dev/vdb: 1073 MB, 1073741824 bytes, 2097152 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[root@test ~]# pvcreate /dev/vdb
Physical volume "/dev/vdb" successfully created.
答案2
对我来说,问题是我的 /dev/sdb 是 GPT 分区磁盘。您需要清除 GPT 记录。LVM 会过滤掉此类设备。
首先运行wipefs -a /dev/sdi
以删除任何 FS/GPT 签名。
答案3
就我而言
root@VirtualBox:~# pvcreate /dev/sdd /dev/sdc
Device /dev/sdd excluded by a filter.
Device /dev/sdc excluded by a filter.
解决方案是: 检查磁盘是否没有分区。如果有,则写入分区的名称。
root@VirtualBox:~# pvcreate /dev/sdd1 /dev/sdd2 /dev/sdc1 /dev/sdc2 /dev/sdc3
WARNING: ext4 signature detected on /dev/sdc1 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdc1.
Physical volume "/dev/sdd1" successfully created.
Physical volume "/dev/sdd2" successfully created.
Physical volume "/dev/sdc1" successfully created.
Physical volume "/dev/sdc2" successfully created.
Physical volume "/dev/sdc3" successfully created.
答案4
检查/etc/lvm/lvm.conf
未注释的filter =
和global_filter =
行。其中一个可能包含与匹配的某些过滤器/dev/sdb
。默认配置未指定任何过滤器,因此这将在您的环境中被其他人修改。