• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

“WARNING: Duplicate VG name [vgname]” – error while running LVM commands

by admin

The Problem

LVM commands report Duplicate VG names. When vgdisplay is run to check for free space the following message is received:

# vgdisplay 
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU

The Root Cause

Below are a few of the changes which can cause this issue:

1. Some changes have been made with the LVM configuration like adding a new LUN from SAN which was previously being used as LVM on another decommissioned system and has been added to the new system without proper cleaning from SAN side and has previous metadata.

2. A new VG was created using the same name which already exists on the system.

The “WARNING: Duplicate VG name” messages from LVM commands are an indication that multiple independent volume groups were discovered with the same name during scanning. This problem is not an indication of an improper filter and is not a result of using multipath. The warning message here specifically indicates that two volume groups exist with different UUIDs but the same name. Since LVM is unable to activate two volume groups with the same name, it chooses one (starting with the one which has creation_host matching the local hostname) and activates it.

Note: For information on a similar issue where a cloned storage device results in a duplicate VG with the same UUID, we need to follow the below steps and is different procedure.

vgimportclone [-n|--basevgname VolumeGroupName] [-i|--import] PhysicalVolume [PhysicalVolume...]

For example:

# vgimportclone --basevgname test_vg_snap /dev/loop2 /dev/loop3

This post is only specific to situations in which the duplicate VG contains a different UUID (i.e., is not a clone).

Diagnostic Steps

In these situations, usually, you will need to determine which device and/or UUID corresponds to the “original” volume group, and which corresponds to the “duplicate” volume group. You can not simply use vgdisplay or lvs to get information about each volume group, because they will be unable to determine which volume group you are requesting, and will just choose one of them to operate on. For example, to see the logical volumes in both test volume groups, it is not possible to just use lvs:

# lvs testvg2
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
test_lv testvg2 -wi--- 2.00G

It only displays the LVs in the VG it chooses.

In order to display information about each individual volume group, we can use a filter on the command line. First, we must determine which devices are in each volume group:

# pvs
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
PV VG Fmt Attr PSize PFree 
/dev/xvda2 VolGroup00 lvm2 a- 14.88G 0 
/dev/xvdb VolGroup00 lvm2 a- 9.97G 4.97G
/dev/xvdc testvg1 lvm2 a- 5.00G 1020.00M
/dev/xvdd testvg2 lvm2 a- 5.00G 3.00G
/dev/xvde testvg2 lvm2 a- 5.00G 3.00G

We now know that xvdd and xvde host the two different testvg2 VGs. Let us take a look at each logical volumes to help us determine:

# lvs testvg2 --config 'devices { filter = [ "a|/dev/xvdd|", "r|.*|" ]}'
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
test_lv testvg2 -wi--- 2.00G
# lvs testvg2 --config 'devices { filter = [ "a|/dev/xvde|", "r|.*|" ]}'
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
test_lv testvg2 -wi-a- 2.00G

Once we know which of the duplicate VGs we would like to focus on, we can find the UUID for that VG:

# vgs -o +vg_uuid --config 'devices { filter = [ "a|/dev/xvde|", "r|.*|" ]}'
VG #PV #LV #SN Attr VSize VFree VG UUID 
testvg2 1 1 0 wz--n- 5.00G 3.00G q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU

Now we can use this UUID in the steps in the below Solution section.

The Solution

NOTE: It is always advised to take a complete backup of the filesystems for all PVs, VGs and LVs before implementing this process.

The proper solution to this problem depends on the reason for the duplicate being presented. Read the Root Cause and Diagnostic Steps sections above for more information.

If the device containing the duplicate VG name was accidentally presented to this host (i.e., improper zoning), then simply unpresent it from the host. Once it is gone, the duplicate volume group problem will no longer be seen.

If a device was presented to the host that had a duplicate VG name to a volume already on this host, then the duplicate one will need to be renamed so as to not conflict. The renaming can be done using the UUID:

1. Determine the UUID for the volume group that you want to rename:

# vgs -o +vg_uuid
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU (created here) takes precedence over OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU (created here) takes precedence over OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5
VG #PV #LV #SN Attr VSize VFree VG UUID 
VolGroup00 2 2 0 wz--n- 24.84G 4.97G KtK3ij-lkQH-tbB3-s74h-FYBl-73cu-jg86EX
testvg1 1 1 0 wz--n- 5.00G 1020.00M oME1Wk-ftRi-qhQq-wQ6Z-eUo3-SNZw-chUfAx
testvg2 1 1 0 wz--n- 5.00G 3.00G q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
testvg2 1 1 0 wz--n- 5.00G 3.00G OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5
Note: For additional steps to help determine which UUID to operate on, see the Diagnostic Steps above below.

2. Once you have the UUID you can then rename the Volume Group using vgrename:

# vgrename q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU testvg
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5 (created here) takes precedence over q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
WARNING: Duplicate VG name testvg2: Existing q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU (created here) takes precedence over OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5
Volume group "testvg2" successfully renamed to "testvg"

3. Activate the new Volume Group.

# vgchange -ay testvg
1 logical volume(s) in volume group "testvg" now active

4. Verify the Volume Group.

# vgs -o +vg_uuid
VG #PV #LV #SN Attr VSize VFree VG UUID 
VolGroup00 2 2 0 wz--n- 24.84G 4.97G KtK3ij-lkQH-tbB3-s74h-FYBl-73cu-jg86EX
testvg 1 1 0 wz--n- 5.00G 3.00G q7jsuu-f3f8-mVVu-HpMm-FXdK-Xe3Y-d2nVfU
testvg1 1 1 0 wz--n- 5.00G 1020.00M oME1Wk-ftRi-qhQq-wQ6Z-eUo3-SNZw-chUfAx
testvg2 1 1 0 wz--n- 5.00G 3.00G OEsLyZ-ueap-D66F-6LEB-BKqC-A5B1-exlfZ5

Filed Under: CentOS/RHEL 5, CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. “iscsiadm” Discovery TimeOut With Two Or More Network Interfaces in CentOS/RHEL
  2. TCP Wrapper (hosts.allow & hosts.deny) Command Options in Linux
  3. Beginners Guide to MySQL User Management
  4. lslogins Command Examples in Linux
  5. sar: command not found
  6. chfn: command not found
  7. lsusb Command Examples in Linux
  8. pgrep: command not found
  9. How to convert text files to all upper or lower case
  10. gdebi: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright