Red Hat Bugzilla – Bug 1479084
vgcfgbackup does not save the PV metadata size originally specified by --metadatasize
Last modified: 2018-04-10 11:21:33 EDT
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
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.)
I've reproduced something similar.
(In reply to Alasdair Kergon from comment #3) > I've reproduced something similar. Does that mean you do not need the upload?
--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.
(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!
Also problems with pvcreate -ff remembering bootareas instead of paying attention only to the new command line and restorefile contents.
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).
I think the upstream patches are sufficient to trap these cases earlier now.
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
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