public inbox for cryptsetup@lists.linux.dev
 help / color / mirror / Atom feed
* Partition table instead of LVM inside a LUKS container
@ 2024-02-25 15:14 Mistave
  2024-02-25 15:36 ` Brian J. Murrell
  0 siblings, 1 reply; 4+ messages in thread
From: Mistave @ 2024-02-25 15:14 UTC (permalink / raw)
  To: cryptsetup

Hello,

Just a request for some opinions and suggestions.

In most online tutorials about encrypted linux setups it's recommended 
to use LVM (and by that I mean tools like pvcreate, vgcreate and 
lvcreate) on-top of a LUKS container to further partition the encrypted 
block device. However, my question is that, provided you are using a 
full device encryption (e.g. "cryptsetup luksFormat /dev/sdb" and then 
"cryptsetup open /dev/sdb container"), are there any negative effects of 
simply skipping LVM and creating a partition table with partitions 
directly on the new dm-crypt device?

I tried creating a test setup on an empty drive, and the system (Ubuntu 
22.04 LTS) was able to recognize the partitions after creating a new GPT 
partition table with two ext4 primary partitions on 
/dev/mapper/container device. The partitions appeared as 
/dev/mapper/container1 and /dev/mapper/container2, and were also visible 
in /dev/disk/by-id/ folder. No /dev/loop devices or LVM ("lvs" command 
returned nothing) appear to have been used while setting up the environment.

The setup was like (as root):
cryptsetup luksFormat /dev/sdb
cryptsetup open /dev/sdb container
gparted /dev/mapper/container => New GPT table + 2x 10G ext4 partitions
mount /dev/mapper/container1 /mnt/disk => Mounted OK.


- Are there any benefits or drawbacks by using this approach over using 
LVM inside the LUKS container?

- Is this recommended or generally well supported?

- Can such setup be used to host the linux rootfs and other mount points 
in an encrypted Linux setup (including /boot)? Grub?

- Can I expect problems unmounting and closing the dm-crypt device i.e. 
by system shutdown scripts? For example, if I (after unmounting 
/mnt/disk) tried to close the device by doing "cryptsetup close 
container" in my test setup, it complained that the device is still in 
use. I had to first close the "container2" device, then "continer1" and 
finally the "container" device in /dev/mapper to remove the dm-crypt 
mapping.


Thanks in advance.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-26  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-25 15:14 Partition table instead of LVM inside a LUKS container Mistave
2024-02-25 15:36 ` Brian J. Murrell
2024-02-25 17:04   ` Mistave
2024-02-26  1:11     ` Arno Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox