linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Question about filter behavior on pvcreate /dev/md0
@ 2019-06-13  7:41 Heming Zhao
  2019-06-14  8:51 ` Zdenek Kabelac
  0 siblings, 1 reply; 3+ messages in thread
From: Heming Zhao @ 2019-06-13  7:41 UTC (permalink / raw)
  To: linux-lvm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] Question about filter behavior on pvcreate /dev/md0
  2019-06-13  7:41 [linux-lvm] Question about filter behavior on pvcreate /dev/md0 Heming Zhao
@ 2019-06-14  8:51 ` Zdenek Kabelac
  2019-06-14 10:01   ` Heming Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Zdenek Kabelac @ 2019-06-14  8:51 UTC (permalink / raw)
  To: LVM general discussion and development, Heming Zhao

Dne 13. 06. 19 v 9:41 Heming Zhao napsal(a):
> 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|" ]
> ```


Hi

This filter mostly eliminates ANY block device you have in the system.
The logic of filtering can be seen as puzzling, but please try to read 
carefully comments in lvm.conf about filtering. It's explained there in the 
great detail.

As soon as the 'accept' rule is seen - the device gets accepted.
Otherwise if you remove device path - all it's associated clones will be also 
removed.

So when you block device generates one of /dev/*/by-path access paths (and I'd 
assume /dev/md0 should be) - it gets removed.

As 'quick fix' you can add 'a' rule for /dev/md.*...

Regards

Zdenek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] Question about filter behavior on pvcreate /dev/md0
  2019-06-14  8:51 ` Zdenek Kabelac
@ 2019-06-14 10:01   ` Heming Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Heming Zhao @ 2019-06-14 10:01 UTC (permalink / raw)
  To: Zdenek Kabelac, LVM general discussion and development

Hello Zdenek,

Thank you for your reply. Your method works well.
I also understand the filter rules gradually.


On 6/14/19 4:51 PM, Zdenek Kabelac wrote:
> Dne 13. 06. 19 v 9:41 Heming Zhao napsal(a):
>> 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|" ]
>> ```
> 
> 
> Hi
> 
> This filter mostly eliminates ANY block device you have in the system.
> The logic of filtering can be seen as puzzling, but please try to read 
> carefully comments in lvm.conf about filtering. It's explained there in 
> the great detail.
> 
> As soon as the 'accept' rule is seen - the device gets accepted.
> Otherwise if you remove device path - all it's associated clones will be 
> also removed.
> 
> So when you block device generates one of /dev/*/by-path access paths 
> (and I'd assume /dev/md0 should be) - it gets removed.
> 
> As 'quick fix' you can add 'a' rule for /dev/md.*...
> 
> Regards
> 
> Zdenek
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-14 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13  7:41 [linux-lvm] Question about filter behavior on pvcreate /dev/md0 Heming Zhao
2019-06-14  8:51 ` Zdenek Kabelac
2019-06-14 10:01   ` Heming Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).