LVM commands print "WARNING: Duplicate VG name <vgname>" in RHEL

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL)
    • lvm2

Issue

  • LVM commands report Duplicate VG names
  • When running vgdisplay command to check for free space, it shows:
# vgdisplay 
 WARNING: Duplicate VG name vg01: Existing dKW6b3-COaO-4NXA-IbeP-UWTq-RUW6-AHHTAD (created here) takes precedence over kQH1c3-I0ZR-xUff-a8zP-fXzH-xrqP-MtjYGJ  
  • After restarting the node, LVM commands show:
Cache: Duplicate VG name vg01: Prefer existing LLzmty-2aHl-Yhxu-Mh3x-Sim7-3cXg-OinYlK vs new Fgzl5z-urug-76S2-QJFe-P7v0-ctnG-2ndyND
  • If one of the VGs state is exported, LVM reports:
WARNING: Duplicate VG name vg01: Existing LLzmty-2aHl-Yhxu-Mh3x-Sim7-3cXg-OinYlK takes precedence over exported Fgzl5z-urug-76S2-QJFe-P7v0-ctnG-2ndyND

Resolution

The correct solution to this issue depends on the reason for the duplicate being presented. Read the Root Cause and Diagnostic Steps sections below for more information.

  • If the device containing the duplicate VG name was accidentally presented to this host (e.g. improper zoning), then simply unpresent it.
    • Once the devices have been fully removed, the duplicate volume group problem will no longer be seen.
  • If a device was intentionally presented, but duplicates a Volume Group name already on this host, then the duplicate must be renamed 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 test: Existing ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      WARNING: Duplicate VG name test: Existing ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      WARNING: Duplicate VG name test: Existing KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV (created here) takes precedence over ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo
      WARNING: Duplicate VG name test: Existing ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      WARNING: Duplicate VG name test: Existing KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV (created here) takes precedence over ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo
      VG         #PV #LV #SN Attr   VSize    VFree   VG UUID                               
      VolGroup00   2   2   0 wz--n-   24.84G      0  y8DddD-USO6-IyjO-KfMm-RMG3-6kil-epFesW
      test         1   2   1 wz--n- 1020.00M 908.00M KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      test         1   2   1 wz--n-  920.00M 652.00M ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo
    
    • Note: For additional steps to help determine which UUID to operate on, see the Diagnostic Steps section below.
  2. Once you have the UUID you can then rename the Volume Group using vgrename:

    # vgrename ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo test2
      WARNING: Duplicate VG name test: Existing ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      WARNING: Duplicate VG name test: Existing KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV (created here) takes precedence over ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo
      WARNING: Duplicate VG name test: Existing ScCmWm-mWkm-9qSf-TeWg-Bf8n-77uc-O2xNfo (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
      Volume group "test" successfully renamed to "test2"
    
  3. Activate the new Volume Group.

    # vgchange -ay test2
      2 logical volume(s) in volume group "test2" now active
    

Root Cause

  • 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.
    • As LVM is unable to activate two volume groups with the same name, it chooses one (starting with the one where creation_host matches the local hostname) and activates it.
  • Note:

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, we can't just use lvs:

# lvs test
  WARNING: Duplicate VG name test: Existing TFVZmC-p23N-u121-tmZJ-Z66F-dDPt-T9pkaw (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
  LV   VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv1  test -wi-a- 100.00M   

It only displays the LVs in the VG it chose.

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 test: Existing TFVZmC-p23N-u121-tmZJ-Z66F-dDPt-T9pkaw (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
  WARNING: Duplicate VG name test: Existing TFVZmC-p23N-u121-tmZJ-Z66F-dDPt-T9pkaw (created here) takes precedence over KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV
  PV                VG         Fmt  Attr PSize    PFree  
  /dev/hda2         VolGroup00 lvm2 a--     9.88G      0 
  /dev/mpath/mpath2 test       lvm2 a--   920.00M 820.00M
  /dev/mpath/mpath4 test       lvm2 a--  1020.00M 908.00M

We now know that mpath2 and mpath4 host the two different test VGs. Let's take a look at the logical volumes in each to help us determine which is which:

# lvs test --config 'devices { filter = [ "a|/dev/mapper/mpath2|", "r|.*|" ]}'
  LV   VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv1  test -wi-a- 100.00M        
# lvs test --config 'devices { filter = [ "a|/dev/mapper/mpath4|", "r|.*|" ]}'
  LV       VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  data1      test owi--- 100.00M                                      
  data1-snap test swi---  12.00M data1

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

# vgs -o +vg_uuid --config 'devices { filter = [ "a|/dev/mapper/mpath4|", "r|.*|" ]}'
  VG   #PV #LV #SN Attr   VSize    VFree   VG UUID                               
  test   1   2   1 wz--n- 1020.00M 908.00M KHRF8K-HTPc-LakE-Z8so-qpgw-cfIN-yLJXcV

Now we can use this UUID in the steps in the above Resolution section.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.