How to convert a single path to a multipath after using dm-multipath
Dear all,
Dm-multipath (multipath-tools in the user-space) provides powerful multipathing capabilities to aggregate multiple paths from the same storage backend into a single disk device. However, it is difficult to extend single paths into multipaths when LVM is already in use.
I used two physical machines to set up the POC environment for testing, with one physical machine acting as the storage iscsi multipath server, setting up the same LUN to have two paths to access. Another physical machine acts as the iscsi client, first using a single path (/dev/sda) and creating vg 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
To be able to use the multipathing capability, I tried to convert the device from pv to matha using vgimportclone, but it failed since both sda and matha were pointing to the same iscsi storage backend.
May you please advise how one can convert the pv used by vg from sda to matha without affecting the current lv usage.
Regards
Zhiyong
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 12 lines · Zhiyong Ye
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
Quoted 2 lines
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
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
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
Quoted 13 lines · David Teigland
Quoted 11 lines · Zhiyong Ye
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
Quoted 9 lines
Quoted 2 lines
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
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Quoted 3 lines · Zhiyong Ye
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.
It seems to work for me with the latest version of lvm, which may be due to improved multipath component detection and/or improved handling of duplicate PVs. So the current upstream code might work for you also.
# pvs PV VG Fmt Attr PSize PFree /dev/sdf ff lvm2 a-- <931.01g <930.76g
# lvs -o+devices LV VG Attr LSize Origin Devices lvol1 ff -wi-ao---- 256.00m /dev/sdf(1)
# mount | grep ff /dev/mapper/ff-lvol1 on /mnt type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
# multipath -a /dev/sdf wwid '3690b11c0000438ad0000057150910423' added
# multipath -l mpatha (3690b11c0000438ad0000057150910423) dm-4 DELL,MD32xxi size=931G features='2 pg_init_retries 50' hwhandler='1 rdac' wp=rw `-+- policy='service-time 0' prio=0 status=active `- 7:0:0:4 sdf 8:80 active undef running
# pvs WARNING: Device mismatch detected for ff/lvol1 which is accessing /dev/sdf instead of /dev/mapper/mpatha. PV VG Fmt Attr PSize PFree /dev/mapper/mpatha ff lvm2 a-- <931.01g <930.76g
# lvs ff WARNING: Device mismatch detected for ff/lvol1 which is accessing /dev/sdf instead of /dev/mapper/mpatha. LV VG Attr LSize lvol1 ff -wi-ao---- 256.00m
# dmsetup table ff-lvol1 0 524288 linear 8:80 10240
# lvchange --refresh ff/lvol1
# dmsetup table ff-lvol1 0 524288 linear 253:4 10240
# pvs PV VG Fmt Attr PSize PFree /dev/mapper/mpatha ff lvm2 a-- <931.01g <930.76g
# lvs -o+devices ff LV VG Attr LSize Devices lvol1 ff -wi-ao---- 256.00m /dev/mapper/mpatha(1)
Dave
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Hi Dave,
Thank you for your patience and explanations.
When I filtered out the sda device on the lvm configuration file it works fine. I will test it again with the latest version of lvm and compare which patches have been added.
I learned a lot from our discussions and thank you again for your help.
Regards
Zhiyong
Quoted 51 lines · David Teigland
Quoted 3 lines · Zhiyong Ye
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.
It seems to work for me with the latest version of lvm, which may be due to improved multipath component detection and/or improved handling of duplicate PVs. So the current upstream code might work for you also.
# pvs PV VG Fmt Attr PSize PFree /dev/sdf ff lvm2 a-- <931.01g <930.76g# lvs -o+devices LV VG Attr LSize Origin Devices lvol1 ff -wi-ao---- 256.00m /dev/sdf(1)# mount | grep ff /dev/mapper/ff-lvol1 on /mnt type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)# multipath -a /dev/sdf wwid '3690b11c0000438ad0000057150910423' added# multipath -l mpatha (3690b11c0000438ad0000057150910423) dm-4 DELL,MD32xxi size=931G features='2 pg_init_retries 50' hwhandler='1 rdac' wp=rw `-+- policy='service-time 0' prio=0 status=active `- 7:0:0:4 sdf 8:80 active undef running# pvs WARNING: Device mismatch detected for ff/lvol1 which is accessing /dev/sdf instead of /dev/mapper/mpatha. PV VG Fmt Attr PSize PFree /dev/mapper/mpatha ff lvm2 a-- <931.01g <930.76g# lvs ff WARNING: Device mismatch detected for ff/lvol1 which is accessing /dev/sdf instead of /dev/mapper/mpatha. LV VG Attr LSize lvol1 ff -wi-ao---- 256.00m# dmsetup table ff-lvol1 0 524288 linear 8:80 10240# lvchange --refresh ff/lvol1# dmsetup table ff-lvol1 0 524288 linear 253:4 10240# pvs PV VG Fmt Attr PSize PFree /dev/mapper/mpatha ff lvm2 a-- <931.01g <930.76g
Quoted 6 lines
# lvs -o+devices ff LV VG Attr LSize Devices lvol1 ff -wi-ao---- 256.00m /dev/mapper/mpatha(1)Dave
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
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 <[email protected]> ha scritto:
Quoted 84 lines
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.98tThis 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_duplicatesfunction in lvmcache and printed the following log:
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 compare duplicates:/dev/mapper/mpatha254:3./dev/sda8:16.device_hint/dev/sda. vm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: size 21474836480./dev/mapper/mpathais 21474836480./dev/sdais 21474836480. lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathawas prev <none>./dev/sdawas prev <none>.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathais in subsystem./dev/sdais not in subsystem.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathais dm./dev/sdais not dm.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathahas no mounted fs./dev/sdahas no mounted fs.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathais not used for LV./dev/sdais used for LV.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 with duplicates will change from/dev/mapper/mpathato/dev/sda.
lvm[3352450]: Dropping unchosen duplicate/dev/mapper/mpathalvm[3352450]: Adding chosen duplicate/dev/sdaIs there any way to change the PV preference policy in
_choose_duplicates?Regards
Zhiyong
Quoted 2 lines · David Teigland
Quoted 1 line · Zhiyong Ye
and lv on it. I then turn on the multipath function and merge the two
paths
Quoted 1 line
Quoted 1 line
into a new device (
/dev/mapper/matha), and I get the following errorwhen I
Quoted 6 lines
Quoted 6 lines
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/sdaQuoted 11 lines
Quoted 6 lines
because device is used by LV.
PV VG Fmt Attr PSize PFree/dev/sdais-he57e6mr4wemb19kgf8i lvm2 a-- 10.00t 9.98tMay 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.
Quoted 10 lines
Quoted 2 lines
Dave
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
_______________________________________________
linux-lvm mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
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
Quoted 105 lines · Giorgio Bersano
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 <[email protected] <mailto:[email protected]>> 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/mpathafor PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.
WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device/dev/sdabecause device is used by LV.# pvs
WARNING: Not using device/dev/mapper/mpathafor PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25.
WARNING: PV HgL3xR-qTio-m75Q-nGAO-Un0U-8uHk-wHbH25 prefers device/dev/sdabecause device is used by LV.
PV VG Fmt Attr PSize PFree /dev/sda is-he57e6mr4wemb19kgf8i lvm2 a-- 10.00t 9.98tThis 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_duplicatesfunction in lvmcache and printed the following log:
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 compare duplicates:
/dev/mapper/mpatha254:3./dev/sda8:16.device_hint/dev/sda. vm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25: size 21474836480./dev/mapper/mpathais 21474836480./dev/sdais 21474836480. lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathawas prev <none>./dev/sdawas prev <none>.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
/dev/mapper/mpathais
in subsystem./dev/sdais not in subsystem.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
/dev/mapper/mpathais
dm./dev/sdais not dm.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:/dev/mapper/mpathahas no mounted fs./dev/sdahas no mounted fs. lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25:
/dev/mapper/mpathais
not used for LV./dev/sdais used for LV.
lvm[3352450]: PV HgL3xRqTiom75QnGAOUn0U8uHkwHbH25 with duplicates will change from/dev/mapper/mpathato/dev/sda.
lvm[3352450]: Dropping unchosen duplicate/dev/mapper/mpathalvm[3352450]: Adding chosen duplicate/dev/sdaIs 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/mathafor 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
>
Quoted 8 lines
_______________________________________________
linux-lvm mailing list
[email protected] <mailto:[email protected]>
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
[email protected]
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/