AsterFs provides small, auditable cross-platform filesystem utilities for synchronous and asynchronous Rust. It is AsterCommunity's maintained fork of fs4, which in turn continues fs2.
The fork preserves the upstream public API and feature matrix while tightening platform contracts that AsterDrive relies on. In particular, allocate(len) must reserve physical storage so later writes within that range do not fail for lack of space; changing only logical EOF is not sufficient.
Until the first AsterFs release is published, pin an audited Git revision:
[dependencies]
aster-fs = { git = "https://github.com/AsterCommunity/AsterFs", rev = "<commit>", features = ["sync"] }Available runtime features:
| Runtime / file type | Feature |
|---|---|
std::fs::File |
sync (default) |
| Tokio | tokio |
| async-std | async-std |
| Smol | smol |
fs-err v2 / v3 |
fs-err2, fs-err3 |
Tokio fs-err v2 / v3 |
fs-err2-tokio, fs-err3-tokio |
The extension traits are exported from the crate root:
use aster_fs::FileExt;
let file = std::fs::File::create("reserved.bin")?;
file.allocate(128 * 1024 * 1024)?;
# Ok::<(), std::io::Error>(())- Linux and other supported Unix targets use
rustixfilesystem primitives and preserve native error codes. - Apple targets use all-or-nothing
F_PREALLOCATEfor new extents, validatefstore_t.fst_bytesallocbefore extending logical EOF, and materialize actual holes when recovering an existing sparse file. - Windows uses
FILE_ALLOCATION_INFOand reports native capacity errors such asERROR_DISK_FULL. - Platforms without a real physical-preallocation primitive retain the upstream compatibility fallback; callers that require a hard reservation should restrict deployment to a verified backend.
Native runtime tests cover Linux, macOS, and Windows. The macOS CI path mounts a disposable size-limited APFS image to prove that an oversized request returns ENOSPC without leaving a partial allocation.
Async allocation delegates blocking filesystem work to the selected runtime's blocking pool, including sparse-hole recovery on Apple filesystems.
- Package:
aster-fs - Crate:
aster_fs - MSRV: Rust 1.75 for the default
syncfeature - License: MIT OR Apache-2.0
The async-std and smol features inherit the MSRV of their transitive dependencies, currently Rust 1.85.
AsterFs preserves the work and copyright of the fs4 and fs2 authors. See CHANGELOG.md, LICENSE-MIT, and LICENSE-APACHE.