8 releases
0.2.0 | Jul 15, 2022 |
---|---|
0.1.6 | Feb 19, 2022 |
0.1.5 | Jan 11, 2021 |
0.1.4 | May 16, 2020 |
0.1.1 | Jul 1, 2017 |
#2387 in Parser implementations
71 downloads per month
Used in 2 crates
26KB
310 lines
This crate can parse GPT and basic MBR partition tables.
Documentation and Examples
Limitations
- MBR extended partitions are not read (although they are returned, so you could read them yourself). This should be implemented.
- GPT backup tables are not validated, which is "kinda" required by the spec. This could be implemented, but isn't super important, unless you're doing data recovery.
- Sector sizes apart from 512 bytes are not well tested. These devices don't seem to exist as of 2017.
MSRV
Rust 1.46 is supported, and checked by CI. Updating this is a semver bump.
lib.rs
:
Read basic MBR and GPT partition tables from a reader.
Examples
Load MBR or GPT partitions from a reader
:
use std::io;
use bootsector::{list_partitions, open_partition, Options, Attributes};
// let reader = ...;
let partitions = list_partitions(&mut reader, &Options::default())?;
let part = &partitions[0];
// See what type of partition this is
match part.attributes {
Attributes::GPT {
type_uuid,
..
} => println!("gpt: {:?}", type_uuid),
Attributes::MBR {
type_code,
..
} => println!("mbr: {:x}", type_code),
}
let part_reader = open_partition(reader, part);
// part_reader.read_exact(...
Dependencies
~0.7–1MB