Linux WARNING: Duplicate VG name server1 LVM2 Error and Solution

by on May 5, 2013 · 1 comment· LAST UPDATED May 5, 2013

in , ,

I recently added SSD to my home server and reloaded the operating system. However, when I try to access my dm-crypt based old disk, I am getting the following error:

Reading all physical volumes. This may take a while...
WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
Found volume group "server01" using metadata type lvm2
Found volume group "server01" using metadata type lvm2

Tutorial details
DifficultyAdvanced (rss)
Root privilegesYes
RequirementsLVM2+dm-crypt
Estimated completion timeN/A

The problem is my volume group. I set to to server01 on both old and new hard disk. How can I rename old LVM2? How do I access my old hard disk?

dm-crypt is a transparent disk encryption subsystem in Linux kernel v2.6+ and later. It can encrypt whole disks, removable media, partitions, software RAID volumes, logical volumes, and files.

Solution

Use the cryptsetup command to open device, enter:
# cryptsetup luksOpen /dev/sdXY your-name-here
You need to run the vgdisplay command to get exact information about your LVM2 volume group. Type the following command as root user:
# vgdisplay
Sample outputs:

  WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  WARNING: Duplicate VG name server01: Existing RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87 (created here) takes precedence over bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc
  --- Volume group ---
  VG Name               server01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               465.52 GiB
  PE Size               4.00 MiB
  Total PE              119173
  Alloc PE / Size       119173 / 465.52 GiB
  Free  PE / Size       0 / 0
  VG UUID               RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  --- Volume group ---
  VG Name               server01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               476.70 GiB
  PE Size               4.00 MiB
  Total PE              122034
  Alloc PE / Size       122034 / 476.70 GiB
  Free  PE / Size       0 / 0
  VG UUID               bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc

Note down VG UUID for the old LVM2 volume and use the following comamnd to rename the same. The syntax is:

 
vgrename VG-UUID-HERE new-name-here
 

In this example, rename volume with UUID RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87 to oldharddisk, type:
# vgrename RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87 oldharddisk
Sample outputs:

  WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  WARNING: Duplicate VG name server01: Existing bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc (created here) takes precedence over RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87
  WARNING: Duplicate VG name server01: Existing RIKiar-w3MG-Gzh5-VFWq-bkRT-9IFc-ia8k87 (created here) takes precedence over bc7YA8-eEXt-1aA1-OHTr-zJkA-ucd0-DsbRTc
  Volume group "server01" successfully renamed to "oldharddisk"

You need to scan all disks for volume groups and rebuild caches:
# vgscan --mknodes
Sample outputs:

  Reading all physical volumes.  This may take a while...
  Found volume group "oldharddisk" using metadata type lvm2
  Found volume group "server01" using metadata type lvm2

Next, activate all known volume groups in the system, type:
# vgchange -ay
Sample outputs:

  2 logical volume(s) in volume group "oldharddisk" now active
  3 logical volume(s) in volume group "server01" now active

To see a mapping name use the following command:
# ls -l /dev/mapper/oldharddisk-*
Sample outputs:

lrwxrwxrwx 1 root root 7 May  5 16:56 /dev/mapper/oldharddisk-root -> ../dm-5
lrwxrwxrwx 1 root root 7 May  5 16:56 /dev/mapper/oldharddisk-swap_1 -> ../dm-6

To mount /dev/mapper/oldharddisk-root, enter:
# mkdir -p /mnt/oldharddisk
# mount /dev/mapper/oldharddisk-root /mnt/oldharddisk
# df -H

Now you can copy or restore data from old hard disk mounted at /mnt/oldharddisk:
# cd /mnt/oldharddisk
# rsync -avrP home/* /home/

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Gabriel May 16, 2013 at 10:37 am

You can rename the VG to avoid the conflcts

vgrename old_vg_name new_vg_name ( renames the VG to another name )

or you can try with the device VG full path names instead vg names

vgrename /dev/mapper/old_vg_name /dev/mapper/new_vg_name

Usually the vg device should be under /dev/mapper… but could also be found under /dev/vgname

Reply

Leave a Comment

Tagged as: , , , ,

Previous Faq:

Next Faq: