Open Source › LamBoot filesystem crates › lamzfs

lamzfs

Read-only ZFS pools (single disk, mirror, RAID-Z1) for root-on-ZFS boot pools.

Reads ZFS | v0.1.4 | MIT | Rust 1.87+ | no_std, forbid(unsafe_code) | No required dependencies
OVERVIEW

What lamzfs is for

lamzfs imports a ZFS pool over a plain byte source, walks to one dataset and reads its files: enough for a bootloader to find a kernel and initramfs without the OpenZFS kernel module, without std, and without a GPL UEFI driver. The motivating target is Ubuntu and Debian root-on-ZFS, which keep a simple bpool boot pool.

Read-only by construction: There's no write path and no BlockWrite. Every layout it doesn't read fails with a typed error and a stable token, never a wrong read.

Basis: The on-disk decoders are vendored from rzfs, electing the MIT half of its GPL-2.0 OR MIT license: a clean-room reader, not GPL kernel or userspace source. Pool import, vdev routing, the feature gate and the dataset walk are new lamzfs code, also available under Apache-2.0.

INSTALL

Add it to your crate

# Cargo.toml
[dependencies]
lamzfs = "0.1"

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

Usage

use lamzfs::{BlockRead, PoolMember, Zfs};

let mut zfs = Zfs::import(members())?;      // one PoolMember per vdev member
for entry in zfs.read_dir(&["BOOT", "default"], &[])? { /* ... */ }
let kernel = zfs.read(&["BOOT", "default"], &["vmlinuz"])?;

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

CAPABILITIES

What it reads

FeatureStatus
One top-level vdev: a single disk, a mirror or RAID-Z1Read, including degraded RAID-Z1 reads rebuilt from parity
Uberblock selectionFrom all four labels of every member, so a stale mirror member can't win
Pools as installers create themProxmox VE (every feature on), Ubuntu's bpool and rpool with dnodesize=auto, xattr=sa, posixacl and formD
Compressionoff, zle, lzjb, lz4, gzip and zstd
ChecksumsFletcher-2/4, SHA-256, SHA-512/256 and salted BLAKE3
The read walkLabel, uberblock, MOS, DSL, dataset, ZPL, micro and fat ZAP, long names, large dnodes and blocks, sparse files

What it refuses

  • Read features it doesn't implement: raidz_expansion, device_removal, draid, dynamic_gang_header, redacted datasets, and any unknown feature
  • Several top-level vdevs (a stripe such as Proxmox's RAID0, or log and special vdevs)
  • RAID-Z2, RAID-Z3, dRAID, gang blocks and encrypted datasets (an unencrypted /boot beside them still reads)
  • Skein and Edon-R checksums

Each has a stable error token (Error::token).

DEPENDENCIES

What it depends on, and what it doesn't

Avoids: The OpenZFS kernel module, a GPL UEFI driver and std. With its features off it has no dependencies; lzjb and mirror support are its own code.

Always

None. lamzfs builds with no required dependencies.

Only with a feature

Cargo features

FeatureDefaultWhat it adds
lz4, zstd, gzip, lzjbYesEach compression algorithm
mirrorYesMirror topologies
sha512YesSHA-512/256 checksums through sha2
blake3YesBLAKE3 checksums, portable Rust
stdNoAn std::error::Error impl for Error
TESTING

How it's tested

Fixtures are real pools OpenZFS wrote through its kernel module, so every file must hash to what the kernel wrote and every refused layout must fail with its token; three fuzz targets.

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