Importing and Renaming Cloned Volume Groups (LVM)

This guide outlines the process for mounting an external or snapshotted disk that contains an LVM Volume Group (VG) with the same name or UUID as an existing one.

1. Identify the External Physical Volume

Before importing, you need to confirm which device contains the LVM metadata. Use pvscan to list all detected physical volumes.

Bash

sudo pvscan

Look for the device path (e.g., /dev/sdb1) associated with the "extra" Volume Group.


2. Import and Rename the Volume Group

When you clone a disk, the VG name and UUID are identical to the source. vgimportclone fixes this by changing the UUIDs and allowing you to assign a new name automatically (usually by adding a suffix).

Bash

sudo vgimportclone /dev/sdb1

[!NOTE]

By default, this command often renames the VG to [original_name]-repaired or adds a numerical suffix to avoid conflicts with your boot drive.


3. Rescan and Activate the VG

Once the import is complete, you need to tell the LVM system to refresh its cache and bring the "new" Volume Group online.

Rescan Metadata

Bash

sudo vgscan

Activate the Volume Group

Change the status to "available" (-ay) so the system can access the logical volumes inside.

Bash

sudo vgchange -ay

4. Verify and Mount

Now that the VG is active and uniquely named, you can identify the specific Logical Volume (LV) you wish to mount.

List Logical Volumes

Bash

sudo lvs

Check the VG column to ensure you are selecting the volume from the newly imported group (e.g., ubuntu-vg1 instead of ubuntu-vg).

Mount to a Directory

Create a mount point and attach the volume.

Bash

sudo mkdir -p /mnt/external_data
sudo mount /dev/mapper/ubuntu--vg1-root /mnt/external_data

Summary Checklist

Step

Command

Purpose

Find

sudo pvscan

Locate the disk partition.

Rename

sudo vgimportclone [device]

Solve UUID/Name conflicts.

Refresh

sudo vgscan

Re-index LVM metadata.

Enable

sudo vgchange -ay

Make volumes accessible.

Mount

sudo mount [path] [target]

Access the actual files.

Updated on