RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1479084 - vgcfgbackup does not save the PV metadata size originally specified by --metadatasize
Summary: vgcfgbackup does not save the PV metadata size originally specified by --meta...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-07 22:10 UTC by bugzilla
Modified: 2021-09-03 12:40 UTC (History)
11 users (show)

Fixed In Version: lvm2-2.02.175-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:20:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0853 0 None None None 2018-04-10 15:21:32 UTC

Description bugzilla 2017-08-07 22:10:13 UTC
Description of problem:

When restoring a VG onto PVs that were restored using "pvcreate --restorefile" and the original PVs were formatted using a larger metadata size than the default, vgcfgrestore gives the error "VG data metadata too large for circular buffer" when a larger metadata size is needed.

This is resolved by passing --metadatasize <orig_size> when calling "pvcreate --restorefile", however this is not intuitive and the error is not helpful in determining this.

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

lvm2-2.02.166-1.el7_3.3.x86_64

How reproducible:

Probably easy

Steps to Reproduce:
1. create a PV with larger than default metadata size: pvcreate --metadatasize 128MiB /dev/foo
2. create lots of LVs and exceed the default metadata size
3. vgcfgbackup VG
4. pvcreate -ff --uuid UUID --restorefile /etc/lvm/backup/VG /dev/foo
5. vgcfgrestore -f /etc/lvm/backup/VG

  VG data metadata too large for circular buffer
  Failed to write VG data.
  Restore failed.

Actual results:

VG is not restored.

Expected results:

VG should be restored.

Additional info:

vgcfgbackup should save the metadata size into the backup file and pvcreate should use that size when using --restorefile.

# This does not work:

[root@testsys archive]# pvcreate -ff --uuid KbTpgc-MzKT-e1dK-02Cw-yhgS-2JD6-3hKIj8 --restorefile data_01161-240815845.vg /dev/ssd/pv-tmeta
  Physical volume "/dev/ssd/pv-tmeta" successfully created.

[root@testsys archive]# pvcreate -ff --uuid 06kvOm-xN2Y-iX1y-Tt69-LfFh-ltkG-TtRsgy --restorefile data_01161-240815845.vg /dev/bcache0
  Physical volume "/dev/bcache0" successfully created.

[root@testsys archive]# vgcfgrestore -f data_01161-240815845.vg data --force
  VG data metadata too large for circular buffer
  Failed to write VG data.
  Restore failed.


# This works:

[root@testsys archive]# pvcreate -ff --uuid KbTpgc-MzKT-e1dK-02Cw-yhgS-2JD6-3hKIj8 --restorefile data_01161-240815845.vg /dev/ssd/pv-tmeta --metadatasize 128MiB
  Physical volume "/dev/ssd/pv-tmeta" successfully created.

[root@testsys archive]# pvcreate -ff --uuid 06kvOm-xN2Y-iX1y-Tt69-LfFh-ltkG-TtRsgy --restorefile data_01161-240815845.vg /dev/bcache0 --metadatasize 128MiB
  Physical volume "/dev/bcache0" successfully created.

[root@testsys archive]# vgcfgrestore -f data_01161-240815845.vg data --force
  Restored volume group data

Comment 2 Alasdair Kergon 2017-08-07 22:20:42 UTC
Please would you attach a (compressed?) copy of the actual backup file you're restoring from?

If there's anything you want to hide (like LV names) in it, please overtype those characters keeping the number of characters everywhere the same.  (eg 'hideme' -> 'lvol01')  (If the compressed file is too big, upload it somewhere and post a link.)

Comment 3 Alasdair Kergon 2017-08-08 16:46:12 UTC
I've reproduced something similar.

Comment 4 bugzilla 2017-08-08 17:08:49 UTC
(In reply to Alasdair Kergon from comment #3)
> I've reproduced something similar.

Does that mean you do not need the upload?

Comment 5 Alasdair Kergon 2017-08-08 17:11:43 UTC
       --restorefile file
              In  conjunction with --uuid, this extracts the location and size
              of the data on the PV from the file  (produced  by  vgcfgbackup)
              and  ensures that the metadata that the program produces is con-
              sistent with the contents of the file i.e. the physical  extents
              will  be  in the same place and not get overwritten by new meta-
              data.  This provides a mechanism to upgrade the metadata  format
              or  to add/remove metadata areas. Use with care. See also vgcon-
              vert(8).

So it is doing what it says it does, but if you don't specify the metadata size to use, it would make sense for it to use up the space right up to pe_start, making it similar in size to the original one.

Comment 6 Alasdair Kergon 2017-08-08 17:12:45 UTC
(In reply to bugzilla from comment #4)
> (In reply to Alasdair Kergon from comment #3)
> > I've reproduced something similar.
> 
> Does that mean you do not need the upload?

No, I was thinking at first it was a rounding error depending on the precise sizes in the calculations, but it wasn't even trying to get this right!

Comment 7 Alasdair Kergon 2017-08-09 14:43:02 UTC
Also problems with pvcreate -ff remembering bootareas instead of paying attention only to the new command line and restorefile contents.

Comment 8 Alasdair Kergon 2017-08-11 23:25:02 UTC
Pushed some patches upstream so it clears existing boot areas and uses the maximum size for the metadata area that fits.  There are still more bugs to fix (eg. if the number of mda copies is changed from 1 to 2).

Comment 9 Alasdair Kergon 2017-08-15 15:14:58 UTC
I think the upstream patches are sufficient to trap these cases earlier now.

Comment 12 Roman Bednář 2017-12-12 15:22:01 UTC
Verified.


BEFORE PATCH:

lvm2-2.02.171-8.el7

# pvcreate --metadatasize 128MiB /dev/sda1
  Physical volume "/dev/sda1" successfully created.
# vgcreate VG /dev/sda1
  Volume group "VG" successfully created
# vgcfgbackup VG
  Volume group "VG" successfully backed up.
# pvs -o pv_mda_free,pv_mda_size /dev/sda1
  PMdaFree  PMdaSize 
    <68.00m  <136.00m
# pvs --noheadings -o pv_uuid /dev/sda1
  SE2Etx-b7io-smJ2-HWN7-LFeK-fqYD-OC1Z1B
# pvcreate -ff --uuid SE2Etx-b7io-smJ2-HWN7-LFeK-fqYD-OC1Z1B --restorefile /etc/lvm/backup/VG /dev/sda1
Really INITIALIZE physical volume "/dev/sda1" of volume group "VG" [y/n]? y
  WARNING: Forcing physical volume creation on /dev/sda1 of volume group "VG"
  Physical volume "/dev/sda1" successfully created.
# pvs -o pv_mda_free,pv_mda_size /dev/sda1
  PMdaFree  PMdaSize 
     <4.00m    <8.00m



AFTER PATCH:

lvm2-2.02.176-5.el7

# pvcreate --metadatasize 128MiB /dev/sda1
  Physical volume "/dev/sda1" successfully created.
# vgcreate VG /dev/sda1
  Volume group "VG" successfully created
# vgcfgbackup VG
  Volume group "VG" successfully backed up.
# pvs -o pv_mda_free,pv_mda_size /dev/sda1
  PMdaFree  PMdaSize 
    <68.00m  <136.00m
# pvs --noheadings -o pv_uuid /dev/sda1
  rd1HNX-GrtZ-dxSM-HrDy-vwXi-u8E4-HrzbT8
# pvcreate -ff --uuid rd1HNX-GrtZ-dxSM-HrDy-vwXi-u8E4-HrzbT8 --restorefile /etc/lvm/backup/VG /dev/sda1
Really INITIALIZE physical volume "/dev/sda1" of volume group "VG" [y/n]? y
  WARNING: Forcing physical volume creation on /dev/sda1 of volume group "VG"
  Physical volume "/dev/sda1" successfully created.
# pvs -o pv_mda_free,pv_mda_size /dev/sda1
  PMdaFree  PMdaSize 
    <68.00m  <136.00m



3.10.0-811.el7.x86_64

lvm2-2.02.176-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
lvm2-libs-2.02.176-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
lvm2-cluster-2.02.176-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
lvm2-python-boom-0.8.1-5.el7    BUILT: Wed Dec  6 11:15:40 CET 2017
cmirror-2.02.176-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
device-mapper-1.02.145-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
device-mapper-libs-1.02.145-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
device-mapper-event-1.02.145-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
device-mapper-event-libs-1.02.145-5.el7    BUILT: Wed Dec  6 11:13:07 CET 2017
device-mapper-persistent-data-0.7.3-3.el7    BUILT: Tue Nov 14 12:07:18 CET 2017

Comment 15 errata-xmlrpc 2018-04-10 15:20:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0853


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