[linux-lvm] LVM: Metadata on ... has wrong VG name

David Teigland teigland at redhat.com
Mon Dec 20 16:52:41 UTC 2021

On Sun, Dec 19, 2021 at 07:14:08AM -0500, linux-lvm at harrier.ch wrote:
>   >sudo pvscan
>    Metadata on /dev/sdd2 at 12800 has wrong VG name “fedora32 {
>    id = “gJgZM9-n2Rd-V7us-RWae-cpT6-H84E-g7dAsk”
>    seqno = 9
>    format = “lvm2”
>    status = [“RESIZEABLE”, “READ”, “WRITE”]
>    flag” expected fedora.
>    WARNING: Reading VG fedora on /dev/sdd2 failed.
>    WARNING: PV /dev/sdd2 is marked in use but no VG was found using it.
>    WARNING: PV /dev/sdd2 might need repairing.

It's not clear if there's a problem with the on-disk metadata, or if the
pvscan is confused and mixing info from the duplicated disks.  You don't
want to "fix" metadata if it's just a reporting error, so use filters to
report each device in isolation:

pvs --config 'devices/filter=["a|/dev/sdd2|", "r|.*|"]' /dev/sdd2
pvs --config 'devices/filter=["a|/dev/sda2|", "r|.*|"]' /dev/sda2

If each is disk is displayed correctly without error, then the on-disk
metadata is fine (please create a bz, or send, the output of pvs -vvvvv so
we can fix it.)  To work around it, use the same filter in lvm.conf to
limit lvm access to one disk at a time, and change the vg name, vg uuid,
pv uuid (changing all is probably unnecessary, you just want all three of
those to be unique for each disk.)

If the initial pvs commands with filters still show errors, then there are
on-disk metadata problems.  Set the lvm.conf filter to limit access to the
one disk with errors, then use the pvck command to repair it:

1. list older versions of metadata on the disk.

  # pvck --dump metadata_all /dev/sdx

2. review list, and pick a version you think is before changes, noting
   "metadata at <offset> ..."

3. save that version of metadata to a file using the offset

  # pvck --dump metadata_all --settings metadata_offset=<offset> -f metafile /dev/sdx

4. look at the metadata file created and confirm it's what you want, or
   save other files with other versions to compare them.

5. repair the PV using the file containing the metadata you want

  # pvck --repair -f metafile /dev/sdx

If this worked, then the 'pvs' command should display the disk without
errors.  While this disk remains isolated with the filter, verify the LVs
contain the data you want.  You may want to change the vg name, vg uuid,
pv uuid on this disk while it's isolated to ensure there won't be
duplicated info later.

More information about the linux-lvm mailing list