Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command can I run to erase all partitions that exist, and then create one new one?

share|improve this question
Does overwriting the partition table suffice for you? And what kind of partition table do you need? (msdos, GPT, etc.) – gertvdijk Sep 13 '12 at 15:53
Yes ideally I'd like to erase all partitions and start over with one new partition. Not sure which table I need. I'm using a chromebook. Messed up my partitions and want to start from scratch. thanks! – d-_-b Sep 13 '12 at 15:54
up vote 4 down vote accepted

Just use fdisk for old-style non-GPT partition tables - it's the easiest. Follow a how-to like this one.

Bonus for batch operations or restoring later

Just because I already wrote this before the second comment on the question was written.

For regular non-GPT partition tables I can recommend using sfdisk for scripted partition a device. This is also particularly useful for partitioning a batch of similar disks identically.

From the manpage of sfdisk:

  sfdisk has four (main) uses: list the size of a par‐
  tition, list the partitions on a device,  check  the
  partitions  on  a  device,  and  -  very dangerous -
  repartition a device.

  sfdisk doesn't understand the GUID  Partition  Table
  (GPT) format and it is not designed for large parti‐
  tions.  In these cases use  the  more  advanced  GNU

And use it like this:

  1. Dump partition table of /dev/sda to table-sda.sfdisk

    sfdisk -d /dev/sda > table-sda.sfdisk
  2. Overwrite (dangerous!) the partition table of /dev/sdb using table-sda.sfdisk

    sfdisk /dev/sdb < table-sda.sfdisk
share|improve this answer
Thanks so much! I'll check this out later tonight. A colleague of mine mentioned fdisk so I have a feeling this will work. Thanks again!! – d-_-b Sep 13 '12 at 16:10
So just to clarify and explain why I'm doing this: I have a chromebook and 'accidently' deleted an important partition, rendering my chromebook semi-useless (i cant every have updates to the OS). I'd like to completely erase everything and just make one partition for ubuntu as big as the hard drive allows...Is fdisk the right path I should take? Thanks so much for your help! – d-_-b Sep 14 '12 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .