• We have solutions from A - Z

Linux LVM2 : How to rename a duplicate VG volume

150 150 rdwild

I have had a few cases where I had to take an old Linux system drive with data on it and move data over to a new system drive. In this case, it was when one of my Ubuntu systems stopped working and would not even boot (it froze during boot up and I could not get any info out of it). At the time I prepped a new Ubuntu system drive and booted up with it and then installed the old drive so I could get data off of it. The problem at the time was that I could not mount the volume due to the fact that it was an LVM volume with the same volume group name at the new system drive so it would not mount. This problem is actually two problems in one. The first one is obvious in that we have two volumes with the same volume name. The second is that it does not show the relationship between the device name and the lvm volume.

If you do an “fdisk – l” it gives you the disk identifier but no volume group names

Disk /dev/sdb: 837.75 GiB, 899527213056 bytes, 1756889088 sectors
Disk model: PERC H710
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A4AC923B-B4F9-444F-BC48-86591E1A0302

Device Start End Sectors Size Type
/dev/sdb1 2048 2203647 2201600 1G EFI System
/dev/sdb2 2203648 6397951 4194304 2G Linux filesystem
/dev/sdb3 6397952 1756887039 1750489088 834.7G Linux filesystem


Disk /dev/sdc: 837.75 GiB, 899527213056 bytes, 1756889088 sectors
Disk model: PERC H710
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4EDFCB23-DE1E-41F2-B3DF-6207AD3C0B94

If you do a “lsblk” you get the device device and volume group name but no vg uuid

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 9.1T 0 disk
└─sda1 8:1 0 9.1T 0 part
sdb 8:16 0 837.8G 0 disk
├─sdb1 8:17 0 1G 0 part /boot/efi
├─sdb2 8:18 0 2G 0 part /boot
└─sdb3 8:19 0 834.7G 0 part
└─ubuntu–vg–1-ubuntu–lv 253:1 0 834.7G 0 lvm /
sdc 8:32 0 837.8G 0 disk
├─sdc1 8:33 0 1G 0 part
├─sdc2 8:34 0 2G 0 part
└─sdc3 8:35 0 834.7G 0 part
sr0 11:0 1 1024M 0 rom
nvme0n1 259:1 0 1.5T 0 disk
├─nvme0n1p1 259:2 0 1G 0 part
├─nvme0n1p2 259:3 0 2G 0 part
└─nvme0n1p3 259:4 0 1.5T 0 part
└─ubuntu–vg-ubuntu–lv 253:0 0 1.5T 0 lvm

If you do a “sudo vgdisplay” you get the following …. two VGs with the same name andit does give you the UUIDs but no device name.

WARNING: VG name ubuntu-vg-1 is used by VGs 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh and VkCMJn-0IyH-DPjA-4hdZ-GqOl-eNkj-4Plf12.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
— Volume group —
VG Name ubuntu-vg-1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <834.70 GiB
PE Size 4.00 MiB
Total PE 213682
Alloc PE / Size 213682 / <834.70 GiB
Free PE / Size 0 / 0
VG UUID 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh

— Volume group —
VG Name ubuntu-vg-1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <834.70 GiB
PE Size 4.00 MiB
Total PE 213682
Alloc PE / Size 213682 / <834.70 GiB
Free PE / Size 0 / 0
VG UUID VkCMJn-0IyH-DPjA-4hdZ-GqOl-eNkj-4Plf12

If you use the vgs with some additional parameters “sudo vgs -o vg_name,vg_uuid,pv_uuid” it will give you the VG UUID and the physical ID

WARNING: VG name ubuntu-vg-1 is used by VGs 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh and VkCMJn-0IyH-DPjA-4hdZ-GqOl-eNkj-4Plf12.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
VG VG UUID PV UUID
ubuntu-vg-1 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh QTTC9X-p0Yn-70o3-rVg0-KvK0-dyUx-yel5Ti
ubuntu-vg-1 VkCMJn-0IyH-DPjA-4hdZ-GqOl-eNkj-4Plf12 bI07eL-EHoI-iAnr-AoVg-jWfm-GaON-eSiyd8

You can now type the following command “sudo pvdisplay” to get a list of PV UUID and their physical drives.

WARNING: VG name ubuntu-vg-1 is used by VGs 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh and VkCMJn-0IyH-DPjA-4hdZ-GqOl-eNkj-4Plf12.
Fix duplicate VG names with vgrename uuid, a device filter, or system IDs.
— Physical volume —
PV Name /dev/sdc3
VG Name ubuntu-vg-1
PV Size <834.70 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 213682
Free PE 0
Allocated PE 213682
PV UUID QTTC9X-p0Yn-70o3-rVg0-KvK0-dyUx-yel5Ti

— Physical volume —
PV Name /dev/sdb3
VG Name ubuntu-vg-1
PV Size <834.70 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 213682
Free PE 0
Allocated PE 213682
PV UUID bI07eL-EHoI-iAnr-AoVg-jWfm-GaON-eSiyd8

If you look at the lsbk command above you will note that sdb3 is our new boot volume and sdc3 is our old drive that we need to rename and it has a pv uuid of QTTC9X-p0Yn-70o3-rVg0-KvK0-dyUx-yel5Ti

If we look up the pv uuid when we used the vsg command above we get the following VG UUID (0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh) that we can use to rename the duplicate volume group using vgrename to rename the volume group. vgrename (vg uuid) (name of the new volume group)

It would look like the following in our situation: vgrename 0FSzGi-emNx-ILEO-MjLt-2RAa-Sn40-mn2voh backup

At this point activate the changes via “vgchange -ay” and I would suggest you could reboot and then do an lvscan to pickup the new volume.

sudo lvscan
ACTIVE ‘/dev/backup/ubuntu-lv’ [<834.70 GiB] inherit
ACTIVE ‘/dev/ubuntu-vg-1/ubuntu-lv’ [<834.70 GiB] inherit

We are now going to mount the backup volume with the mount command.

sudo mount /dev/backup/ubuntu-lv /mnt/backup

Bob’s your uncle, we now have access to our backup os volume so we can get data off of it.

Leave a Reply

Your email address will not be published.

Privacy Preferences

When you visit our website, it may store information through your browser from specific services, usually in the form of cookies. Here you can change your Privacy preferences. It is worth noting that blocking some types of cookies may impact your experience on our website and the services we are able to offer.

Click to enable/disable Google Analytics tracking code.
Click to enable/disable Google Fonts.
Click to enable/disable Google Maps.
Click to enable/disable video embeds.
Our website uses cookies, mainly from 3rd party services. Define your Privacy Preferences and/or agree to our use of cookies.
L i v e C h a t
Live Chat
Call Now!