Bug 209927 - Creating a LVM snapshot destroys volume group metadata
Creating a LVM snapshot destroys volume group metadata
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2 (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Alasdair Kergon
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2006-10-08 08:56 EDT by Tomas Edwardsson
Modified: 2008-07-24 16:07 EDT (History)
4 users (show)

See Also:
Fixed In Version: RHBA-2008-0776
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-07-24 16:07:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tomas Edwardsson 2006-10-08 08:56:08 EDT
Description of problem:
When create a LVM snapshot of a volume group with metadata version 1 on RHEL4
the volume group becomes unusable. Nothing short of a vgcfgrestore fixes the

Version-Release number of selected component (if applicable):

Steps to Reproduce:
1.lvcreate  -L 32G -s -n snap /dev/vg01/lvol1 (on a metadata ver 1 vg/lv)
Comment 1 Petr Rockai 2006-11-09 10:40:39 EST
Reproduced, will see what can be done about it.
Comment 3 Suzanne Yeghiayan 2007-09-17 16:04:27 EDT
This request was previously evaluated by Red Hat Product Management
for inclusion in the current Red Hat Enterprise Linux release, but
Red Hat was unable to resolve it in time.  This request will be
reviewed for a future Red Hat Enterprise Linux release.
Comment 4 Petr Rockai 2008-04-21 11:40:05 EDT
Since LVM1 metadata can be converted to LVM2 easily *and* this is about 
creating new snapshots on LVM1 volume groups, I would propose a simple measure 
of disallowing such action. The tools somehow manage to corrupt the LVM1 
metadata in nontrivial way, and I suppose it is not worth the debugging 
trouble. LVM1 metadata is definitely deprecated and the only viable usecase is 
maintaining a system compatible with RHEL3, which together with necessity to 
create new snapshots is niche at best.

The patch for such a solution should be straightforward. I'm adding that to my 
TODO and will propose such a patch shortly.
Comment 5 Alasdair Kergon 2008-04-21 14:14:43 EDT
I've just tried this:

    Invalid LV in extent map (PV /var/tmp/test2, PE 1, LV 1, LE 0)
    Couldn't fill logical volume maps.

Let's at least understand why it goes wrong to make sure there's nothing more
fundamental we need to fix.
Comment 6 Alasdair Kergon 2008-04-22 07:31:49 EDT
Indeed there is an underlying bug here: the internal variable vg->lv_count is
not maintained consistently throughout the code, leading to this bug.
Comment 7 Alasdair Kergon 2008-04-22 07:50:33 EDT
One line fix in 2.02.36, to remember to include snapshots when writing the
number of LVs in the VG into the on-disk metadata.
Comment 9 Alasdair Kergon 2008-04-22 09:09:16 EDT
Also fixed related problem of lvremove also getting the number of LVs wrong.
Comment 12 Alasdair Kergon 2008-06-19 19:03:50 EDT
To clarify - this is a bug affecting the manipulation of metadata stored on-disk
in the old format used by LVM1.  It should not affect data stored within any LVs.  

Metadata stored on-disk using the default LVM2 format is unaffected.
Comment 13 Alasdair Kergon 2008-06-19 19:08:01 EDT
To see which format you are using, run:
  vgs -o +vg_fmt
Comment 14 Corey Marthaler 2008-06-27 17:29:54 EDT
Fix verified in lvm2-2.02.37-3.el4.

[root@taft-03 ~]# vgs -o +vg_fmt
  VG         #PV #LV #SN Attr   VSize   VFree   Fmt
  VolGroup00   1   2   0 wz--n-  68.12G  32.00M lvm2
  taft         3   0   0 wz--n- 406.98G 406.98G lvm1
[root@taft-03 ~]# lvcreate -L 1G -n origin taft
  Logical volume "origin" created
[root@taft-03 ~]# lvcreate -s taft/origin -L 100M -n snap
  Logical volume "snap" created
[root@taft-03 ~]# lvs -a -o +devices
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices
  LogVol00 VolGroup00 -wi-ao  58.34G                                      
  LogVol01 VolGroup00 -wi-ao   9.75G                                      
  origin   taft       own-a-   1.00G                                      
  snap     taft       swn-a- 100.00M origin   0.01                        
Comment 16 errata-xmlrpc 2008-07-24 16:07:13 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.