In Linux, how do you delete the partition table from a disk?

7,370

You can just write some zeros to the first sector of the disk in question, for example you want to erase partition table of sda:

dd if=/dev/zero of=/dev/sda bs=512 count=1  

That would fill first 512 bytes of the disk with zeros, and in effect erase the partition table.

Share:
7,370

Related videos on Youtube

Bender the Greatest
Author by

Bender the Greatest

Husband, father, engineer, musician, and retrocomputing-enthusiast

Updated on September 18, 2022

Comments

  • Bender the Greatest
    Bender the Greatest almost 2 years

    In Linux, how would I go about removing the GPT or MBR partition table on a disk? To be clear, I don't want to immediately format with a new partition table, I want to be able to remove the partition table completely.

  • sawdust
    sawdust over 7 years
    You have the block size and count numbers swapped.
  • SparedWhisle
    SparedWhisle over 7 years
    yeah. but I think either way should work, only bs=512 is better?
  • sawdust
    sawdust over 7 years
    If you're convinced that your original answer is good, then you should have left it alone.