Expand description
High-level Rust API for creating ext4 filesystems.
This crate provides a safe Rust interface for formatting storage devices as ext4 filesystems using the lwext4 library.
§Example
use ext4_mkfs::{mkfs, MkfsConfig, IoBlockDevice, FsType};
use std::fs::OpenOptions;
// Open a file as a block device
let file = OpenOptions::new()
.read(true)
.write(true)
.open("disk.img")
.unwrap();
// Create a block device wrapper (512-byte sectors, 100MB total)
let device = IoBlockDevice::new(file, 512, 100 * 1024 * 1024);
// Format as ext4
let config = MkfsConfig::new()
.fs_type(FsType::Ext4)
.block_size(4096)
.label("my_volume");
mkfs(device, config).unwrap();Re-exports§
pub use block_device::BlockDevice;pub use block_device::IoBlockDevice;pub use error::Error;pub use error::Result;pub use mkfs::mkfs;pub use mkfs::FsType;pub use mkfs::MkfsConfig;
Modules§
- block_
device - Block device trait and implementations.
- error
- Error types for ext4-mkfs operations.
- mkfs
- mkfs functionality for creating ext4 filesystems.