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:
- Get the blocksize of the device. fdisk -s /dev/[HDDNAME]
- Round the last five digits of the size to zeros. For example, with block size 156290904, you get 156200000
- Zero out the last 1 000 000 blocks. dd if=/dev/zero of=/dev/[HDDNAME] bs=1k seek=[ROUNDEDSIZE]
- Zer0 out the first 20 000 blocks. dd if=/dev/zero of=/dev/[HDDNAME] bs=1k count=20
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).
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