11

I am at a new internship and I am asked to extend a volume group, seemed fine :

vgextend [my_group] /dev/sdb

But now I get an error message telling me :

Device /dev/sdb excluded by a filter` 

Could anyone help me figure out what when wrong, or guide me to where the filters are setup.

Dave M
  • 4,494
  • 21
  • 30
  • 30
Tibor BERNARD
  • 113
  • 1
  • 2
  • 9

8 Answers8

15

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.

Steven Shi
  • 251
  • 2
  • 2
7

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.
Zatarra
  • 407
  • 3
  • 5
6

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.
  • If you actually want to add the whole disk to LVM then this may not be the best solution - instead use `wipefs` as in [this answer](https://serverfault.com/a/995717/137843) – harmic Jun 10 '21 at 23:38
4

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.

2

Check /etc/lvm/lvm.conf for uncommented filter = and global_filter = lines. One of these will likely contain some filter which matches /dev/sdb. The default configuration specifies no filters, so this will have been modified in your environment by someone else.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
2

In my personal case: I needed to initialization sharedstorage such as iscsi target, but I couldn't. And the reason was table label of sharestorage and after I executed 'wipefs -a /dev/sdb' everything had done.

1

we solved this by doing the creation with maximum verbosity -vvv and searching for the device (it was a large output) we found the reason for lvm filtering out (seems that it can be many)

$ pvcreate  /dev/rbd0 -vvv
# lot of outputs, did search by the device
> /dev/rbd0: Skipping: Unrecognised LVM device type 252

In our case we had to add the type of block device to /etc/lvm/lvm.conf

types = [ "rbd", 252 ]

you can confirm the type with

cat /proc/devices
Thiago Conrado
  • 245
  • 2
  • 7
1

/dev/sdb: Skipping: Partition table signature found

fdisk /dev/sdb
x ==> MISC : extra functionality (experts only)
c ==> DOS (MBR) : toggle the dos compatibility flag
d ==> delete all partitions
w ==> write table to disk and exit

root@dmz:~# pvcreate /dev/sda
WARNING: dos signature detected on /dev/sda at offset 510. Wipe it? [y/n]: y
  Wiping dos signature on /dev/sda.
  Physical volume "/dev/sda" successfully created.