[RFC next 0/2] dm: lvm: Initial Logical Volume Management support
Tobias Waldekranz
tobias at waldekranz.com
Mon Aug 24 11:31:19 PDT 2026
This is an initial RFC on the addition of LVM support to Barebox.
Avid readers of Barebox lore might remember me describing LVM support
as a key part of my roadmap of how I would like to boot future
versions of Infix - a network centric OS I work on - in the original
device mapper series. [1]
I have finally gotten some time to get this in a presentable state.
Example session:
wkz at spa:~/src/github.com/barebox/barebox$ ./barebox -i disk0=infix-x86_64.disk,blkdev
[...]
barebox at Sandbox:/ lvm info
VG "internal":
UUID: sN8htx-oD18-wHWH-SuCU-1EWy-th1l-5WPU6j
SeqNum: 1
Size: 132 MiB (1 MiB extents)
#PV: 1
#LV: 1
PV disk0.2:
UUID: 6VHjVF-WVt7-Gk4Y-oTrK-lsgY-ve7N-GJ0CUn
Size: 134 MiB
LV "infix-x86_64.raw":
UUID: Xp76Ig-9XXj-aBfK-Xv2U-rbsY-nEWX-omt4Bo
Type: linear
Size: 132 MiB
barebox at Sandbox:/ lvm activate internal infix-x86_64.raw
[GPT warnings...]
Created internal-infix-x86_64.raw
barebox at Sandbox:/ ls /mnt/internal-infix-x86_64.raw.0/
mounted /dev/internal-infix-x86_64.raw.0 on /mnt/internal-infix-x86_64.raw.0
bin boot cfg config dev etc home
lib lib64 loader log media mnt opt
proc root run sbin srv sys tmp
usr var
barebox at Sandbox:/
If the overall structure is OK with the community and maintainers,
then the biggest remaining issue is testing. I have been surprised to
learn that the standard LVM tools will not operate on disk images
(without loopback mounting). Nor does there seem to be any other tools
out there that allows you to provision PVs/VGs/LVs without having them
"live" and attached to the host system. If there are any suggestions
here they would be very welcome!
Additionally, I would like to add some fuzz testing to the metadata
parser.
Looking forward to your feedback!
[1]: https://lore.kernel.org/barebox/20250828150637.2222474-1-tobias@waldekranz.com/
Tobias Waldekranz (2):
dm: lvm: Initial Logical Volume Management support
commands: lvm: inspect VGs, activate LVs
commands/Kconfig | 11 +
commands/Makefile | 1 +
commands/lvm.c | 264 ++++++++++++
drivers/block/dm/Kconfig | 9 +
drivers/block/dm/Makefile | 1 +
drivers/block/dm/lvm/Makefile | 2 +
drivers/block/dm/lvm/lvm-core.c | 712 ++++++++++++++++++++++++++++++++
drivers/block/dm/lvm/lvm-md.c | 396 ++++++++++++++++++
drivers/block/dm/lvm/lvm-md.h | 106 +++++
drivers/block/dm/lvm/lvm2.h | 54 +++
include/lvm.h | 100 +++++
11 files changed, 1656 insertions(+)
create mode 100644 commands/lvm.c
create mode 100644 drivers/block/dm/lvm/Makefile
create mode 100644 drivers/block/dm/lvm/lvm-core.c
create mode 100644 drivers/block/dm/lvm/lvm-md.c
create mode 100644 drivers/block/dm/lvm/lvm-md.h
create mode 100644 drivers/block/dm/lvm/lvm2.h
create mode 100644 include/lvm.h
--
2.43.0
More information about the barebox
mailing list