linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* Import duplicate VG from a read-only device
@ 2024-11-15 20:07 Gionatan Danti
  2024-11-18  9:53 ` Zdenek Kabelac
  0 siblings, 1 reply; 6+ messages in thread
From: Gionatan Danti @ 2024-11-15 20:07 UTC (permalink / raw)
  To: linux-lvm

Hi list,
is it possible to import a duplicate VG name from a read-only device?

I know about vgrename, but it needs to update metadata - which is not 
possible for read-only device.

I tried to un-manage the host native read/write VG, deleting it from 
system.devices, but lvchange -ay shown an error about not being able to 
create the /dev/VG/LV symlink (and a "device busy" issue, probably 
related to the already-existing symlink). I also tried to activate the 
specific LV via lvchange -S lv_uuid, but it shown the same error as 
above.

In this specific case I put the device in r/w mode and solved the issue 
with a plain vgrename. But what if I could not enable writes on the 
device? Is the only solution to mount it on a machine without the same 
VG name (ie: on a live USB), or can a VG/LV be enabled specifying a 
different path for the symlink?

Thanks.

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

* Re: Import duplicate VG from a read-only device
  2024-11-15 20:07 Import duplicate VG from a read-only device Gionatan Danti
@ 2024-11-18  9:53 ` Zdenek Kabelac
  2024-11-18 13:38   ` Erwin van Londen
  0 siblings, 1 reply; 6+ messages in thread
From: Zdenek Kabelac @ 2024-11-18  9:53 UTC (permalink / raw)
  To: Gionatan Danti, linux-lvm

Dne 15. 11. 24 v 21:07 Gionatan Danti napsal(a):
> Hi list,
> is it possible to import a duplicate VG name from a read-only device?
> 
> I know about vgrename, but it needs to update metadata - which is not possible 
> for read-only device.
> 
> I tried to un-manage the host native read/write VG, deleting it from 
> system.devices, but lvchange -ay shown an error about not being able to create 
> the /dev/VG/LV symlink (and a "device busy" issue, probably related to the 
> already-existing symlink). I also tried to activate the specific LV via 
> lvchange -S lv_uuid, but it shown the same error as above.
> 
> In this specific case I put the device in r/w mode and solved the issue with a 
> plain vgrename. But what if I could not enable writes on the device? Is the 
> only solution to mount it on a machine without the same VG name (ie: on a live 
> USB), or can a VG/LV be enabled specifying a different path for the symlink?

Hi

You can always write appropriate  lvm.conf  filter or use  devicesfile  to 
list only those devices/PV you want to use and not cause 'duplicate VG' 
problem for command processing.

However there is no chance to activate duplicated VG/LV as clearly there 
cannot exist 2 DM devices with the same name/uuid - they must be unique!

So perhaps maybe you can 'rename' VG of the system you are running from - if 
you cannot change the metadata on you read-only device.

Here I'd probably suggest to simply avoid creating such problems upfront,
AKA - if all your systems are using the same VG name and then you want to 
'share/swap' such devices between your systems - you should always pick a 
unique VG name for each such system. That way avoids all the problems....

Regards

Zdenek


PS: I think ATM lvm2 is already complicated enough to creating some 'overlay' 
level of referencing  lvm2 names in the system through some 'abstract' 
mechanism to solve the issue that can be easily eliminated ahead makes not 
much sense to implement....


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

* Re: Import duplicate VG from a read-only device
  2024-11-18  9:53 ` Zdenek Kabelac
@ 2024-11-18 13:38   ` Erwin van Londen
  2024-11-18 15:04     ` Gionatan Danti
  0 siblings, 1 reply; 6+ messages in thread
From: Erwin van Londen @ 2024-11-18 13:38 UTC (permalink / raw)
  To: Zdenek Kabelac, Gionatan Danti, linux-lvm

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

On 18/11/24 19:53, Zdenek Kabelac wrote:
> Dne 15. 11. 24 v 21:07 Gionatan Danti napsal(a):
>> Hi list,
>> is it possible to import a duplicate VG name from a read-only device?
>>
>> I know about vgrename, but it needs to update metadata - which is not possible
>> for read-only device.
>>
>> I tried to un-manage the host native read/write VG, deleting it from
>> system.devices, but lvchange -ay shown an error about not being able to create
>> the /dev/VG/LV symlink (and a "device busy" issue, probably related to the
>> already-existing symlink). I also tried to activate the specific LV via
>> lvchange -S lv_uuid, but it shown the same error as above.
>>
>> In this specific case I put the device in r/w mode and solved the issue with a
>> plain vgrename. But what if I could not enable writes on the device? Is the
>> only solution to mount it on a machine without the same VG name (ie: on a live
>> USB), or can a VG/LV be enabled specifying a different path for the symlink?
> Hi
>
> You can always write appropriate  lvm.conf  filter or use  devicesfile  to
> list only those devices/PV you want to use and not cause 'duplicate VG'
> problem for command processing.
>
> However there is no chance to activate duplicated VG/LV as clearly there
> cannot exist 2 DM devices with the same name/uuid - they must be unique!
>
> So perhaps maybe you can 'rename' VG of the system you are running from - if
> you cannot change the metadata on you read-only device.
>
> Here I'd probably suggest to simply avoid creating such problems upfront,
> AKA - if all your systems are using the same VG name and then you want to
> 'share/swap' such devices between your systems - you should always pick a
> unique VG name for each such system. That way avoids all the problems....
>
> Regards
>
> Zdenek
>
>
> PS: I think ATM lvm2 is already complicated enough to creating some 'overlay'
> level of referencing  lvm2 names in the system through some 'abstract'
> mechanism to solve the issue that can be easily eliminated ahead makes not
> much sense to implement....
>
>
Do I agree with the above sentence!!!!.  I've seen major issues where 
administrators have created a massively complex system out of LVM to the 
extend they dug themselves a rabithole from which they couldn't escape 
anymore. ALWAYS keep it as simple as possible and only use what you 
actually need. Try to stay away from bells and whistles if you don't 
needs them....

Cheers

Erwin


[-- Attachment #2: OpenPGP_0x985B90929D90E282.asc --]
[-- Type: application/pgp-keys, Size: 2513 bytes --]

[-- Attachment #3: OpenPGP_signature.asc --]
[-- Type: application/pgp-signature, Size: 677 bytes --]

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

* Re: Import duplicate VG from a read-only device
  2024-11-18 13:38   ` Erwin van Londen
@ 2024-11-18 15:04     ` Gionatan Danti
  2024-11-18 18:25       ` Stuart D Gathman
  0 siblings, 1 reply; 6+ messages in thread
From: Gionatan Danti @ 2024-11-18 15:04 UTC (permalink / raw)
  To: Erwin van Londen; +Cc: Zdenek Kabelac, linux-lvm

Il 2024-11-18 14:38 Erwin van Londen ha scritto:
> On 18/11/24 19:53, Zdenek Kabelac wrote:
>> PS: I think ATM lvm2 is already complicated enough to creating some 
>> 'overlay'
>> level of referencing  lvm2 names in the system through some 'abstract'
>> mechanism to solve the issue that can be easily eliminated ahead makes 
>> not
>> much sense to implement....
>> 
>> 
> Do I agree with the above sentence!!!!.  I've seen major issues where
> administrators have created a massively complex system out of LVM to 
> the
> extend they dug themselves a rabithole from which they couldn't escape
> anymore. ALWAYS keep it as simple as possible and only use what you
> actually need. Try to stay away from bells and whistles if you don't
> needs them....
> 
> Cheers
> 
> Erwin

Sure, I completely agree with both.
I was just curious to know if I was missing something obvious.

Thanks.

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

* Re: Import duplicate VG from a read-only device
  2024-11-18 15:04     ` Gionatan Danti
@ 2024-11-18 18:25       ` Stuart D Gathman
  2024-11-18 20:44         ` Gionatan Danti
  0 siblings, 1 reply; 6+ messages in thread
From: Stuart D Gathman @ 2024-11-18 18:25 UTC (permalink / raw)
  To: Gionatan Danti; +Cc: Erwin van Londen, Zdenek Kabelac, linux-lvm

On Mon, 18 Nov 2024, Gionatan Danti wrote:

> Sure, I completely agree with both.
> I was just curious to know if I was missing something obvious.

I would use device mapper to create a writable overlay block device
of the readonly block device (like Live media does) and rename that to
import.  No monkeying about with namespaces.

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

* Re: Import duplicate VG from a read-only device
  2024-11-18 18:25       ` Stuart D Gathman
@ 2024-11-18 20:44         ` Gionatan Danti
  0 siblings, 0 replies; 6+ messages in thread
From: Gionatan Danti @ 2024-11-18 20:44 UTC (permalink / raw)
  To: Stuart D Gathman; +Cc: Erwin van Londen, Zdenek Kabelac, linux-lvm

Il 2024-11-18 19:25 Stuart D Gathman ha scritto:
> I would use device mapper to create a writable overlay block device
> of the readonly block device (like Live media does) and rename that to
> import.  No monkeying about with namespaces.

Yes, it would probably be the only solution with a real read-only 
device.

Still, I remember the good old advice to not touch the dm table when 
using LVM (to avoid doing something wrong with the LVM-managed tables) - 
so I would probably be more comfortable using a live media to rename the 
duplicate VG.

Thanks.

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

end of thread, other threads:[~2024-11-18 20:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15 20:07 Import duplicate VG from a read-only device Gionatan Danti
2024-11-18  9:53 ` Zdenek Kabelac
2024-11-18 13:38   ` Erwin van Londen
2024-11-18 15:04     ` Gionatan Danti
2024-11-18 18:25       ` Stuart D Gathman
2024-11-18 20:44         ` Gionatan Danti

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).