True. But it is not trivial to recover from this situation. The LVM configuration/metadata is fucked up.
This is the procedure to follow (it worked for me reproducing the issue in a virtual machine), it needs some manual process, and you should adapt it to your case (vda2 should be sdb2, etc.):
-
Boot with a Live image
-
Issue sudo -s
-
Issue this command, and take note of the uuid of the phisical volume (PV)
strings /dev/vda2 | head -100 |grep pvid
Example output: scan:/dev/vda2 pvid:ahIuFeRjdYv00YeJEAMwKMZBX86j88qE devn:252:2 vg:fedora_localhost-live
So ahIuFeRjdYv00YeJEAMwKMZBX86j88qE
is the physical volume id
-
Issue the following command, it could take A LOT of time:
strings /dev/vda2 | grep "Generated by LVM" -A 2048 | tee output.txt
-
Here comes the manual part.
Open the output.txt, and supposing that after the system installation you have not modified the LVM, you should look for something that start with these lines:
# Generated by LVM2 version 2.03.05(2) (2019-06-15): Fri Sep 27 15:30:44 2019
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'pvscan --cache --activate ay 253:0'"
and ends with something like:
stripe_count = 1 # linear
stripes = [
"pv0", 42822
]
}
}
}
Open a new file (i.e. rescue.txt
) and paste all the above section (from # Generated by
to the last }
, you have to follow your intuition).
Check if the parenthesis (`}') are correctly closed, and add them if necessary.
Now the risky part:
pvcreate -ff -u ahIuFeRjdYv00YeJEAMwKMZBX86j88qE --restorefile ./rescue.txt /dev/vda2
If you get Parse error at byte 2803 (line 62): unexpected token
, check the parenthesis again.
If you get:
WARNING: Couldn't find device with uuid ahIuFe-RjdY-v00Y-eJEA-MwKM-ZBX8-6j88qE.
Wiping dos signature on /dev/vda2.
Physical volume "/dev/vda2" successfully created.
We are getting on.
Issue pvdisplay
to check if the Physical Volume is now recognized.
Now issue this command:
vgcfgrestore -f ./rescue.txt fedora_localhost-live
Where fedora_localhost-live
is the name of your Volume Group (probably fedora
, maybe?), look at the content of rescue.txt
file.
Now issue vgdisplay
, to see the Volume Group, and lvdisplay
to list the Logical Volumes.
And activate the Logical Volumes with these commands:
lvchange -ay /dev/fedora_localhost-live/root
lvchange -ay /dev/fedora_localhost-live/swap
Again, fedora_localhost-live
is the name of the Volume Group, yours is different.
Now you should be able to mount the root partition:
mount /dev/fedora_localhost-live/root /mnt/
If it works, reboot and your system should start normally.