Open Source › LamBoot filesystem crates › lamfat

lamfat

Read and write FAT12, FAT16 and FAT32, the ESP's filesystem: rust-fatfs, republished.

Reads FAT12, FAT16, FAT32 | v0.4.3 | MIT | Rust 1.71+ | no_std | 2 required dependencies
OVERVIEW

What lamfat is for

lamfat is the battle-tested fatfs engine under a distinct crate name, so it can be a published dependency of the LamBoot family and packaged for Debian and Fedora. The upstream crate hasn't tagged its 0.4.0 on crates.io; when it does, LamBoot moves to it.

It's the one crate in the family that writes as well as reads: LamBoot uses it on the EFI System Partition, which is always FAT.

Basis: A faithful republish of rafalh/rust-fatfs; PROVENANCE.md names the upstream commit and every change. The on-disk format logic is upstream's, unchanged.

INSTALL

Add it to your crate

# Cargo.toml
[dependencies]
lamfat = { version = "0.4", default-features = false, features = ["alloc", "lfn"] }

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

Usage

use lamfat::{FileSystem, FsOptions};

let fs = FileSystem::new(disk, FsOptions::new())?;
for entry in fs.root_dir().iter() {
    let name = entry?.file_name();
}

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

CAPABILITIES

What it reads

FeatureStatus
Mounting a volume and its root directoryYes
Reading and writing files; creating and removing files and directoriesYes
FAT12, FAT16 and FAT32Yes
Short (8.3) and long (VFAT) file namesYes, long names behind lfn
DEPENDENCIES

What it depends on, and what it doesn't

Avoids: A userspace filesystem stack. Its default tree is bitflags and log; chrono is opt-in.

Always

Only with a feature

  • chrono 0.4, with timestamps (off by default)

Cargo features

FeatureDefaultWhat it adds
stdYesstd::io integration
allocYesLong-file-name and format paths that allocate
lfnYesLong file names
unicodeYesFull Unicode case handling
log_level_*YesCompile-time log ceilings (trace by default)
TESTING

How it's tested

Upstream's test suite, plus the ls, cat, write, mkfatfs and partition examples.

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