Skip to content
/ jfat Public

a FAT 12/16/32 filesystem implementation in Java

License

Notifications You must be signed in to change notification settings

jseitter/jfat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

JFAT - Java FAT Filesystem Library

CI Security Release GitHub release (latest by date) GitHub Java Gradle codecov

A comprehensive Java library for reading and writing FAT (File Allocation Table) filesystems with full support for FAT12, FAT16, and FAT32 formats.

✨ Key Features

  • πŸ”§ Complete FAT Support: Read/write operations on FAT12, FAT16, and FAT32
  • πŸ“ Long Filename Support: Full Unicode LFN support with automatic short name generation
  • ⚑ Intelligent Cluster Sizing: Microsoft-compliant cluster size optimization for peak performance
  • πŸ“Š Fragmentation Analysis: Comprehensive filesystem health analysis with performance impact assessment
  • πŸ”§ Defragmentation Intelligence: Smart recommendations for optimizing file allocation and free space
  • πŸ–₯️ Command-Line Interface: Comprehensive CLI with filesystem operations and analysis
  • 🌐 Web Interface: Modern browser-based interface with real-time visualization
  • πŸ” Advanced Analysis: Expert-mode visualization with cluster chain mapping and FAT table analysis
  • πŸ’» Interactive Shell: MS-DOS-like commands for intuitive filesystem navigation
  • πŸ—οΈ Device Flexibility: Support for disk images, block devices, and custom storage backends
  • πŸ§ͺ Production Ready: Extensive test suite with performance benchmarks

πŸš€ Quick Start

Installation

Gradle:

repositories {
    maven {
        name = "GitHubPackages"
        url = uri("https://maven.pkg.github.com/jseitter/jfat")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
            password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
        }
    }
}

dependencies {
    implementation 'net.seitter.jfat:jfat:0.1.0'
}

Direct Download: Download the latest JAR from GitHub Releases

Command-Line Usage

# Create a FAT32 filesystem with optimal cluster size
java -jar jfat.jar create disk.img fat32 1024    # 1GB with automatic 4KB clusters

# Explore filesystem contents
java -jar jfat.jar list disk.img
java -jar jfat.jar info disk.img                 # Shows cluster size optimization details

# Analyze filesystem fragmentation
java -jar jfat.jar fragmentation disk.img        # Overall fragmentation summary
java -jar jfat.jar frag disk.img files           # Detailed file fragmentation analysis
java -jar jfat.jar frag disk.img recommendations # Get defragmentation recommendations

# Interactive exploration
java -jar jfat.jar interactive disk.img

# Start web interface
java -jar jfat.jar webserver 8080               # Open http://localhost:8080

Web Interface

Launch the modern browser-based interface for filesystem management:

# Start web server (production mode)
java -jar jfat.jar webserver 8080

# Start in development mode
java -jar jfat.jar web 3000 --dev

The web interface provides:

  • πŸ“Š Real-time Dashboard: Filesystem statistics and health monitoring
  • πŸ“ File Browser: Drag-and-drop file management with directory navigation
  • πŸ“ˆ Graph Visualization: Interactive cluster allocation and fragmentation analysis
  • βš™οΈ Image Manager: Create, delete, and analyze FAT images
  • πŸ”¬ Expert Mode: Detailed FAT table visualization for digital forensics

Library Usage

import net.seitter.jfat.core.FatFileSystem;
import net.seitter.jfat.io.DeviceAccess;
import net.seitter.jfat.util.DiskImageCreator;

// Create an optimized FAT32 image
DiskImageCreator.createDiskImage("disk.img", FatType.FAT32, 1024);  // Auto-selects 4KB clusters

// Mount and use the filesystem
try (DeviceAccess device = new DeviceAccess("disk.img");
     FatFileSystem fs = FatFileSystem.mount(device)) {
    
    // Work with long filenames and Unicode
    FatFile file = fs.createFile("/My πŸš€ Project Files/Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚.txt");
    file.write("Hello, FAT filesystem!".getBytes());
    
    // Analyze cluster configuration
    System.out.println(fs.getBootSector().getClusterSizeInfo());
}

πŸ”¬ Advanced Features

Intelligent Cluster Size Management

JFAT automatically selects optimal cluster sizes following Microsoft specifications:

  • FAT16: 1KB (≀16MB) β†’ 2KB (≀128MB) β†’ 4KB (≀256MB) β†’ 8KB (≀512MB)
  • FAT32: 4KB (≀8GB) β†’ 8KB (≀16GB) β†’ 16KB (≀32GB) β†’ 32KB (>32GB)
  • Custom Configuration: Support for custom sector sizes (512B-4KB) and cluster configurations
# View cluster size recommendations
java -jar jfat.jar info disk.img

# Output:
# Cluster Size: 4096 bytes (4 KB)
# Sectors per Cluster: 8
# Cluster size ≀ 32MB: βœ“ YES
# Overall validation: βœ“ PASSED

Expert-Mode Filesystem Analysis

# Generate detailed filesystem visualization
java -jar jfat.jar graph disk.img analysis.dot --expert
dot -Tpng analysis.dot -o filesystem.png

Expert mode provides:

  • FAT Table Summary: Cluster usage statistics and health metrics
  • Cluster Chain Visualization: File fragmentation and allocation patterns
  • Performance Analysis: Optimal cluster size recommendations
  • Digital Forensics: Detailed cluster-level file storage mapping

Long Filename Support

Full Unicode support with automatic short name generation:

// Create files with long Unicode names
FatFile unicodeFile = root.createFile("Π”ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚ с ΠΎΡ‡Π΅Π½ΡŒ Π΄Π»ΠΈΠ½Π½Ρ‹ΠΌ ΠΈΠΌΠ΅Π½Π΅ΠΌ Ρ„Π°ΠΉΠ»Π°.txt");
FatFile emojiFile = root.createFile("My πŸš€ Project File.doc");

// JFAT automatically generates 8.3 short names: Π”ΠžΠšΠ£ΠœΠ•~1.TXT, MY~1.DOC

πŸ“š Documentation

πŸ› οΈ Building from Source

git clone https://github.com/jseitter/jfat.git
cd jfat
./gradlew build

# Run the CLI
java -jar build/libs/jfat-*.jar help

πŸ§ͺ Testing

# Run comprehensive test suite
./gradlew test

# Performance benchmarks
./gradlew test --tests "FatPerformanceTest"

# Test with your own FAT images
./gradlew runFatfsTest --args="path/to/your/image.img"

🎯 Use Cases

  • πŸ”¬ Digital Forensics: Analyze FAT filesystems with cluster-level detail
  • βš™οΈ Embedded Systems: Create optimized filesystems for resource-constrained devices
  • πŸ—‚οΈ Legacy Support: Read/write legacy FAT12 floppy disk images
  • πŸ“¦ System Integration: Programmatic FAT filesystem manipulation in Java applications
  • πŸŽ“ Education: Learn FAT filesystem internals with visualization tools

πŸ›οΈ Project Structure

src/main/java/net/seitter/jfat/
β”œβ”€β”€ core/           # Core FAT filesystem implementation
β”œβ”€β”€ io/             # Device access and I/O abstraction  
β”œβ”€β”€ util/           # Cluster optimization and disk image creation
β”œβ”€β”€ cli/            # Command-line interface with enhanced analysis
└── examples/       # Usage examples and standalone tools

docs/               # Comprehensive documentation
β”œβ”€β”€ cli-reference.md    # Command-line guide
β”œβ”€β”€ api-guide.md        # Programming interface
β”œβ”€β”€ testing.md          # Test suite documentation
β”œβ”€β”€ development.md      # Building and contributing
└── ci-cd.md           # Automated workflows

🀝 Contributing

We welcome contributions! See the Development Guide for:

  • Building from source
  • Code style guidelines
  • Testing requirements
  • Pull request process

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ† Recognition

JFAT implements the complete Microsoft FAT specification with modern Java best practices, providing both high-level convenience and low-level control for professional filesystem manipulation.

About

a FAT 12/16/32 filesystem implementation in Java

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages