11

I've got an USB pen drive and I'd like to turn it into a bootable MBR device. However, at some point in its history, that device had a GPT on it, and I can't seem to get rid of that. Even after I ran mklabel dos in parted, grub-install still complains about

Attempting to install GRUB to a disk with multiple partition labels.  This is not supported yet..

I don't want to preserve any data. I only want to clear all traces of the previous GTP, preferably using some mechanism which works faster than a dd if=/dev/zero of=… to zero out the whole drive. I'd prefer a termina-based (command line or curses) approach, but some common and free graphical tool would be fine as well.

3 Answers 3

15

If you don't want to fiddle with dd, gdisk can do:

$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): ?
b   back up GPT data to a file
<snip>
w   write table to disk and exit
x   extra functionality (experts only)
?   print this menu

Command (? for help): x

Expert command (? for help): ?
a   set attributes
<snip>
w   write table to disk and exit
z   zap (destroy) GPT data structures and exit
?   print this menu

Expert command (? for help): z
About to wipe out GPT on /dev/sdb. Proceed? (Y/N): Y
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): Y

Verify:

$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): 
0
5

You could do it with wipefs:

wipefs can erase filesystem, raid or partition-table signatures (magic strings) from the specified device to make the signatures invisible for libblkid. wipefs does not erase the filesystem itself nor any other data from the device.

4

If you want a single command, instead of navigating interactive menus in gdisk, try:

$ sudo sgdisk -Z /dev/sdx

substituting sdx with the name of your disk in question. (obviously - don't wipe out the partition information on your system disk ;)

You must log in to answer this question.

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