Discussion:
LVM: how do I change the UUID of a LV?
Timothy Selivanow
2008-03-04 18:23:24 UTC
Permalink
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option. Here is how I've been changing the others
(note that "--uuid" does not appear in the man pages for pvchange and
vgchange for lvm2-2.02.26-3.el5):

pvchange --uuid {pv dev}
vgchange --uuid {vg name}


Any suggestions? I'm pretty much open to any arcane/convoluted
procedure, but I refrain from copying the data to a temp place so I can
re-create the LV as that would add too much work and would kinda defeat
what I'm doing. Thanks!


--Tim
_________________________________________________________
/ Obviously I was either onto something, or on something. \
\ -- Larry Wall on the creation of Perl /
---------------------------------------------------------
\
\ \
\ /\
( )
.( o ).
Alasdair G Kergon
2008-03-12 13:28:47 UTC
Permalink
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?

Alasdair
--
agk at redhat.com
Robin Laing
2008-03-12 15:27:14 UTC
Permalink
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
Alasdair
I can think of data recovery as one reason.

I am no expert in LVM and Google is my friend when playing with it.


If changing drives around while upgrading, then finding that you have to
mount the old drive, you now have issues as the UUID for the drive is
recognized as part of the "OLD" volume group. I couldn't use any of the
recovery techniques that I could find on the WEB.

I ran into this late last year when I removed the 130Gig drives and
replaced them with 500Gig drives. When I needed to mount the old drives
to recover some data that I forgot to backup (slap my wrists for being
in a rush and stupid) before the change. I couldn't use any of the LVM
recovery techniques as LVM constantly wanted to remount the drive as
part of the LVM group it came from.

I fought for weeks on this and finally gave up and used normal forensic
tools to recover from an image of the drive.

I don't remember all the details and my notes are not with me but any
aspect of a LVM should be configurable to ensure that the drive can be
mounted outside it's group without causing headaches. I may be
associating a different UUID ( I wish they had different designators)
than this thread but I think it could be the same issue.
--
Robin Laing
Alasdair G Kergon
2008-03-16 23:38:11 UTC
Permalink
Post by Robin Laing
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
If changing drives around while upgrading, then finding that you have to
mount the old drive, you now have issues as the UUID for the drive is
recognized as part of the "OLD" volume group.
The ability to change lv uuid is not relevant here.
pvchange, vgchange, vgrename should suffice.

Alasdair
--
agk at redhat.com
Alasdair G Kergon
2008-03-16 23:38:11 UTC
Permalink
Post by Robin Laing
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
If changing drives around while upgrading, then finding that you have to
mount the old drive, you now have issues as the UUID for the drive is
recognized as part of the "OLD" volume group.
The ability to change lv uuid is not relevant here.
pvchange, vgchange, vgrename should suffice.

Alasdair
--
agk at redhat.com
Timothy Selivanow
2008-03-13 15:32:52 UTC
Permalink
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
Alasdair
Instead of installing a new guest in Xen everytime, I have one default
image that is a bare install, kept up-to-date. When I want to provision
a new VM, I simply copy the disk image (file at the moment, evaluating
using a LV as a block device instead of tap:aio) then do a losetup,
kpartx, and change UUIDs of everything, mount the LVMs and ext3 boot
partition to change the hostname, IP, etc. of the system. When that is
done, I just do a `xm create new-system` after I've setup the config
file in /etc/xen and I have a system that is up-to-date and ready to be
used for what-ever purposes that have been determined (I've also thought
about installing new software while I'm chroot'd in the new guest
image).


--Tim
______________________________________________________
/ It is sweet to let the mind unbend on occasion. \
\ -- Quintus Horatius Flaccus (Horace) /
------------------------------------------------------
\
\ \
\ /\
( )
.( o ).
Robin Laing
2008-03-12 15:27:14 UTC
Permalink
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
Alasdair
I can think of data recovery as one reason.

I am no expert in LVM and Google is my friend when playing with it.


If changing drives around while upgrading, then finding that you have to
mount the old drive, you now have issues as the UUID for the drive is
recognized as part of the "OLD" volume group. I couldn't use any of the
recovery techniques that I could find on the WEB.

I ran into this late last year when I removed the 130Gig drives and
replaced them with 500Gig drives. When I needed to mount the old drives
to recover some data that I forgot to backup (slap my wrists for being
in a rush and stupid) before the change. I couldn't use any of the LVM
recovery techniques as LVM constantly wanted to remount the drive as
part of the LVM group it came from.

I fought for weeks on this and finally gave up and used normal forensic
tools to recover from an image of the drive.

I don't remember all the details and my notes are not with me but any
aspect of a LVM should be configurable to ensure that the drive can be
mounted outside it's group without causing headaches. I may be
associating a different UUID ( I wish they had different designators)
than this thread but I think it could be the same issue.
--
Robin Laing
Timothy Selivanow
2008-03-13 15:32:52 UTC
Permalink
Post by Alasdair G Kergon
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?
Alasdair
Instead of installing a new guest in Xen everytime, I have one default
image that is a bare install, kept up-to-date. When I want to provision
a new VM, I simply copy the disk image (file at the moment, evaluating
using a LV as a block device instead of tap:aio) then do a losetup,
kpartx, and change UUIDs of everything, mount the LVMs and ext3 boot
partition to change the hostname, IP, etc. of the system. When that is
done, I just do a `xm create new-system` after I've setup the config
file in /etc/xen and I have a system that is up-to-date and ready to be
used for what-ever purposes that have been determined (I've also thought
about installing new software while I'm chroot'd in the new guest
image).


--Tim
______________________________________________________
/ It is sweet to let the mind unbend on occasion. \
\ -- Quintus Horatius Flaccus (Horace) /
------------------------------------------------------
\
\ \
\ /\
( )
.( o ).
Timothy Selivanow
2008-03-04 18:23:24 UTC
Permalink
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option. Here is how I've been changing the others
(note that "--uuid" does not appear in the man pages for pvchange and
vgchange for lvm2-2.02.26-3.el5):

pvchange --uuid {pv dev}
vgchange --uuid {vg name}


Any suggestions? I'm pretty much open to any arcane/convoluted
procedure, but I refrain from copying the data to a temp place so I can
re-create the LV as that would add too much work and would kinda defeat
what I'm doing. Thanks!


--Tim
_________________________________________________________
/ Obviously I was either onto something, or on something. \
\ -- Larry Wall on the creation of Perl /
---------------------------------------------------------
\
\ \
\ /\
( )
.( o ).
Alasdair G Kergon
2008-03-12 13:28:47 UTC
Permalink
Post by Timothy Selivanow
I know how to change the UUID of Physical Volumes and Volume Groups, but
when I try to do the same for a Logical Volume, lvchange complains that
"--uuid" is not an option.
Nobody's yet made a case for adding that feature.
Why do you want it?

Alasdair
--
agk at redhat.com
Loading...