#ntfs #mft #refs

usn-journal-rs

A Rust library for working with the NTFS USN change journal and enumerating the MFT

6 releases

Uses new Rust 2024

0.3.0 Jun 4, 2025
0.2.2 May 16, 2025
0.1.1 May 9, 2025

#396 in Windows APIs


Used in usn-parser

MIT license

69KB
1.5K SLoC

Crates.io Docs.rs License: MIT

usn-journal-rs 🚀

A Rust library for working with the NTFS USN change journal and enumerating the MFT.

Overview 📝

usn-journal-rs provides safe, ergonomic abstractions for manipulating the USN change journal and accessing MFT records on NTFS volumes. It enables applications to efficiently enumerate file entries and monitor file system changes on Windows systems.

Features ✨

  • 🔍 Read and monitor USN journal records
  • 📂 Enumerate NTFS MFT entries
  • 🏷️ Resolve file IDs to full paths
  • 🦀 High-level, idiomatic Rust API
  • 🛡️ Safe abstractions over Windows FFI

Examples 🧑‍💻

Enumerate USN Journal Entries

use usn_journal_rs::{volume::Volume, journal::UsnJournal};

let drive_letter = 'C';
let volume = Volume::from_drive_letter(drive_letter)?;
let journal = UsnJournal::new(&volume);
for entry in journal.iter()? {
    println!("USN entry: {:?}", entry);
}

Enumerate MFT Entries

use usn_journal_rs::{volume::Volume, mft::Mft};

let drive_letter = 'C';
let volume = Volume::from_drive_letter(drive_letter)?;
let mft = Mft::new(&volume);
for entry in mft.iter() {
    println!("MFT entry: {:?}", entry);
}

You can find more usage examples in the examples directory. To run an example, use:

sudo cargo run --example change_monitor

Replace change_monitor with any example file name in the directory.

Platform Support 🖥️

  • 🪟 Windows NTFS/ReFS volumes
  • 🔑 Requires administrator privilege to access the USN journal or MFT.

Documentation 📚

See docs.rs/usn-journal-rs for full API documentation.

Contributing 🤝

Contributions are welcome! Please open issues or pull requests on GitHub.

License 📝

MIT License. See LICENSE for details.


Note:

  • This crate is Windows-only.
  • ReFS does not have a Master File Table (MFT).

Dependencies

~116MB
~2M SLoC