[TriLUG] how big and where is the GPT

Aaron Joyner aaron at joyner.ws
Mon Jul 28 00:26:11 EDT 2014


I haven't played with GPT much, so I was eager to see where this thread
went, and read up some if time allowed.  Gregory's assertions do seem to
align with the Wikipedia description of GPT:
http://en.wikipedia.org/wiki/GUID_Partition_Table

The image on that page is a most excellent and concise summary of the
information you want, but I'd suggest the relevant text commentary from the
page would be:
----- 8< snip 8<-----
The header contains the disk globally unique identifier (GUID). It records
its own size and location (always LBA 1!) and the size and location of the
secondary GPT header and table (always the last sectors on the disk).
----- 8< snip 8<-----

More reading of that page is required to understand the intricacies of why
blocksize might be 512 or 4k, but suffice to say that the blocksize
presented by the disk determines how large the headers are, so you should
look to see what it is.  You can easily check with lsblk or hdparm:
$ lsblk -o NAME,PHY-SeC
$ sudo hdparm -I /dev/sda | grep -i physical

To rephrase the answer into my own words, if you want to smash the GPT from
a disk, you need to wipe out the headers which are used to determine
there's a GPT on the disk.  These are stored as the first 2 blocks and the
last block on the disk.  That's pretty straightforward with dd, if you know
the LBA blocksize and the size of the disk expressed in those terms:
$ dd if=/dev/zero of=/dev/your_disk bs=<blocksize, see above> count=2
$ dd if=/dev/zero of=/dev/your_disk bs=<blocksize, see above> count=1
oseek=<((size of disk in bytes / <blocksize>) - 1)>

Please use caution determining the value of oseek correctly, or you'll be
writing a small patch of zeros to some random part of the disk with
potentially unknown consequences.

Let us know how it goes!
Aaron S. Joyner


More information about the TriLUG mailing list