On my previous computer, I had my / /home and swap inside an encrypted lvm, and outside the lvm I had the /boot and /boot/efi. I then created an image. I think I did like this:
dd if=/dev/sda of=lvm.img bs=4M but I don't remember. I could check it in .bash_history, if I just could decrypt the image first...
I have been trying to follow this guide: https://gist.github.com/talaj/721d50791e95ea585316ea0571822fa7
First I examined the file:
# file lvm.img lvm.img: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,254,63), startsector 1, 250069679 sectors, extended partition table (last) # fdisk -lu lvm.img Disk lvm.img: 119.2 GiB, 128035676160 bytes, 250069680 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 Disklabel type: gpt Disk identifier: 9FEF2EAF-1AE7-47B1-A446-7B3EBCB24A54 Device Start End Sectors Size Type lvm.img1 2048 3907583 3905536 1.9G EFI System lvm.img2 3907584 7813119 3905536 1.9G Linux filesystem lvm.img3 7813120 250068991 242255872 115.5G Linux LVM
So it certainly looks like it contains what it should. How should I do to view the partitions inside
lvm.img3 and mount them?
I started with this:
# kpartx -av lvm.img add map loop0p1 (253:3): 0 3905536 linear 7:0 2048 add map loop0p2 (253:4): 0 3905536 linear 7:0 3907584 add map loop0p3 (253:5): 0 242255872 linear 7:0 7813120
Continued with this:
# cryptsetup luksOpen /dev/mapper/loop0p3 mylvm
Hmmmm? I did not need to enter passphrase? Whatever. Contiuning the guide.
# vgscan Reading volume groups from cache. Found volume group "fedora" using metadata type lvm2 Found volume group "fedora_desktop-ld77fgg" using metadata type lvm2 # vgchange -a y fedora_desktop--ld77fgg Volume group "fedora_desktop--ld77fgg" not found Cannot process volume group fedora_desktop--ld77fgg
And now I'm stuck...
I'm using Fedora, but if it matters I could switch to another distribution.
As telcoM pointed out in an answer I had made a very silly mistake, and I don't understand how. Nevertheless I still have problems. I corrected my last command by changing the double dash to a single dash:
# vgchange -a y fedora_desktop-ld77fgg 4 logical volume(s) in volume group "fedora_desktop-ld77fgg" now active
# mount /dev/fedora_desktop-ld77fgg/03 /tmp/hej mount: /tmp/hej: unknown filesystem type 'crypto_LUKS'.