Skip to contentSkip to conversation

Question about setting of UUID

linux-lvm sdrb 2 participants 2 messages Mar 7, 2011

lore
Share & tools
lore

sdrb

author
#0 lore raw

Hello,

I have got question regarding setting of UUID for PV, VG and LV.

I'd like to ask if there are any plans to add possibility of manual setting and changing UUIDs? I mean if it could be possible to change UUID of PV just by typing:

  # pvchange -s aaaaaaaabbbbbbbbccccccccdddddddd /dev/sdb

and analogous changes in lvchange and vgchange?

There are some situations when it could be very helpful.

#1 lore raw
Quoted 5 lines · sdrb

Hello,

I have got question regarding setting of UUID for PV, VG and LV.

Quoted 7 lines

I'd like to ask if there are any plans to add possibility of manual setting and changing UUIDs?
I mean if it could be possible to change UUID of PV just by typing:

   # pvchange -s aaaaaaaabbbbbbbbccccccccdddddddd /dev/sdb

and analogous changes in lvchange and vgchange?

The pvchange and vgchange commands can already generate a new random UUID for PVs and VGs (man 8 pvchange/vgchange):

-u, --uuid
Generate new random UUID for specified Volume Groups.

And you can specify any UUID you like for PVs with pvcreate (man 8 pvcreate):

-u, --uuid uuid
Specify the uuid for the device. Without this option, pvcreate generates a random uuid. All of your physical volumes must have
unique uuids. You need to use this option before restoring a
backup of LVM metadata onto a replacement device - see vgcfgrestore(8).

You can also use pvcreate (with -ff/-y) to re-create an existing PV (without modifying its data areas) with a UUID of your choosing. After doing this you can restore VG metadata to the PV with vgcfgrestore (to ensure the newly re-created PV is compatible with the intended VG layout you should also pass --restorefile=/path/to/file to pvcreate when setting the UUID).

Afaik there's no --uuid option to lvchange but since all LV UUIDs are derived from the respective VG UUID changing the VG should also change all the LVs it contains.

Regards,
Bryn.