Posted on

How to remove GPT partition table in Linux

I have an USB stick device which has an HFS volume with GPT partition table. I want to write an iso image to the stick with:

$ sudo dd if=debian-8.2.0-amd64-CD-1.iso of=/dev/sdb bs=8M

Command completed successfully but when I re-insert usb stick, it still tries to use information from GPT partition table.

So, I used gdisk utilitiy’s zap (destroy) GPT data structures option to remove GPT partition like below:

sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.10

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): x

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

After that I created a new DOS partition through fdisk and write iso image with dd. However, when I try to reinsert USB stick, it still identified with old information (as an hfsplus volume) in kernel:

GPT:Alternate GPT header not at the end of the disk.
GPT:1390003 != 15654847
GPT: Use GNU Parted to correct GPT errors.
sdb: sdb1 sdb2 sdb3
sd 13:0:0:0: [sdb] Attached SCSI removable disk
ISOFS: Unable to identify CD-ROM format.
hfsplus: invalid secondary volume header
hfsplus: unable to find HFS+ superblock