With hexdump, I can see the binary content of the master boot record, for example. Similarly, I want to see what my gpt looks like. Is it located in EFI System Partition somewhere? I have only found different .efi files, and no hint for anything that would be called something like partition table.


The partition table cannot be located in a partition, because it describes where partitions are. Instead, it is located at a fixed disk location outside any partitions and usually does not have any file representation. You said you were looking at the disk's "master boot record" previously – you will need to use the same method to look at the GPT as well.

The MBR is located in the 1st sector of the disk (LBA 0); even GPT disks still have a "protective" MBR in this sector. (The first 440 bytes of the MBR are used to store boot code, but the remaining 72 bytes hold partition entries, so you actually were looking at a partition table already.)

Similarly, the GPT starts at the 2nd sector of the disk (LBA 1) where its header is located, followed by approx. 32 more sectors (16 KiB) containing the actual partition list. (Longer GPTs are possible but probably rare.)

The methods used to read raw disk sectors are OS-dependent, but the following tools can be useful on Linux specifically:

# head -c 512 /dev/sda | hexdump -C
# dd if=/dev/sda bs=512 skip=1 count=33 | hexdump -C
# xfs_io -r -c "pread -v 512 16896" /dev/nvme0n1

Note that the precise location of the primary GPT depends on the disk's logical sector size – most disks use 512-byte sectors, but if it's a "4K native" disk, then the GPT will also start at byte 4096, not at byte 512. Adjust the commands accordingly. (You'll know you've found it if the data starts with EFI PART in ASCII.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.