[linux-lvm] Altering a Physical Volume's UUID [solved]

Mark Krenz mark at suso.org
Fri Sep 8 17:11:47 UTC 2006

  Hey, that works!  Thank you very much Luca.  For other people's
benifit that may find this in a search, here is what I did:

This assumes that you ALREADY have a disk file called lvmdisk1 with lvm partitions on it

# losetup /dev/loop0 lvmdisk1
# vgscan
# vgcfgbackup -f TemplateVG.cfg TemplateVG

Now edit TemplateVG.cfg file and change the IDs for the volume group,
physical volume and logical volumes too.  I made it easy by just
incrementing the last character by one, a becomes b, x becomes y, etc.
Keep track of what ID you gave the physical volume.

# vgchange -a n TemplateVG 

Now run pvcreate using the --uuid option and use the NEW uuid that you
generated an changed to in the VG config file.

# pvcreate -ff --uuid CFhjSe-EqSc-pnDz-4UcP-ylxh-hcY6-oV6BGR --restorefile TestDiskVG.cfg /dev/loop2

It will complain that it couldn't find the physical volume with the
specified uuid, but it will still create the physical volume.

# vgcfgrestore -f TemplateVG.cfg TemplateVG

# vgchange -a y TemplateVG

That's it, now you can change the volume group name if that's what you
need to do.  You should try mounting one of the logical volumes now to
make sure the data is still in tact.

On Fri, Sep 08, 2006 at 03:35:10PM GMT, Luca Berra [bluca at comedia.it] said the following:
> On Fri, Sep 08, 2006 at 12:55:06PM +0000, Mark Krenz wrote:
> > So is there a way to change the UUID of a physical volume and volume
> >group?
> >
> i'd try with vgcfgbackup, sed, pvcreate, vgcfgrestore.
> L.
> -- 
> Luca Berra -- bluca at comedia.it
>        Communication Media & Services S.r.l.
> /"\
> / \
> _______________________________________________
> linux-lvm mailing list
> linux-lvm at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

Mark S. Krenz
IT Director
Suso Technology Services, Inc.

More information about the linux-lvm mailing list