X

How to remove a GPT partition table from HDD on Linux

Sometimes you might have to remove an existing GPT partition table from a hard disk. E.g. when you install another OS like Windows which can't cope with GPT partition records. Or, like in my case, when you want to add an HDD into a RAID where the other disks are using the traditional MBR partition table.

Install GParted

The tool to remove GPT on Linux is GParted. It can be installed on Ubuntu and Debian with the command:

sudo apt-get install gparted

And on CentOS with:

yum install gparted

Remove GPT partition table with GParted

The command-line program from GParted, which I will use here, is named gdisk. You run it on the command line by specifying the HDD device as a parameter, in my case the disk is the second hard drive /dev/sdb.

gdisk /dev/sdb

Here is the command sequence that I used, my input is marked in red.

server1:/home/tom# gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.1

Caution: invalid main GPT header, but valid backup; regenerating main header
from backup!

Caution! After loading partitions, the CRC doesn't check out!
Warning! Main partition table CRC mismatch! Loaded backup partition table
instead of main partition table!

Warning! One or more CRCs don't match. You should repair the disk!

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

Found invalid MBR and corrupt GPT. What do you want to do? (Using the
GPT MAY permit recovery of GPT data.)
1 - Use current GPT
2 - Create blank GPT

Your answer: 2

Command (? for help): ?
b back up GPT data to a file
c change a partition's name
d delete a partition
i show detailed information on a partition
l list known partition types
n add a new partition
o create a new empty GUID partition table (GPT)
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s sort partitions
t change a partition's type code
v verify disk
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
c change partition GUID
d display the sector alignment value
e relocate backup data structures to the end of the disk
g change disk GUID
h recompute CHS values in protective/hybrid MBR
i show detailed information on a partition
l set the sector alignment value
m return to main menu
n create a new protective MBR
o print protective MBR data
p print the partition table
q quit without saving changes
r recovery and transformation options (experts only)
s resize partition table
t transpose two partition table entries
u Replicate partition table on new device
v verify disk
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): n
MBR is unchanged. You may need to delete an EFI GPT (0xEE) partition
with fdisk or another tool.

In my case, I did not choose to blank out the MBR. You might want to choose "y" there when you install a new OS like Windows on this HDD.

Till Brehm:
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings