gpart
Gpart guesses PC disk partition tables and finds lost partitions when the primary table is damaged, incorrect, or deleted. It lists types, locations, and sizes of deleted partitions for manual recreation.
Description
Gpart is a tool which tries to guess the primary partition table of a PC-type disk in case the primary partition table in sector 0 is damaged, incorrect or deleted. It is also good at finding and listing the types, locations, and sizes of inadvertently-deleted partitions, both primary and logical. It gives you the information you need to manually re-create them (using fdisk, cfdisk, sfdisk, etc.).
The guessed table can also be written to a file or (if you firmly believe the guessed table is entirely correct) directly to a disk device. Currently supported filesystem or partition types include BeOS, BtrFS, FreeBSD/NetBSD/386BSD disklabel, Linux Ext2, MS-DOS FAT12/16/32, IBM OS/2 HPFS, Linux LVM/LVM2, Linux swap, Minix, MS Windows NT/2000, QNX 4.x, ReiserFS 3.5.X, Sun Solaris on Intel, and Silicon Graphics journaled filesystem.
Gpart is useful in recovery actions and forensics investigations.
How It Works
Gpart scans PC-type hard disks to guess partition tables by analyzing sector data for supported filesystem and partition types. It performs a guessing loop to identify primary and logical partitions, optionally using specified disk geometry, sector sizes, and scan limits. It supports writing guessed tables back to files or devices after analysis.
Installation
sudo apt install gpartFlags
Examples
gpart --helpgpart /dev/sdagpart -b backup.mbr /dev/sdagpart -c /dev/sdagpart -f /dev/sdagpart -v /dev/sdagpart -W /dev/sda /dev/sda