16 releases (2 stable)

2.0.0 Jan 2, 2021
1.0.0 Jan 6, 2020
0.6.3 Nov 22, 2019
0.6.1 Feb 27, 2019
0.1.7 Apr 24, 2017

#49 in Filesystem

48 downloads per month

MIT license

100KB
1.5K SLoC

gpt

Build Status crates.io minimum rust 1.34 Documentation

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.

Example

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);
}

Dependencies

~380KB