vgimportclone
Import cloned Volume Group without conflicts
SYNOPSIS
vgimportclone [-n] [-i|--import] -N NewVolumeGroupName VolumeGroupName
PARAMETERS
-n
Do not activate the Volume Group. By default, vgimportclone activates the Volume Group after successfully updating its metadata.
-i, --import
Import the VG and update lvm.conf to add the VG to the auto activation list. This helps activate the VG automatically at boot.
-N NewVolumeGroupName
Specify the new name for the imported Volume Group. This is mandatory.
VolumeGroupName
The name of the Volume Group to clone. This is the original VG name from which the metadata will be cloned.
DESCRIPTION
The vgimportclone command is used to import a Volume Group (VG) whose metadata has been copied (cloned) from another VG. This is particularly useful when you have shared disks or storage arrays that can be accessed by multiple systems. It enables you to create a consistent and independent copy of the VG's metadata on a new system without directly activating the original VG on both systems simultaneously, which could lead to data corruption. This is achieved by reading the VG metadata on the disk and creating a new, unique VG identifier (UUID) for the cloned VG. The command modifies the VG metadata on the shared disk to reflect the new UUID and ensures that the newly imported VG doesn't conflict with the original VG.
It is a crucial tool for disaster recovery, testing, or setting up parallel environments using shared storage. By creating a cloned VG, you can experiment with the data or restore it to a specific state without affecting the original production environment. However, it is important to use this tool with caution and understand the underlying LVM concepts to avoid data loss.
CAVEATS
It's extremely important to ensure that the original Volume Group is not active on the same system as the cloned Volume Group at the same time. Doing so can lead to severe data corruption. Only use on shared storage!
USE CASES
Disaster Recovery: Create a clone of a critical Volume Group for testing disaster recovery procedures.
Testing: Use a cloned Volume Group to test application upgrades or changes without affecting the production environment.
Data Migration: Prepare a Volume Group for migration to a new system without interrupting service on the original system.
WORKFLOW EXAMPLE
1. Ensure the original Volume Group is not active on the system where you intend to import the clone.
2. Use vgimportclone -N new_vg original_vg. Replace 'new_vg' with the desired name for the cloned Volume Group, and 'original_vg' with the name of the Volume Group to be cloned.
3. Optionally, use vgchange -ay new_vg to activate the newly cloned Volume Group.