sfdisk

Scriptable partitioning

high risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
Safer / dry-run alternatives
sfdisk -d <dev> > <dev>.ptBack up first
What it does

Dump/restore partition tables. See the flags and examples below, and run `man sfdisk` for the full reference.

Common flags
FlagMeaning
-dDump
--no-reread --no-rereadSkip kernel reread
Examples
sfdisk -d /dev/sda > sda.ptBack up the table · explain & risk-check →
sfdisk /dev/sdb < sda.ptRestore (overwrites!) · explain & risk-check →
Related
fdisk
Open the full explainer →More in Disks & Filesystems

Reference text is hand-written and may be incomplete — check man sfdisk for your version. Test destructive commands on a non-production system first.