1 |
On Sun, Mar 27, 2022 at 8:32 PM Miles Rout <miles@××××.nz> wrote: |
2 |
> |
3 |
> To be clear, cryptsetup is just a userspace command line tool for |
4 |
> manipulating dm-crypt/LUKS stuff. dm-crypt is the kernel part. Lots of |
5 |
> tools are structured this way. LVM is a thing in the kernel, and the |
6 |
> lvcreate/pvcreate/etc. command line tools are just the userspace user |
7 |
> interface. I assume they probably use a bunch of complicated ioctl() |
8 |
> calls on the LVM block devices to do their magic. |
9 |
|
10 |
So, LVM is actually 100% userspace, and is analogous to cryptsetup. |
11 |
|
12 |
The kernel implementation is just device mapper. It has a whole bunch |
13 |
of modules: |
14 |
https://www.kernel.org/doc/html/latest/admin-guide/device-mapper/index.html |
15 |
|
16 |
Cryptsetup uses dm-crypt which take a block device and cipher |
17 |
parameters as input, and outputs a decrypted block device. |
18 |
|
19 |
LVM in its basic form uses dm-linear, which maps a range of blocks on |
20 |
an output device onto a range of blocks on an input device. You |
21 |
stitch a whole bunch of those together onto the same output device and |
22 |
you basically get logical volumes. |
23 |
|
24 |
LVM as the userspace component just stores all the metadata on disk to |
25 |
make it easy to use and keep you from scrambling your disks. It also |
26 |
uses other device mapper features like dm-raid/etc to do things like |
27 |
move data in while live, and so on. |
28 |
|
29 |
There actually have been other implementations of logical volumes on |
30 |
linux, but LVM is basically the standard these days. |
31 |
|
32 |
You can take two raw partitions and use dm-linear to turn them into |
33 |
one logical volume, with no metadata stored anywhere, and no need to |
34 |
install lvm. |
35 |
|
36 |
-- |
37 |
Rich |