Expand description
§mount-fstab
A 100% type-safe, memory-safe, thread-safe Rust library for parsing,
editing, validating, and writing /etc/fstab files.
Implements the official fstab(5) semantics from util-linux, aligned with libmount and glibc parsing behavior.
§Quick start
use mount_fstab::Fstab;
let input = "UUID=root / ext4 defaults 0 1\n";
let fstab = Fstab::parse_str(input).unwrap();
assert_eq!(fstab.entries.len(), 1);§Modules
| Module | Description |
|---|---|
error | Error types for all parsing and validation operations |
escape | fstab escape sequence encoding and decoding |
fstype | Filesystem type (fstab field 3) |
options | Mount options (fstab field 4) with parsing and classification |
parse | fstab string and file parsing |
spec | Spec/source identifiers (fstab field 1) |
types | Core types: Entry, Fstab, MountPoint, EntryBuilder |
validate | Semantic validation of fstab entries |
write | Display formatting and atomic file writing |
§Features
- Parse: Full fstab(5) format including all tag types (
LABEL,UUID,PARTLABEL,PARTUUID,ID), NFS mounts, escape sequences - Edit: Add, remove, replace entries with CRUD API
- Validate: Semantic checks matching
findmnt --verify - Serialize: Display formatting with proper escape encoding
- Atomic write: tempfile -> fsync -> rename for safe file updates
Re-exports§
pub use error::EntryBuilderError;pub use error::FsTypeError;pub use error::FstabError;pub use error::MountPointError;pub use error::OptItemError;pub use error::OptionsError;pub use error::ParseErrorKind;pub use error::SpecError;pub use fstype::FsType;pub use options::MountPermission;pub use options::OptItem;pub use options::OptionClass;pub use options::Options;pub use spec::Spec;pub use types::Entry;pub use types::EntryBuilder;pub use types::Fstab;pub use types::MountPoint;pub use validate::Diagnostic;pub use validate::Severity;
Modules§
- error
- Error types for all fstab parsing and validation operations.
- escape
- fstab escape sequence encoding and decoding.
- fstype
- Filesystem type — fstab(5) field 3 (
fs_vfstype). - options
- Mount options — fstab(5) field 4 (
fs_mntops). - parse
- fstab string and file parsing.
- spec
- Filesystem source specifiers — fstab(5) field 1.
- types
- Core fstab types:
Entry,Fstab,MountPoint,EntryBuilder. - validate
- Semantic validation of fstab entries.
- write
- fstab serialization and file writing.