The old MBR 512 bytes partition table is no longer valid if you are using GPT.
To copy a GPT table with dd to another disk do it like so:
Below sda is the source disk and destination disk is sdb (change to meet your needs).
Depending on how you use this, you have to be careful. The assumption is that you should only dump the partition table back to a disk you will newly format. If not you'll need to check the exact location where the partition table ends, otherwise you'd overwrite some data on the first partition. This should not be a problem if you are just dumping the first 33 sectors as I show here, but be careful still.
Normally the way I show below SHOULD be OK as most GPT partitions I've seen installed by Windows or Linux show that the gpt table's final sector ends at 33, which means my final calculation and dd command SHOULD work but you should always double check that your partition table backup looks the same as the original disk.
If you blindly copy my command, this also assumes that your sector size is 512 bytes per sector.
gdisk -l /dev/sda
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk part-table-second.img: 2048 sectors, 1024.0 KiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 6BC0607D-3981-4A24-A7DF-5106B48DA0A1
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1000215182
Partitions will be aligned on 2048-sector boundaries
Total free space is 6933 sectors (3.4 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 206847 100.0 MiB EF00 EFI system partition
2 206848 239615 16.0 MiB 8E00 Microsoft reserved ...
3 239616 998008663 475.8 GiB 0700 Basic data partition
4 998008832 999167999 566.0 MiB 2700
5 999170048 1000212479 509.0 MiB 2700
We can see above that it says the partition table begins at sector 2 and ends at sector 33.
This would mean that we should backup using this calculation:
sector size * ending sector of partition table
To be lazy we'll say 33 sectors * 512 bytes/per sector = 16896 bytes
This would mean our backup amount would be 16896 bytes.
dd if=/dev/sda of=sda-gpt-partition-realtechtalk.img bs=16896 count=1
You can restore it like this:
dd if=sda-gpt-partition-realtechtalk.img of=/dev/yourdrive
Another fool proof way of checking if your partition table backup is good is to do a gdisk -l on the .img you dumped and compare to the actual /dev/sda, they should be the same. If not you've made a mistake.
linux, gpt, partition, ddthe, mbr, bytes, valid, dd, disk, sda, destination, sdb, dev, bs, img,