Crate gpt

source ·
Expand description

A pure-Rust library to work with GPT partition tables.

It provides support for manipulating (R/W) GPT headers and partition tables. Raw disk devices as well as disk images are supported.

extern crate gpt;

fn inspect_disk() {
    let diskpath = std::path::Path::new("/dev/sdz");
    let cfg = gpt::GptConfig::new().writable(false);

    let disk = cfg.open(diskpath).expect("failed to open disk");

    println!("Disk header: {:#?}", disk.primary_header());
    println!("Partition layout: {:#?}", disk.partitions());
}

Modules

Disk-related types and helper functions.
GPT-header object and helper functions.
MBR-related types and helper functions.
Partition-related types and helper functions.

Structs

Configuration options to open a GPT disk.
A file-backed GPT disk.