I am trying to set up LVM on LUKS. Here is what I did:
head -c 100M /dev/zero > test-file
losetup /dev/loop0 test-file
cryptsetup luksFormat /dev/loop0
cryptsetup open /dev/loop0 cryptlvm
gdisk /dev/mapper/cryptlvm
Then I put a GPT and a single partition 8e00 LVM on there.
fdisk -l /dev/mapper/cryptlvm
# => /dev/mapper/cryptlvm-part1 2048 200670 198623 97M Linux LVM
However
pvcreate /dev/mapper/cryptlvm-part1
# => Device /dev/mapper/cryptlvm-part1 not found.
The partition doesn't show up in lsblk
either. Folks seem to generally advocate usage of a partition table underneath LVM to make sure partitioning programs see something is there, so I wanted to adhere to that.
Putting LVM on a partition on top of a GPT worked without problems when I skipped the LUKS container.
When I try to set up a LUKS container on the partition only this works fine too, i.e. gdisk and then cryptsetup onto the LVM partition.
I expected that it should be possible to put a partitioning scheme inside a LUKS container and then use LVM on a single partition in there. I'd appreciate any hints or explanation as to why this (seemingly) is not possible.