rdisk is a simple Rust CLI tool to detect the partition scheme of a disk device or disk image file.
It checks whether the disk uses MBR (Master Boot Record) or GPT (GUID Partition Table) by reading the raw disk bytes.
- Detects MBR by checking the boot signature at bytes 510-511 (
0x55 0xAA). - Detects GPT by reading the GPT header signature
"EFI PART"at byte 512. - Returns an error if neither signature is found.
Build the program:
cargo build --releaseCopy the built binary to /usr/local/bin/rdisk
sudo cp rdisk /usr/local/bin/rdisk
Run the program with the disk device or disk image file as an argument:
sudo rdisk /dev/sda
Example output:
/dev/sda is GPT
/dev/loop6 is MBR