https://github.com/tpdenk/mkfs
mkfs written in Rust. Compatible with no_std crates for reading and writing (via trait impls)
https://github.com/tpdenk/mkfs
ext2 ext3 ext4 mkfs
Last synced: 2 months ago
JSON representation
mkfs written in Rust. Compatible with no_std crates for reading and writing (via trait impls)
- Host: GitHub
- URL: https://github.com/tpdenk/mkfs
- Owner: tsatke
- License: apache-2.0
- Created: 2023-06-06T17:40:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T15:27:34.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T17:28:50.075Z (about 1 year ago)
- Topics: ext2, ext3, ext4, mkfs
- Language: Rust
- Homepage:
- Size: 145 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# mkfs
`mkfs` written in pure Rust.
## Motivation
I needed a library that could work with file systems in `no_std` environments for my kernel.
Additionally, for testing, I needed a library that I could use easily to create and edit
new file system images, and that I could use in my `build.rs` file. Those things can be done
by `mke2fs`. However, `mke2fs` is not available out of the box on all platforms, so I opted for
something that can be integrated in the `cargo` build process.
## Supported file systems
- [ ] ext2 (in progress)
- [ ] ext3
- [ ] ext4
- [ ] and more...
## Features
- Command line tool to create and edit file system images
- Usable as library (see below)
- Compatibility with `no_std` crates (you need to implement the `BlockDevice` trait for your data source)
# Usage
## Command line
(subject to change)
```shell
# create a 1MiB ext2 file system in fs.img with the structure of my_directory
mkfs ext2 create --size 1MB --out fs.img --in-dir ./my_directory
```
## Library
(not implemented yet)
### Use `mkfs` directly
Works nicely in `build.rs` files.
```rust
mkfs::ext2::create(
Ext2CreateOption {
out: PathBuf::from("fs.img"),
// all the other options
}
);
```
### Use with a `no_std` crate
```rust
// something like the following, still trying to figure this out
let block_device: MyBlockDevice = todo!("implement the BlockDevice trait");
let fs = Ext2Fs::new(block_device);
let file = fs.create_file("hello_world.txt");
...
```