On a non GPT partition table I can do

sfdisk -d /dev/sda | sfdisk /dev/sdb.

But sfdisk doesn’t support GPT partition tables. What can I use instead?

Install gdisk which is available in the Ubuntu Universe repositories.

Then use the sgdisk command (man page here) to replicate the partition table:

sgdisk -R /dev/sdY /dev/sdX
sgdisk -G /dev/sdY

Before making any destructive changes, be sure to take a backup with: sgdisk –backup=/some/safe/location/sdX.gpt /dev/sdX and sgdisk —
backup=/some/safe/location/sdY.gpt /dev/sdY

dd if=/dev/sda of=GPT_TABLE bs=1 count=A
dd if=GPT_TABLE of=/dev/sdb bs=1 count=A
partprobe /dev/sdb
where A is:

B=parted -ms /dev/sda print |tail -1|cut -b1

I just tried replication with sgdisk and it works just fine – you just have to follow readline syntax rules:

sgdisk –replicate=/dev/target /dev/source

sgdisk -R/dev/target /dev/source
and everything works.