vhdx-rs
vhdx-rs is a Rust library for working with VHDX (Virtual Hard Disk v2) files, with a companion command-line tool, vhdx-tool.
The project focuses on the on-disk structures defined by the MS-VHDX specification: headers, region tables, the block allocation table, metadata, log entries, differencing disk metadata, and virtual-sector I/O.
Features
- Open and create dynamic, fixed, and differencing VHDX files.
- Inspect VHDX sections through zero-copy views where possible.
- Read headers, region tables, BAT entries, metadata items, and log entries.
- Validate files against structural and MS-VHDX consistency rules.
- Configure log replay behavior when opening files.
- Resolve and validate differencing disk parent locator data.
- Read and write virtual sectors through the
IOandSectorAPIs. - Enable optional GPT integration with the
gptfeature.
Install
Add the library crate:
Install the CLI tool:
To enable GPT support in a library project:
= { = "0.1", = ["gpt"] }
Library Usage
use ;
Create a new dynamic disk:
use Medium;
CLI Usage
Show general file information:
Create a VHDX file:
Run validation and inspect internal structures:
Development
Build and test the workspace with Cargo:
The root crate publishes the library as vhdx-rs while exposing the Rust module name vhdx. The workspace also contains the vhdx-tool binary crate.
License
This project is licensed under the MIT license.