lamzfs
A no_std + alloc, read-only ZFS pool reader for UEFI bootloaders.
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 / Debian root-on-ZFS, which keep a simple bpool
boot pool. Read-only by construction: there is no write path and no
BlockWrite.
Scope (v0.1)
Supported:
- Topologies: single disk, mirror, and single-parity RAID-Z1 (including degraded reads that reconstruct a missing/corrupt column from parity).
- Compression:
off,zle,lzjb,lz4,gzip,zstd(each a feature). - Checksums: Fletcher-2/4 and SHA-256 (scalar).
- The full read walk: vdev label → uberblock → MOS → DSL → dataset → ZPL → ZAP directories → indirect block-pointer tree (sparse-file aware).
Out of scope: any write path, encryption, RAID-Z2/3, dRAID, and gang blocks (each rejected with a typed error).
Usage
Implement BlockRead over your device, then import and read:
use ;
# ;
#
#
let mut zfs = import?; // one PoolMember per vdev member
println!;
// Dataset path = child-directory components under the pool root; the second
// argument is the directory within that dataset (empty = its root).
for entry in zfs.read_dir?
let kernel = zfs.read?;
# Ok::
See examples/zfsdump.rs for a runnable host tool.
Basis
The on-disk decoders are vendored from
rzfs, electing the MIT half of its
GPL-2.0 OR MIT dual license — a clean-room reader, not GPL kernel/userspace
source. The orchestration (pool import, vdev routing, dataset walk, path
resolve, file read) is new lamzfs code. The crate is scalar-only and
#![forbid(unsafe_code)]. See NOTICE for attribution.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option. Vendored upstream portions retain their own terms (see
NOTICE).
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.