[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] Question about setting of UUID

On 03/07/2011 01:12 PM, sdrb wrote:
> 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?

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

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]