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.

Leave a Comment