Skip to content

Repository files navigation

RustDefrag GUI

High-performance NTFS analysis and defragmentation desktop application built in Rust with a custom egui/eframe interface.

CILicense: MIT

Overview

RustDefrag GUI combines low-level NTFS cluster operations with a modern real-time visualization layer:

  • Live cluster map for free, used, fragmented, moving, done, and system regions
  • Real-time analysis feedback with animated progress and map updates
  • Defragmentation pipeline with background worker execution
  • Dashboard panels for volume, analysis report, and defragmentation results
  • Built-in charts for distribution and performance trends

Highlights

  • Native Win32 filesystem control integration (FSCTL_GET_VOLUME_BITMAP, FSCTL_GET_RETRIEVAL_POINTERS, FSCTL_MOVE_FILE)
  • Worker-thread architecture to keep UI responsive
  • Capped parallel analysis pool to prevent full CPU saturation
  • Boot-time retry support for locked files (MoveFileExW)
  • File whitelist support for highly volatile system/update artifacts
  • Custom-drawn rich UI (panels, map, charts, counters)

Requirements

  • Windows 10/11 (x64)
  • Rust stable (MSVC target recommended)
  • Administrator privileges recommended for full raw-volume visibility and defrag operations

Quick Start

git clone https://github.com/arafat877/rust-defrag
cd rust-defrag-gui
cargo build --release
.\target\release\defrag-gui.exe

Project Structure

src/
main.rs Application entry point
app.rs Main UI and state orchestration
engine/
messages.rs GUI <-> worker messages
worker.rs Background command execution loop
defrag_engine/
volume.rs Volume metadata, bitmap, file enumeration
analyzer.rs File fragmentation analysis
defrag.rs Defragmentation execution
winapi.rs Isolated unsafe Win32 wrappers
errors.rs Domain errors
whitelist.rs Skip-list rules
ui/
cluster_map.rs Live cluster grid renderer
stats_panel.rs Stats cards and report panels
charts.rs Charts (pie, bar, histogram, line)
theme.rs Colors and visual constants

Keyboard Shortcuts

KeyAction
F5Start analysis
F6Start defragmentation
EscStop current operation

Security and Safety Notes

  • Defragmentation touches low-level disk structures and should be run carefully.
  • Use backups and avoid force-stopping the app during active relocation operations.
  • See SECURITY.md for vulnerability reporting.

Contributing

Please read CONTRIBUTING.md before opening a pull request.

License

MIT License. See LICENSE.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages