A fully featured Rust library for direct work with FAT32 partitions and images. Provides low-level access to the FAT32 file system with support for reading, writing, creating and deleting files and directories.
β¨ Key features
π― Core capabilities
- Direct partition access: Native support for ESP (EFI System Partition), SD cards, USB flash drives
- Crossβplatform: Full support for Windows and Linux with handling of OSβspecific nuances
- Full FAT32 feature set: Read, write, create, delete files and directories
- Nested directories: Support for creating and navigating deeply nested directory structures
- Long file names (LFN): Full Unicode name support up to 255 characters
- Auto parameter detection: Automatic parsing of BPB (BIOS Parameter Block)
π§ Technical advantages
- Safety: Minimal use of
unsafecode, strong typing - Performance: Optimized read/write operations with buffering
- Reliability: Proper error handling, protection against data corruption
- Windows specifics: Solves access rights issues (OS Error 5) via special file opening flags
π Quick start
Working with a disk image
use Fat32Volume;
Working with a real ESP partition
use Fat32Volume;
π¦ Installation
Add to Cargo.toml:
[]
= "1.0"
π§ͺ Testing
The project includes a test suite that covers all operations:
# Run regular tests
# Run tests on a real ESP (requires sudo/Administrator)
# WARNING: this test works with a real ESP partition!
ποΈ Project structure
fat32-raw/
βββ src/
β βββ lib.rs # Main library module
β βββ error.rs # Error handling
β βββ fat32/
β β βββ mod.rs # FAT32 module
β β βββ volume.rs # Core volume logic
β β βββ directory.rs # Directory operations
β β βββ file.rs # File operations
β β βββ fat_table.rs # FAT table handling
β β βββ lfn.rs # Long file name support
β β βββ utils.rs # Helper functions
β βββ platform/
β βββ mod.rs # Platform abstractions
β βββ windows/ # Windowsβspecific code
β βββ unix/ # Unix/Linuxβspecific code
βββ tests/
βββ real_esp_test.rs # Integration tests with real ESP
π§ Roadmap
- Support for creating and deleting files and directories
- Automatic ESP partition discovery on disks
- Working with nested directories
- Full integration with Windows and Linux
- Handling access rights issues on Windows
- β³ MBR partition support
- β³ Defragmentation and optimization
- β³ FAT12/FAT16 support
- β³ Integration with GitHub Actions CI/CD
π€ Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a branch for your changes
- Make sure all tests pass
- Open a pull request
π License
This project is distributed under the GPLv3 license.
π Acknowledgements
- The Rust community for great tools and documentation
- The authors of the FAT32 specification from Microsoft
- All project contributors and users