Open Source › LamBoot filesystem crates › lamlvm

lamlvm

Read-only LVM2 logical volumes as plain byte streams, for any filesystem reader on top.

Reads LVM2 | v0.1.3 | MIT | Rust 1.85+ | no_std | 5 required dependencies
OVERVIEW

What lamlvm is for

lamlvm lets a UEFI bootloader open a filesystem on an LVM2 logical volume without a userspace LVM stack. It finds the physical volume label, reads the volume group's metadata from the first area whose checksums pass, and hands back each logical volume as an embedded_io Read + Seek stream with offsets mapped through the segment table.

Filesystem readers plug onto that stream unchanged: They can't tell whether the bytes come from a partition or from a logical volume on top of one. That's how LamBoot reads ext4 and XFS on LVM, the layout Proxmox VE and most single-disk LVM installs use. It's a reader only and never writes to a physical volume.

Basis: A maintained, modernized fork of main--/rust-lvm2 (MIT); the repository's PROVENANCE.md lists every change.

INSTALL

Add it to your crate

# Cargo.toml
[dependencies]
lamlvm = { version = "0.1", default-features = false }

Or cargo add lamlvm. On Debian unstable or testing, the packaged crate is librust-lamlvm-dev (rust-lamlvm).

Usage

use embedded_io::{Read, Seek};
use lamlvm::Lvm2;

let lvm = Lvm2::open(&mut reader)?;
if let Some(lv) = lvm.open_lv_by_name("root", &mut reader) {
    // lv is Read + Seek: hand it to ext4-view or lamxfs unchanged
}

The full API, with every type and error, is on docs.rs.

CAPABILITIES

What it reads

FeatureStatus
PV label (LABELONE) in any of the first four sectorsFound and checksum-verified
Volume group metadata (LVM2 format-text)Read from the first area that passes; an ignored or damaged first area falls back to the second
Metadata that has wrapped its ring buffer, LVs without a creation timeRead (0.1.2)
Linear logical volumesRead
RAID1 logical volumesRead through the leg on the PV opened (0.1.3)

What it refuses

  • Striped, RAID-4, RAID-5, RAID-6 and RAID-10 logical volumes
  • Thin pools, snapshots and cache volumes

Each fails on its own with OpenLvError::Unsupported: The rest of the volume group still opens and its readable volumes still read.

DEPENDENCIES

What it depends on, and what it doesn't

Avoids: The lvm2 userspace tools and device-mapper. All five dependencies build without std.

Always

  • embedded-io 0.6: The Read + Seek traits
  • nom 7.1: Parsing the metadata text
  • serde 1.0: Deserializing volume group metadata
  • snafu 0.9: Error types (the version Debian carries)
  • tracing 0.1: Diagnostics

Only with a feature

None.

Cargo features

FeatureDefaultWhat it adds
stdYesstd support in its dependencies; set default-features = false for no_std (alloc is required)
TESTING

How it's tested

Oracle tests against images made by the LVM2 tools on loop devices (a wrapped metadata ring, a missing creation time, linear next to striped and thin, labels in sectors 0 and 3, stale and damaged metadata areas, RAID1 across two PVs), each readable LV checked against device-mapper's SHA-256; cargo-fuzz over label, header, metadata and open.

WHY IT EXISTS

No GPL drivers in the boot path

Until 2026 LamBoot read most Linux filesystems through about a dozen prebuilt UEFI filesystem driver binaries from the EfiFs (GPL-3.0) and rEFInd (GPL-2.0) projects. Three things ruled them out at once. Debian's free-software guidelines and Fedora's packaging rules reject a prebuilt .efi blob that isn't built from source in the archive. Microsoft doesn't sign GPLv3 code for Secure Boot, and loading a separate UEFI driver binary removes the ShimLock protocol that shim 15.8 relies on. And GPL binaries sit badly beside a permissively licensed loader. These crates replace those drivers with readers compiled into LamBoot itself. The whole family · LamBoot