Remove GPT and go back to MBR

Note: if you would like to perform this action from within Windows, take a look at the comments section for a guide.

First of all, I assume you have an empty harddrive, or you don’t care about your data on it. It would be foolish to rewrite MBR and partition information on a drive with something even remotely usable on it. You’re going to lose it!

With that out of the way, and assuming you have backed up your data, let’s start – we’re gonna do this labeling DOS-style!

First, if you have no idea what GPT is, take a look at this.

Unlike MBR, GPT resides both at the beginning and the end of a drive, thus providing redundancy in case you wipe the beginning of your drive. If you write MBR to the beginning drive, or even zero it out, it doesn’t remove GPT recognition from fdisk and other tools that detect GPT at the end. You have to zero out the end of the drive as well.

In order not to zero out the whole drive, we’ll just clear the  blocks used by GPT. Here’s the rundown:

  1. Get the blocksize of the device. fdisk -s /dev/[HDDNAME]
  2. Round the last five digits of the size to zeros. For example, with block size 156290904, you get 156200000
  3. Zero out the last 1 000 000 blocks. dd if=/dev/zero of=/dev/[HDDNAME] bs=1k seek=[ROUNDEDSIZE]
  4. Zer0 out the first 20 000 blocks. dd if=/dev/zero of=/dev/[HDDNAME] bs=1k count=20

GPT layout table

 

To make more sense of what we just did, here’s the GPT layout image, courtesy of Wikipedia.

Each LBA entry on the diagram represents 512 bytes.

The third command zeroes out the last million blocks from your drive, just to be safe. That means that 1 000 000 * 512 bytes = approximately 480MB are zeroed out.

Looking at the diagram, zeroing out the last 17408 bytes (34 LBA * 512 bytes) could also work, if you’re in a hurry.

The fourth command zeroes out the first 20000 bytes. Unlike MBR which uses only the first 512k, you can see that GPT is spread on 4 LBAs, each one is 512k size. That means you can also delete only the first 17408 bytes (34 LBA * 512bytes).

Note:

On newer drives, the block size could be as high as 4096 bytes. Adjust the bs parameter in the dd command accordingly.

Edit (Apr/13): Corrected drivers -> drives; Added comments info

Advertisements

3 thoughts on “Remove GPT and go back to MBR”

  1. Can do this from Windows, using the CMD: prompt. I just cleaned a disk used in my MacBook that I replaced and no longer wanted the original data. It had the GPT partition, this removes and cleans everything. Then you format the disk with NTFS

    The disk is Disk 1 on my system, and the GPT is indicated by the asterisk (*)

    Steps:

    From Windows Start Menu
    Run CMD
    (Now in a CMD window)

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:Usersadmin>diskpart

    Microsoft DiskPart version 6.1.7601
    Copyright (C) 1999-2008 Microsoft Corporation.
    On computer: NEWDELL

    DISKPART> list disk

    Disk ### Status Size Free Dyn Gpt
    ——– ————- ——- ——- — —
    Disk 0 Online 465 GB 1024 KB
    Disk 1 Online 465 GB 465 GB *
    Disk 2 Online 1397 GB 1024 KB
    Disk 3 Online 1863 GB 1024 KB
    Disk 4 Online 1863 GB 1024 KB
    Disk 5 Online 1397 GB 1024 KB

    DISKPART> select disk 1

    Disk 1 is now the selected disk.

    DISKPART> clean

    DiskPart succeeded in cleaning the disk.

    Now Exit from DiskPart and Exit from the CMD: prompt

    Start Run “compmgmt.msc /s”

    and select Disk Management to create the basic partition

    Then format it with NTFS

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s