Vgextend : "device excluded by a filter"

In my case I had this problem:

[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
...

So I checked the size of the disk and surprise:

[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

To fix this I did the following:

Initially when I created the disk I've created it using this command:

[root@kvmserver ~]# virsh attach-disk test --source /secret/test_disk1 --target vdb --persistent

Which was wrong, so I did a lil bit of reading and found out dat I have to use a driver for it (becaue of imagine metadata) so I did the following:

[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

Now everything is ok:

[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.

For me, the problem is my /dev/sdb is a GPT partitioned disk. You need to wipe off the GPT records. LVM filters such devices out

Run wipefs -a /dev/sdi first to remove any FS/GPT signatures.


In my case

    root@VirtualBox:~# pvcreate /dev/sdd /dev/sdc
    Device /dev/sdd excluded by a filter.
    Device /dev/sdc excluded by a filter.

solution is: check if there is no partition of the disk. if there are, write the name of the partition.

    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.

Another possibility; I ran into this today. A pvcreate on my /dev/sdb came back with "...excluded by a filter." No filters in lvm.conf and the size was fine. But the -vvv option recommended by @Zatarra helped. In it I saw,

 Closed /dev/sdb
/dev/sdb: Skipping: Partition table signature found

lsblk showed no partitions and fdisk wasn't helpful. But gdisk showed there was GPT partitioning information written to the device. A dd to it probably would have worked - but I used the "zap" option under expert functionality in gdisk (danger!).

Good to go after that.