Learn how to import VG with a different name. Useful when the system has the same name VG already existing and you are trying to import VG there.
In this tutorial, we will walk you through the process to import VG with a different name. During migrations, data movement activities, etc you may face issues in the VG import process. Sometimes you have disks with VGs exported on them & the same VG name is exiting on the server where you try to import VG from those disks.
In such cases, where you try to import VG when same VG name already existing in the system you get below error :
# vgimport vg02 /dev/xvdg Multiple VGs found with the same name: skipping vg01 Use --select vg_uuid=<uuid> in place of the VG name.
Now, you have two choices to import VG in such case.
- Import using VG UUID while keeping VG name the same. In this case, you will have 2 VG on the system with the same name and administer them & mounting LVs in them is havoc
vgimportclonecommand and import VG using a different name.
Import VG using the same name with UUID
If you took the VG map file while exporting VG then you can get VG UUID from it or you must have noted it down from vgdisplay output as well. This process also answers for how to import VG with the duplicate names!
# vgimport --select vg_uuid=kzwQmc-qIzF-IZcv-9eW8-ToA1-mkDV-fLari2 Volume group "vg02" successfully imported
Now you see
vg02 is imported. But we already had VG named
vg02 in our system. So, now we have two VGs with the same name in our system.
# vgdisplay --- Volume group --- VG Name vg02 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 2 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 1020.00 MiB PE Size 4.00 MiB Total PE 255 Alloc PE / Size 0 / 0 Free PE / Size 255 / 1020.00 MiB VG UUID aRmosT-KZCY-5k40-DGSK-3WGd-ZwWD-eEXXgk --- Volume group --- VG Name vg02 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 5 VG Access read/write VG Status exported/resizable MAX LV 0 Cur LV 1 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size <5.00 GiB PE Size 4.00 MiB Total PE 1279 Alloc PE / Size 25 / 100.00 MiB Free PE / Size 1254 / <4.90 GiB VG UUID kzwQmc-qIzF-IZcv-9eW8-ToA1-mkDV-fLari2
Now the real challenge is to mount LV within them. You can do that but to ease out your pain, you can simply rename newly imported VG to some different name. You should use VG UUID again in
# vgrename kzwQmc-qIzF-IZcv-9eW8-ToA1-mkDV-fLari2 vg03 Processing VG vg02 because of matching UUID kzwQmc-qIzF-IZcv-9eW8-ToA1-mkDV-fLari2 Volume group "kzwQmc-qIzF-IZcv-9eW8-ToA1-mkDV-fLari2" successfully renamed to "vg03"
Once you renamed newly imported VG, your existing and new VG has different names as well. Now, you will be able to mount LVs within them without much hassle.
Hence its recommended in such a scenario you must import VG with a different name.
Import VG with the different name using vgimportclone command
vgimportclone command should be supplied with a new name with which you want VG to be imported with switch
-n followed by disk name on which you exported VG
# vgimportclone -n vg01 /dev/xvdg VG vg02 is exported, use the --import option.
So, the command here detected that VG was exported and asks us to confirm import operation with
--import switch. Let’s do that –
# vgimportclone --import -n vg01 /dev/xvdg
And command ran successfully. It won’t print any message on the terminal. You can verify that new VG on the system using
If you are looking for answers for how to change VG name during import? or how to import VG with a new name? then
vgimportclone is the answer!
That’s it. You successfully imported VG with a different name. Since existing VG and your imported VG has different names now you won’t face any hurdles in mounting LVs from both of them.