A pure-Rust library to work with GPT partition tables.
gpt
provides support for manipulating (R/W) GPT headers and partition
tables. It supports raw disk devices as well as disk images.
extern crate gpt;
use gpt::header::{Header, read_header};
use gpt::partition::{Partition, read_partitions};
fn inspect_disk() {
let lb_size = gpt::disk::DEFAULT_SECTOR_SIZE;
let diskpath = std::path::Path::new("/dev/sdz");
let hdr = header::read_header(diskpath, lb_size).unwrap();
println!("Disk header: {:#?}", h);
let pp = read_partitions(diskpath, &hdr, lb_size).unwrap();
println!("Partition layout: {:#?}", pp);
}