Everything you need to know about a partition, types of partition, partition scheme
To clear a partition table, wipefs command can be used
Here I have a disk /dev/sdb which I have added to my Linux box for this article.
In this disk I have created two primary partitions
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x1410600c
Device Boot Start End Blocks Id System
/dev/sdb1 2048 4196351 2097152 83 Linux
/dev/sdb2 4196352 10487807 3145728 83 Linux
Now I would like to clear the partition table from this disk
To do so below commands can be used
Check the partition table
offset type
----------------------------------------------------------------
0x1fe dos [partition table]
Here I have a dos partition table
Clear the partition table
Using the below command you can wipe "dos" partition table
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioclt to re-read partition table: Success
If I had a GPT partition table then to clear the same
To clear all the partition tables
You can also delete a partition table using the offset value as shown above
Once the above command returns success, check the partition table using fdisk
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
As you both my partitions are cleared/deleted.
I hope the article was useful.