Public bug reported:

Binary package hint: lvm2

Ubuntu Version:
Ubuntu 10.04.1 LTS (however this also effects 10.10 With latest updates as well)

LVM2 version:
lvm2:
  Installed: 2.02.54-1ubuntu4.1
  Candidate: 2.02.54-1ubuntu4.1
  Version table:
 *** 2.02.54-1ubuntu4.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
        500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages
        100 /var/lib/dpkg/status
     2.02.54-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages


vgimportclone is suppose to import and rename a duplicated volume group on the 
specified PV device.  However, every volumegroup except for the specified PV is 
modified and you still end up with duplicate VG uuid's and names.

I am using xen with the VM running in PV mode for my testing however
anything that supports the ability to make a clone of a volume will
work.

1.) Create a new disk for the VM
2.) Partition the disk: fdisk /dev/xvdb 
 type:  n <enter> p <enter> 1 <enter> <enter> <enter> t <enter> 8e <enter> w 
<enter>
3.) Create a PV on the new partition: pvcreate /dev/xvdb1
4.) Create a Volume Group: vgcreate myvol /dev/xvdb1
5.) Create a Logical Volume on the volume group: lvcreate -L 9G myvol -n vol0
6.) Format the new disk with ext3: mke2fs -j /dev/myvol/vol0
7.) Detach the disk from the vm and copy the virtual disk file
8.) Reattach the disk to the VM
9.) Attach the copy of the virtual disk file to the VM as well

At this point you should have two identical copies of the same volume and a 
pvscan should report that /dev/xvdc1 and /dev/xvdb1 have a duplicate PV:
# pvscan 
Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  PV /dev/xvdc1   VG myvol         lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvda5   VG localhost   lvm2 [39.53 GiB / 0    free]
  Total: 2 [49.53 GiB] / in use: 2 [49.53 GiB] / in no VG: 0 [0   ]

10.) run vgimportclone which is suppose to rename and re-signature the VG and 
PV on the specified PV: vgimportclone /dev/xvdc1
output from command is below:
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  Volume group "myvol" successfully changed
  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  Volume group "myvol" successfully renamed to "myvol1"
Volume Group /dev/xvdc1, exported, skipping.
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  Volume group "localhost" successfully changed
  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  Volume group "localhost1" successfully renamed to "localhost1"
Volume Group /dev/xvda5, exported, skipping.
  Reading all physical volumes.  This may take a while...
  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  Found volume group "myvol1" using metadata type lvm2
  Found volume group "localhost1" using metadata type lvm2

Actual result:
The original volume and cloned volume still have the same PV UUID and and while 
it did change the VG name it changed it on *both* VG's.  In addition it also 
renames the VG that the root filesystem  is on which results in a machine that 
is not longer bootable unless fixed. A pvscan after the vgimportclone will show:

  Found duplicate PV eUd4WtLf5v552pWUsT1Wi37gTRs9NSUS: using /dev/xvdc1 not 
/dev/xvdb1
  PV /dev/xvdc1   VG myvol1        lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvda5   VG localhost1   lvm2 [39.53 GiB / 0    free]
  Total: 2 [49.53 GiB] / in use: 2 [49.53 GiB] / in no VG: 0 [0   ]

Expected Result:
The cloned volume (/dev/xvdc1) has its uuid changed for both the PV and VG and 
the VG is renamed to myvol1.  No other Volume Groups are change and a pvscan 
shows:
  PV /dev/xvdc1   VG myvol1     lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvdb1   VG myvol      lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvda2   VG localhost   lvm2 [39.50 GiB / 0    free]
  Total: 3 [59.49 GiB] / in use: 3 [59.49 GiB] / in no VG: 0 [0   ]

In testing running this same procedure against a CentOS 5.5 and Fedora14 vm 
gives the expected results. Output from the commands ran against a fedora 14 VM:
# pvscan
  Found duplicate PV eQR7dX6WLFW4cn5eWBYHYd5i1Xf1Ri89: using /dev/xvdc1 not 
/dev/xvdb1
  PV /dev/xvdc1   VG myvol      lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvda2   VG VolGroup   lvm2 [39.50 GiB / 0    free]
  Total: 2 [49.50 GiB] / in use: 2 [49.50 GiB] / in no VG: 0 [0   ]

# vgimportclone /dev/xvdc1 
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Physical volume "/tmp/snap.ECGQVQW0/vgimport0" changed
  1 physical volume changed / 0 physical volumes not changed
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Volume group "myvol" successfully changed
  Volume group "myvol" successfully renamed to "myvol1"
  Reading all physical volumes.  This may take a while...
  Found volume group "myvol1" using metadata type lvm2
  Found volume group "myvol" using metadata type lvm2
  Found volume group "VolGroup" using metadata type lvm2

# pvscan
  PV /dev/xvdc1   VG myvol1     lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvdb1   VG myvol      lvm2 [10.00 GiB / 1020.00 MiB free]
  PV /dev/xvda2   VG VolGroup   lvm2 [39.50 GiB / 0    free]
  Total: 3 [59.49 GiB] / in use: 3 [59.49 GiB] / in no VG: 0 [0   ]

and a vgdisplay confirms that vgimportclone works as expected:

# vgdisplay 
  --- Volume group ---
  VG Name               myvol1
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               10.00 GiB
  PE Size               4.00 MiB
  Total PE              2559
  Alloc PE / Size       2304 / 9.00 GiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               pafrn7-OQjU-T062-T2h7-03Wm-4FYj-IwWy2q
   
  --- Volume group ---
  VG Name               myvol
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               10.00 GiB
  PE Size               4.00 MiB
  Total PE              2559
  Alloc PE / Size       2304 / 9.00 GiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               EkmKKh-VGkn-JWes-KGkH-9nh6-ncWC-RaFnV4

  --- Volume group ---
  VG Name               VolGroup
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               39.50 GiB
  PE Size               32.00 MiB
  Total PE              1264
  Alloc PE / Size       1264 / 39.50 GiB
  Free  PE / Size       0 / 0   
  VG UUID               J4ZVmb-rTab-OycL-k2Oe-3pun-4s5j-jk1saA

** Affects: lvm2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/695759

Title:
  vgimportclone doesn't work

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to