On Sun, Mar 27, 2022 at 8:32 PM Miles Rout <mi...@rout.nz> wrote:
>
> To be clear, cryptsetup is just a userspace command line tool for
> manipulating dm-crypt/LUKS stuff.  dm-crypt is the kernel part.  Lots of
> tools are structured this way.  LVM is a thing in the kernel, and the
> lvcreate/pvcreate/etc. command line tools are just the userspace user
> interface.  I assume they probably use a bunch of complicated ioctl()
> calls on the LVM block devices to do their magic.

So, LVM is actually 100% userspace, and is analogous to cryptsetup.

The kernel implementation is just device mapper.  It has a whole bunch
of modules:
https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/index.html

Cryptsetup uses dm-crypt which take a block device and cipher
parameters as input, and outputs a decrypted block device.

LVM in its basic form uses dm-linear, which maps a range of blocks on
an output device onto a range of blocks on an input device.  You
stitch a whole bunch of those together onto the same output device and
you basically get logical volumes.

LVM as the userspace component just stores all the metadata on disk to
make it easy to use and keep you from scrambling your disks.  It also
uses other device mapper features like dm-raid/etc to do things like
move data in while live, and so on.

There actually have been other implementations of logical volumes on
linux, but LVM is basically the standard these days.

You can take two raw partitions and use dm-linear to turn them into
one logical volume, with no metadata stored anywhere, and no need to
install lvm.

-- 
Rich

Reply via email to