Fedora root and swap is not found

I was messing around with partiotions.
I wanted to make a new partition. I have done this command

parted /dev/sdb2 mklabel msdos

now when I am booting it tells
Warning: /dev/fedora/root does not exist
Warning /dev/fedora/swap does not exist
Warning : /dev/mapper/fedora-root does not exist

Generating ‘/run/initramsfs/rdsosreport.txt’
Entering emergency mode. Exit the shell to continue.
Type “journalctl” to view system logs.
You might want to save "/run/initramsfs/rdsosreport.txt’
after mounting them and attach it to a bug report.


Is there any way to recover my files with live boot or something? I have read and tried some things but nothing.

Don’t worry. parted mklabel is non-destructive to your data.

It seems after your change, Fedora bootloader cannot recognise which partition to boot.

You can boot the Workstation Live ISO, mount your internal HDD, mount your root volume, study the details of /etc/fstab, and fix the bootloader configs and fstab entries.

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.


This help text is really impressive.

I wish I will never need to use this, but I bookmarked it already.