[linux-lvm] Question about filter behavior on pvcreate /dev/md0

Heming Zhao heming.zhao at suse.com
Thu Jun 13 07:41:54 UTC 2019


Hello List,

I created a md device, and used pvcreate to format it.
But the pvcreate was failed with filter rules.
the filter in /etc/lvm/lvm.conf:
```
filter = [ "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", 
"r|/dev/fd.*|", "r|/dev/cdrom|" ]
```
if I remove the filter, pvcreate will be successful. why?

steps:
```
# rpm -qa | grep lvm2
lvm2-2.02.180-10.el7_6.7.x86_64
lvm2-libs-2.02.180-10.el7_6.7.x86_64
# dd if=/dev/zero of=/dev/sda bs=1M
   ... ...
# dd if=/dev/zero of=/dev/sdb bs=1M
   ... ...
# mdadm -C /dev/md0 -l 0 -n 2 -a yes /dev/sda /dev/sdb
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started
# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda      8:0    0  256M  0 disk
└─md0    9:0    0  508M  0 raid0
sdb      8:16   0  256M  0 disk
└─md0    9:0    0  508M  0 raid0
vda    253:0    0   40G  0 disk
├─vda1 253:1    0    1G  0 part  /boot
├─vda2 253:2    0   38G  0 part  /
└─vda3 253:3    0    1G  0 part  [SWAP]
# pvcreate /dev/md0
   Device /dev/md0 excluded by a filter.
```

Thanks
zhm




More information about the linux-lvm mailing list