How to recover LVM volume group and logical volumes

What happened:
I had two LVM volume groups. I thought that I removed one specific LVM volume group with blivet-gui. But after doing this both LVM volume groups are not showing up any more. Maybe I made a mistake, maybe something else went wrong.

Current state:
I did not reboot my computer yet, and everything still works. But blivet-gui does not show any LVM volume groups any more.

Questions:

  • How can I recover the LVM volume group and the LVM logical volumes?
  • Will I not be able to start the computer any more after reboot if I do not recover them?

Diagnosis of current situation:

# lsblk
NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0                                           7:0    0   104M  1 loop  /var/lib/snapd/snap/core/16928
loop1                                           7:1    0  55.7M  1 loop  /var/lib/snapd/snap/core18/2812
loop2                                           7:2    0  55.7M  1 loop  /var/lib/snapd/snap/core18/2823
loop3                                           7:3    0   272K  1 loop  /var/lib/snapd/snap/universal-update-utility/140
loop4                                           7:4    0    20K  1 loop  /var/lib/snapd/snap/hello-world/29
sda                                             8:0    0   489G  0 disk  
├─sda1                                          8:1    0   200M  0 part  /boot/efi
├─sda2                                          8:2    0     1G  0 part  /boot
└─sda3                                          8:3    0 487.9G  0 part  
  └─luks-23d92739-0aa1-4ffc-af64-18fc524bad5b 253:0    0 487.9G  0 crypt 
    ├─fedora-swap                             253:1    0   7.9G  0 lvm   [SWAP]
    ├─fedora-root                             253:4    0   500G  0 lvm   /
    └─fedora-home                             253:5    0   4.4T  0 lvm   /home
sdb                                             8:16   0   5.5T  0 disk  
└─sdb1                                          8:17   0   5.5T  0 part  
  └─luks-42ccf8b7-fcb4-416b-b707-9a97ec819239 253:2    0   5.5T  0 crypt 
    ├─fedora-root                             253:4    0   500G  0 lvm   /
    └─fedora-home                             253:5    0   4.4T  0 lvm   /home
sdc                                             8:32   0 232.9G  0 disk  
└─sdc1                                          8:33   0 232.9G  0 part  
  └─luks-f29fc668-9a4c-4b15-87f2-c6981be1e840 253:3    0 232.9G  0 crypt 
    └─fedora-home                             253:5    0   4.4T  0 lvm   /home
sdd                                             8:48   0   7.3T  0 disk  
└─sdd1                                          8:49   0   7.3T  0 part  /run/media/jan/nyx_backup
zram0                                         252:0    0     8G  0 disk  [SWAP]
nvme0n1                                       259:0    0   3.7T  0 disk  
├─nvme0n1p1                                   259:3    0 190.7M  0 part  
└─nvme0n1p2                                   259:4    0   1.9G  0 part  

Note how fedora-home and fedora-root are still mounted.

I still see the three LVM pysical volumes with pvs, but only with the -A option:

# pvs -A
  PV                                                    VG     Fmt  Attr PSize    PFree
  /dev/mapper/luks-23d92739-0aa1-4ffc-af64-18fc524bad5b fedora lvm2 a--  <487.85g    0 
  /dev/mapper/luks-42ccf8b7-fcb4-416b-b707-9a97ec819239 fedora lvm2 a--    <5.46t 1.27t
  /dev/mapper/luks-f29fc668-9a4c-4b15-87f2-c6981be1e840 fedora lvm2 a--  <232.88g    0

As you can see above, also the VG fedora is still mentioned.

But vgs does not show the fedora VG:

# vgs fedora
  Volume group "fedora" not found
  Cannot process volume group fedora
# vgs -a
# 

The command vgcfgrestore gives me quite some output:

# vgcfgrestore -l fedora

<removed older changes here...>

  File:		/etc/lvm/archive/fedora_00041-36248655.vg
  VG name:    	fedora
  Description:	Created *before* executing 'lvresize --force --fs ignore --devices /dev/mapper/luks-f29fc668-9a4c-4b15-87f2-c6981be1e840,/dev/mapper/luks-23d92739-0aa1-4ffc-af64-18fc524bad5b,/dev/mapper/luks-42ccf8b7-fcb4-416b-b707-9a97ec819239 -L+708338253824B fedora/home --config log/command_log_selection="log_context!="'
  Backup Time:	Tue Feb 11 20:41:19 2025

   
  File:		/etc/lvm/backup/fedora
  VG name:    	fedora
  Description:	Created *after* executing 'lvresize --force --fs ignore --devices /dev/mapper/luks-f29fc668-9a4c-4b15-87f2-c6981be1e840,/dev/mapper/luks-23d92739-0aa1-4ffc-af64-18fc524bad5b,/dev/mapper/luks-42ccf8b7-fcb4-416b-b707-9a97ec819239 -L+708338253824B fedora/home --config log/command_log_selection="log_context!="'
  Backup Time:	Tue Feb 11 20:41:19 2025

If I try to use vgcfgrestore, I get:

# vgcfgrestore fedora
  Volume group fedora has active volume: home.
  Volume group fedora has active volume: root.
  Volume group fedora has active volume: swap.
  WARNING: Found 3 active volume(s) in volume group "fedora".
  Restoring VG with active LVs, may cause mismatch with its metadata.
Do you really want to proceed with restore of volume group "fedora", while 3 volume(s) are active? [y/n]: n
  Restore aborted.

I answered the question Do you really want to proceed with restore of volume group "fedora", while 3 volume(s) are active? with n.

So it seems that I have to make the volumes inactive. But I guess that I will not be able to use my system when I do that. How would you recommend to proceed?

You would need to boot to live media on usb then make the suggested changes on the system before booting back to the installed system.

Thanks for the hint @computersavvy.

Finally, I discovered that somehow (I guess by blivet-gui) a /etc/lvm/devices/system.devices file was added. I guess that this file only contained a new device, and not the old devices.

Anyway, removing the /etc/lvm/devices/system.devices made my system fully boot again.

See also: Probably an incorrect system.devices was added · Issue #479 · storaged-project/blivet-gui · GitHub