After a couple of minutes, I switched to a "livecd" (it's just the minimal installation usb-stick I created a while back) with gentoo on it. Everything's the same there.alamahant wrote:Try from a live cd.
Are the lvm partitions visible from livecd?
Please run lsblk
If the partitions are visible maybe your problem is just reinstalling grub.
Can you mount the root partition from a livecd?
Lvm partitions dont just disappear...
Code: Select all
--- Logical volume ---
LV Path /dev/censored-encrypted/swap_fs
LV Name swap_fs
VG Name censored-encrypted
LV UUID I-have-no-idea-if-this-is-sensible-data
LV Write Access read/write
LV Creation host, time livecd, 2020-10-14 14:36:59 +0000
LV Status available
# open 0
LV Size <37.36 GiB
Current LE 9564
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Path /dev/censored-encrypted/root_fs
LV Name root_fs
VG Name censored-encrypted
LV UUID I-have-no-idea-if-this-is-sensible-data-either
LV Write Access read/write
LV Creation host, time livecd, 2020-10-14 14:37:00 +0000
LV Status available
# open 0
LV Size <916.01 GiB
Current LE 234498
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
livecd ~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 533.2M 1 loop /mnt/livecd
sda 8:0 1 3.7G 0 disk
|-sda1 8:1 1 3.6G 0 part /mnt/cdrom
`-sda2 8:2 1 20M 0 part
nvme0n1 259:0 0 953.9G 0 disk
|-nvme0n1p1 259:1 0 511M 0 part /mnt/boot
`-nvme0n1p2 259:2 0 953.4G 0 part
`-censored-crypt 253:0 0 953.4G 0 crypt
|-censored--encrypted-swap_fs 253:1 0 37.4G 0 lvm
`-censored--encrypted-root_fs 253:2 0 916G 0 lvm
I would love to do that, but my root partition is the only data-partition inside of that lvm, so I can't back it up unless I can fix my problem at least partially.alamahant wrote:I would advice you if your root partition can be mounted to backit up somewhere using rsync and then delete and recreate your pv vg and lvs...
Like this?:alamahant wrote:But did you try to mount the root lvm from the livecd?
Is it mountable?
Code: Select all
livecd ~ # mount /dev/mapper/censored--encrypted-root_fs /mnt/gentoo/
mount: /mnt/gentoo: wrong fs type, bad option, bad superblock on /dev/mapper/censored--encrypted-root_fs, missing codepage or helper program, or other error.

Code: Select all
dumpe2fs /dev/mapper/censored--encrypted-root_fsCode: Select all
mount -o ro,sb=131072 /dev/mapper/censored--encrypted-root_fs /mnt/gentoo/Sadly I get this:NeddySeagoon wrote:Manu311,
TryDoes that look like ext4?Code: Select all
dumpe2fs /dev/mapper/censored--encrypted-root_fs
Then there isThen there is the offset=<Bytes> option, where Bytes is the offset to the start of the filesystem. That's difficult to discover on LVM as you seed to knom the on disk layout.Code: Select all
mount -o ro,sb=131072 /dev/mapper/censored--encrypted-root_fs /mnt/gentoo/
However, your /dev/mapper/censored--encrypted-root_fs is a single extent, so that can work.
There are other values of sb= you can try too.
Code: Select all
livecd ~ # dumpe2fs /dev/mapper/censored--encrypted-root_fs
dumpe2fs 1.45.5 (07-Jan-2020)
dumpe2fs: Bad magic number in super-block while trying to open /dev/mapper/censored--encrypted-root_fs
Couldn't find valid filesystem superblock.
Code: Select all
mount: /mnt/gentoo: wrong fs type, bad option, bad superblock on /dev/mapper/censored--encrypted-root_fs, missing codepage or helper program, or other error.
Code: Select all
swapon /dev/mapper/censored--encrypted-swap_fsThat's kinda what I am assuming as well. Somehow the headers are corrupted, but I have no idea why. If I understand it correctly, they should have been able to be restored with the backup file I had on my usb-stick.NeddySeagoon wrote:Manu311,
Either your filesystem has been destroyed or /dev/mapper/censored--encrypted-root_fs does not point to the start of it, that would explain why the alternate superblock mount failed too.
The LVM recovery process only writes PV and LV metadata. filesystems are not harmed.
You also have censored--encrypted-swap_fs,
Doeswork?Code: Select all
swapon /dev/mapper/censored--encrypted-swap_fs
That would be encouraging as it would show the swap signature is still where you expected it to be.

Code: Select all
strings /dev/mapper/censored--encrypted-root_fs | grep -i <long_file_name>Code: Select all
strings /dev/mapper/censored--encrypted-root_fsInteresting - the gentoo minimal image apparently doesn't have "strings" on it. And since there's no emerge either, I figured the idea should still work if I just use grep on it (but it will probably take longer), so that's running right now.NeddySeagoon wrote:The idea is to locate the start of the filesystem, so it can be mounted.

Code: Select all
pvdisplayCode: Select all
lvdisplay -mCode: Select all
pvs --segments -o+lv_name,seg_start_pe,segtypeCode: Select all
LV UUID I-have-no-idea-if-this-is-sensible-data-eitherCode: Select all
livecd ~ # pvdisplay
--- Physical volume ---
PV Name /dev/mapper/censored-crypt
VG Name censored-encrypted
PV Size <953.37 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 244062
Free PE 0
Allocated PE 244062
PV UUID JgC3cr-Ie7Q-J9T1-1huo-QH69-KW8v-I3cZrq
livecd ~ # lvdisplay -m
--- Logical volume ---
LV Path /dev/censored-encrypted/swap_fs
LV Name swap_fs
VG Name censored-encrypted
LV UUID gdEwbz-2PLb-tyPY-ZzEg-Ijmq-2gET-9YBbCs
LV Write Access read/write
LV Creation host, time livecd, 2020-10-14 14:36:59 +0000
LV Status available
# open 0
LV Size <37.36 GiB
Current LE 9564
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Segments ---
Logical extents 0 to 9563:
Type linear
Physical volume /dev/mapper/censored-crypt
Physical extents 0 to 9563
--- Logical volume ---
LV Path /dev/censored-encrypted/root_fs
LV Name root_fs
VG Name censored-encrypted
LV UUID tYLAcL-i1v1-7UpV-HHV4-d9sN-Jqc6-C7j883
LV Write Access read/write
LV Creation host, time livecd, 2020-10-14 14:37:00 +0000
LV Status available
# open 0
LV Size <916.01 GiB
Current LE 234498
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Segments ---
Logical extents 0 to 234497:
Type linear
Physical volume /dev/mapper/censored-crypt
Physical extents 9564 to 244061
livecd ~ # pvs --segments -o+lv_name,seg_start_pe,segtype
PV VG Fmt Attr PSize PFree Start SSize LV Start Type
/dev/mapper/censored-crypt censored-encrypted lvm2 a-- <953.37g 0 0 9564 swap_fs 0 linear
/dev/mapper/censored-crypt censored-encrypted lvm2 a-- <953.37g 0 9564 234498 root_fs 0 linear
Code: Select all
livecd ~ # cat /mnt/cdrom/censored-encrypted-vg
# Generated by LVM2 version 2.02.187(2) (2020-03-24): Wed Oct 14 14:37:03 2020
contents = "Text Format Volume Group"
version = 1
description = "vgcfgbackup -f /mnt/cdrom/censored-encrypted-vg"
creation_host = "livecd" # Linux livecd 5.4.60-gentoo-x86_64 #1 SMP Mon Sep 21 04:11:09 UTC 2020 x86_64
creation_time = 1602686223 # Wed Oct 14 14:37:03 2020
censored-encrypted {
id = "qHypt4-SPr6-szq9-XzYa-IMx6-0czK-dxUN9I"
seqno = 3
format = "lvm2" # informational
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
metadata_copies = 0
physical_volumes {
pv0 {
id = "JgC3cr-Ie7Q-J9T1-1huo-QH69-KW8v-I3cZrq"
device = "/dev/mapper/censored-crypt" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 1999360000 # 953.369 Gigabytes
pe_start = 2048
pe_count = 244062 # 953.367 Gigabytes
}
}
logical_volumes {
swap_fs {
id = "gdEwbz-2PLb-tyPY-ZzEg-Ijmq-2gET-9YBbCs"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
creation_time = 1602686219 # 2020-10-14 14:36:59 +0000
creation_host = "livecd"
segment_count = 1
segment1 {
start_extent = 0
extent_count = 9564 # 37.3594 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 0
]
}
}
root_fs {
id = "tYLAcL-i1v1-7UpV-HHV4-d9sN-Jqc6-C7j883"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
creation_time = 1602686220 # 2020-10-14 14:37:00 +0000
creation_host = "livecd"
segment_count = 1
segment1 {
start_extent = 0
extent_count = 234498 # 916.008 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes = [
"pv0", 9564
]
}
}
}
}
livecd ~ #

Code: Select all
Disk /dev/mapper/censored-crypt: 953.38 GiB, 1023672320000 bytes, 1999360000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/censored--encrypted-swap_fs: 37.37 GiB, 40114323456 bytes, 78348288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/censored--encrypted-root_fs: 916.1 GiB, 983555899392 bytes, 1921007616 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Alright, so here's the fdisk-part from nvme0n1:NeddySeagoon wrote:Manu311,
The entire /dev/nvme0n1.
We know the filesystem start from the end of the drive but offset= is a count of bytes from the start of the drive.
Code: Select all
Disk /dev/nvme0n1: 953.89 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: Samsung SSD 970 PRO 1TB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 1048575 1046528 511M EFI System
/dev/nvme0n1p2 1048576 2000408575 1999360000 953.4G Linux filesystem

Code: Select all
mount -o ro,offset=40649449472 /dev/nvme0n1 /mnt/<someplace>Code: Select all
livecd ~ # mount -o ro,offset=40649449472 /dev/nvme0n1 /mnt/gentoo/
mount: /mnt/gentoo: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.

Code: Select all
mount -o ro,offset=40649449472 /dev/nvme0n1 /mnt/gentoo/ Code: Select all
mount -o ro,offset=40112578560 /dev/mapper/censored-crypt /mnt/gentoo/ Code: Select all
livecd ~ # mount -o ro,offset=40112578560 /dev/mapper/censored-crypt /mnt/gentoo/
mount: /mnt/gentoo: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.
livecd ~ # mount -o ro,offset=40112578560,sb=131072 /dev/mapper/censored-crypt /mnt/gentoo/
mount: /mnt/gentoo: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error.