Hi Giorgio,

Thank you for your reply and detailed answers.

When I filtered out the sda device on the lvm configuration file it works fine.

Thank you again for your help.

Regards

Zhiyong

On 4/13/23 6:54 PM, Giorgio Bersano wrote:
Hi Zhiyong,
did you filter out the device in lvm.conf ?

filter = [ ... , "r/sd.*/" , ... ]

          or  "r/sda/" if you want to only exclude  sda

Regards,
Giorgio.


Il giorno gio 13 apr 2023 alle ore 08:55 Zhiyong Ye <yezhiy...@bytedance.com <mailto:yezhiy...@bytedance.com>> ha scritto:


    Hi Dave,

    Thank you for your reply.

    Because I had not considered multi-pathing before, there is no way to
    configure mpath on sda alone on the current stock of machines. And I
    tested this in my environment using lvchange --refresh, but it doesn't
    switch the active LV to use mpatha.

    # lvchange --refresh is-he57e6mr4wemb19kgf8i
    WARNING: Not using device /dev/mapper/mpatha for PV
    HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.
    WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device
    /dev/sda because device is used by LV.

    # pvs
    WARNING: Not using device /dev/mapper/mpatha for PV
    HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.
    WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device
    /dev/sda because device is used by LV.
    PV           VG                      Fmt  Attr PSize  PFree
    /dev/sda     is-he57e6mr4wemb19kgf8i lvm2 a--  10.00t 9.98t

    This is because duplicate PVs are encountered during the disk discovery
    phase, but lvmcache tends to use sda because it is currently being used
    by LV and mpatha will be dropped.

    I debugged the _choose_duplicates function in lvmcache and printed the
    following log:
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 compare duplicates:
    /dev/mapper/mpatha 254:3. /dev/sda 8:16. device_hint /dev/sda.
    vm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: size 21474836480.
    /dev/mapper/mpatha is 21474836480. /dev/sda is 21474836480.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha
    was prev <none>. /dev/sda was prev <none>.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
    /dev/mapper/mpatha is
    in subsystem. /dev/sda is not in subsystem.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
    /dev/mapper/mpatha is
    dm. /dev/sda is not dm.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: /dev/mapper/mpatha
    has no mounted fs. /dev/sda has no mounted fs.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
    /dev/mapper/mpatha is
    not used for LV. /dev/sda is used for LV.
    lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 with duplicates will
    change from /dev/mapper/mpatha to /dev/sda.
    lvm[3352450]: Dropping unchosen duplicate /dev/mapper/mpatha
    lvm[3352450]: Adding chosen duplicate /dev/sda

    Is there any way to change the PV preference policy in
    _choose_duplicates?




    Regards

    Zhiyong

    On 4/11/23 9:31 PM, David Teigland wrote:
     > On Tue, Apr 11, 2023 at 01:29:42PM +0800, Zhiyong Ye wrote:
     >> and lv on it. I then turn on the multipath function and merge
    the two paths
     >> into a new device (/dev/mapper/matha), and I get the following
    error when I
     >> execute the lvm command.
     >>
     >> # pvs
     >> WARNING: Not using device /dev/mapper/matha for PV
     >> HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.
     >> WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers
    device /dev/sda
     >> because device is used by LV.
     >> PV           VG                      Fmt  Attr PSize  PFree
     >> /dev/sda     is-he57e6mr4wemb19kgf8i lvm2 a--  10.00t 9.98t
     >
     >> May you please advise how one can convert the pv used by vg from
    sda to
     >> matha without affecting the current lv usage.
     >
> lvchange --refresh should refresh the active LV to use mpatha. To avoid
     > this, you might configure mpath on sda alone prior to adding the
    second
     > path.
     >
     > Dave
     >

    _______________________________________________
    linux-lvm mailing list
    linux-lvm@redhat.com <mailto:linux-lvm@redhat.com>
    https://listman.redhat.com/mailman/listinfo/linux-lvm
    <https://listman.redhat.com/mailman/listinfo/linux-lvm>
    read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
    <http://tldp.org/HOWTO/LVM-HOWTO/>


_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Reply via email to