I have some virtual machines which were clones of the same original disk image, which contained some LVM volumes. When I clone these, I end up with multiple LVM volumes (albeit on different hosts) which have the same 'unique' ID. Is there any way I can get LVM to change the UUID of an existing volume?
Asked
Active
Viewed 2.1k times
3 Answers
10
pvchange --uuid /physical/volume/path
vgchange --uuid /volume/group/name

quanta
- 51,413
- 19
- 159
- 217
-
you can't vgchange --uuid on a vg with active logical volumes. – Ben Lutgens Aug 02 '16 at 15:00
-
4`vgimportclone /physical/volume/path` helped me, at least a bit. – Ned64 May 21 '17 at 18:19
-
@Ned64 this should be the accepted answer ! works for me. – LiMar Mar 11 '20 at 15:34
-
@LiMar OK, thanks for the feedback, I wrote an answer. Feel free to vote for it :-) – Ned64 Mar 11 '20 at 16:57
6
According to its man page, the command vgimportclone
will do the work for you:
vgimportclone /physical/volume/path
This is used for importing a volume group (VG) from a cloned physical volume (PV), e.g. after a snapshot or other duplicated PV.

Ned64
- 303
- 1
- 3
- 12
1
pvchange
was not working for me, it kept avoiding the volume with
WARNING: Not using device /dev/sdc for PV C0s0Wg-HcnQ-LOP3-QwmR-dhSX-4wW1-hRhxm3. WARNING: PV C0s0Wg-HcnQ-LOP3-QwmR-dhSX-4wW1-hRhxm3 prefers device /dev/sdb because device is used by LV. Device /dev/sdc excluded by a filter.
Ultimately, wipefs /dev/sdc
was the solution, after which I simply used
pvcreate /dev/sdc

mkaama
- 191
- 1
- 5