<div dir="ltr"><div>Hi Zhiyong,</div><div>did you filter out the device in lvm.conf ?</div><div><br></div><div>filter = [ ... , "r/sd.*/" , ... ]  </div><div><br></div><div>         or  "r/sda/" if you want to only exclude  sda </div><div><br></div><div>Regards,</div><div>Giorgio.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 13 apr 2023 alle ore 08:55 Zhiyong Ye <<a href="mailto:yezhiyong@bytedance.com">yezhiyong@bytedance.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi Dave,<br>
<br>
Thank you for your reply.<br>
<br>
Because I had not considered multi-pathing before, there is no way to <br>
configure mpath on sda alone on the current stock of machines. And I <br>
tested this in my environment using lvchange --refresh, but it doesn't <br>
switch the active LV to use mpatha.<br>
<br>
# lvchange --refresh is-he57e6mr4wemb19kgf8i<br>
WARNING: Not using device /dev/mapper/mpatha for PV <br>
HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.<br>
WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device <br>
/dev/sda because device is used by LV.<br>
<br>
# pvs<br>
WARNING: Not using device /dev/mapper/mpatha for PV <br>
HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.<br>
WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device <br>
/dev/sda because device is used by LV.<br>
PV           VG                      Fmt  Attr PSize  PFree<br>
/dev/sda     is-he57e6mr4wemb19kgf8i lvm2 a--  10.00t 9.98t<br>
<br>
This is because duplicate PVs are encountered during the disk discovery <br>
phase, but lvmcache tends to use sda because it is currently being used <br>
by LV and mpatha will be dropped.<br>
<br>
I debugged the _choose_duplicates function in lvmcache and printed the <br>
following log:<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 compare duplicates: <br>
/dev/mapper/mpatha 254:3. /dev/sda 8:16. device_hint /dev/sda.<br>
vm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: size 21474836480. <br>
/dev/mapper/mpatha is 21474836480. /dev/sda is 21474836480.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha <br>
was prev <none>. /dev/sda was prev <none>.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha is <br>
in subsystem. /dev/sda is not in subsystem.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha is <br>
dm. /dev/sda is not dm.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha <br>
has no mounted fs. /dev/sda has no mounted fs.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha is <br>
not used for LV. /dev/sda is used for LV.<br>
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 with duplicates will <br>
change from /dev/mapper/mpatha to /dev/sda.<br>
lvm[3352450]: Dropping unchosen duplicate /dev/mapper/mpatha<br>
lvm[3352450]: Adding chosen duplicate /dev/sda<br>
<br>
Is there any way to change the PV preference policy in _choose_duplicates?<br>
<br></blockquote><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Regards<br>
<br>
Zhiyong<br>
<br>
On 4/11/23 9:31 PM, David Teigland wrote:<br>
> On Tue, Apr 11, 2023 at 01:29:42PM +0800, Zhiyong Ye wrote:<br>
>> and lv on it. I then turn on the multipath function and merge the two paths<br>
>> into a new device (/dev/mapper/matha), and I get the following error when I<br>
>> execute the lvm command.<br>
>><br>
>> # pvs<br>
>> WARNING: Not using device /dev/mapper/matha for PV<br>
>> HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.<br>
>> WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device /dev/sda<br>
>> because device is used by LV.<br>
>> PV           VG                      Fmt  Attr PSize  PFree<br>
>> /dev/sda     is-he57e6mr4wemb19kgf8i lvm2 a--  10.00t 9.98t<br>
> <br>
>> May you please advise how one can convert the pv used by vg from sda to<br>
>> matha without affecting the current lv usage.<br>
> <br>
> lvchange --refresh should refresh the active LV to use mpatha.  To avoid<br>
> this, you might configure mpath on sda alone prior to adding the second<br>
> path.<br>
> <br>
> Dave<br>
> <br>
<br>
_______________________________________________<br>
linux-lvm mailing list<br>
<a href="mailto:linux-lvm@redhat.com" target="_blank">linux-lvm@redhat.com</a><br>
<a href="https://listman.redhat.com/mailman/listinfo/linux-lvm" rel="noreferrer" target="_blank">https://listman.redhat.com/mailman/listinfo/linux-lvm</a><br>
read the LVM HOW-TO at <a href="http://tldp.org/HOWTO/LVM-HOWTO/" rel="noreferrer" target="_blank">http://tldp.org/HOWTO/LVM-HOWTO/</a><br>
<br>
</blockquote></div></div>