在进行pvcreate创建PV时,可能会遇到Device /dev/sdX excluded by a filter报错,一般出现这个错误是在通过parted分区并删除相应的分区信息以后。遇到这种情况有两种解决方法:

1、通过wipefs 指令清理盘信息

1# wipefs -a /dev/sdb
2/dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
3/dev/sdb: 8 bytes were erased at offset 0x13ffffe00 (gpt): 45 46 49 20 50 41 52 54
4/dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
5/dev/sdb: calling ioclt to re-read partition table: Success

上面的方法是推荐方法,执行过后再进行分区创建就可以成功了:

1# pvcreate /dev/sdb
2Physical volume "/dev/sdb" successfully created.

2、通过parted重建label卷标

 1[root@servera ~]# parted /dev/vdb
 2GNU Parted 3.2
 3Using /dev/vdb
 4Welcome to GNU Parted! Type 'help' to view a list of commands.
 5(parted) mklabel gpt
 6(parted) quit
 7Information: You may need to update /etc/fstab.
 8[root@servera ~]# pvcreate /dev/vdb
 9  Device /dev/vdb excluded by a filter.
10[root@servera ~]# parted /dev/vdb mklabel msdos
11Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will be lost. Do you
12want to continue?
13Yes/No? yes
14Information: You may need to update /etc/fstab.
15[root@servera ~]# pvcreate /dev/vdb
16WARNING: dos signature detected on /dev/vdb at offset 510. Wipe it? [y/n]: y
17  Wiping dos signature on /dev/vdb.
18  Physical volume "/dev/vdb" successfully created.