Use this when you’ve utterly cocked up partitioning a disk and would simply like to start fresh without any old partition tables of any kind, whether they’re GPT or MBR. There is no data on the disk at this point, so the question of data loss should be moot. Still, since we’re only playing with partition tables, you can recover your old partitions if your job, life, or credit rating depended on it.
First, doubly verify that the disk you are planning to do this to is the correct one.
$ lsblk
Once you know that you have the right disk, make sure it’s not mounted.
In this example, I’m going to assume that the disk is /dev/sdb
.
$ sudo umount /dev/sdb
Now, just zap all partition tables using the sgdisk
command from the gptfdisk
package.
# sgdisk --zap-all /dev/sdb
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
The operation has completed successfully.
Further reading
The author’s webpage, particularly, this section is a good place to start.