Open Source › LamBoot filesystem crates › lamxfs
lamxfs
Read-only XFS, v4 and v5, with in-memory log replay after an unclean shutdown.
forbid(unsafe_code)
|
1 required dependency
What lamxfs is for
lamxfs lets a bootloader read kernels, initrds and boot configuration straight from an XFS /boot or root partition, the default on RHEL 9, Rocky 9, AlmaLinux 9, Oracle Linux 9, CentOS Stream and Amazon Linux. It does that without a GPL UEFI filesystem driver, without std, and without the Linux kernel.
It's the XFS counterpart to ext4-view and lambutter, with a deliberately matching API, so a consumer's filesystem adapter is one-for-one across the family. Read-only by construction: There's no write path and no BlockWrite trait.
Basis: Clean-room implementation from the public XFS on-disk format.
Add it to your crate
[dependencies]
lamxfs = "0.1"
Or cargo add lamxfs. On Debian unstable or testing, the packaged crate is librust-lamxfs-dev (rust-lamxfs).
Usage
use lamxfs::{Xfs, Path, BlockRead};
let mut fs = Xfs::open(reader, device_size_bytes)?; // validates the superblock
let cfg = fs.read_file(Path::new(b"/boot/loader/entries/rocky.conf"))?;
let ino = fs.resolve(Path::new(b"/boot/vmlinuz-6.1.0"))?;
let mut buf = [0u8; 1 << 20];
let n = fs.read_file_at(&ino, 0, &mut buf)?; // streaming read
The full API, with every type and error, is on docs.rs.
What it reads
| Feature | Status |
|---|---|
| XFS v5 (CRC, self-describing metadata) | Read, CRC32C verified |
| XFS v4 (legacy, no CRC) | Read |
| NREXT64 (64-bit extent counts) | Read per inode, so a filesystem upgraded with xfs_repair -c nrext64=1 reads correctly |
| Parent pointers and exchange-range (mkfs.xfs defaults since xfsprogs 6.18) | Read |
| Metadata directory tree (metadir) | Read, without a realtime section |
| Block sizes to 64 KiB, sector sizes to 32 KiB | Read |
| Sparse inodes, ftype entries, meta_uuid, bigtime | Read |
| Reflinks | Shared bytes read transparently |
| Shortform, block, leaf and node directories; inline and extent symlinks | Read |
| A log left dirty by a power cut or crash | Replayed in memory as Linux does at mount; nothing is written to the volume |
What it refuses
- A log that can't be replayed (a v4 log, an unfinished bmap or exchange-range change, an unknown log item or feature, a log corrupted before its last records)
- A realtime device or realtime groups, including zoned
- An external log, an in-progress mkfs, or an unknown incompat feature
- ascii-ci filesystems (names hash case-insensitively there) and per-file encryption
Each is a typed error, never a misread. Mounting and unmounting such a filesystem once under Linux replays its log.
What it depends on, and what it doesn't
Avoids: The GPL XFS UEFI driver and the Linux kernel. Its one dependency is crc.
Always
- crc 3.2: CRC32C for v5 metadata checksums
Only with a feature
None.
Cargo features
| Feature | Default | What it adds |
|---|---|---|
| std | No | An std::error::Error impl for Error. The crate is no_std with alloc either way. |
How it's tested
Unit tests per parser; oracle tests against real mkfs.xfs images (v5 with and without NREXT64, v4, xfsprogs 7.1 defaults, metadir, 64 KiB blocks, 8 KiB sectors, an upgraded filesystem, a wrapped log), each file checked against its SHA-256; seven images shut down with a dirty log must read back as Linux shows them after replay; cargo-fuzz over open, walk and replay.
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
The other disk filesystem readers
Read-only media formats (lamfold): lamfold · lamfold-iso · lamfold-udf · lamfold-squash · lamfold-erofs · lamfold-cramfs · lamfold-romfs · lamfold-cpio