When using GPT you can use sgdisk to copy the partition table.
FROM="/dev/sdX" TO="/dev/sdY" sgdisk $FROM -R $TO sgdisk -G $TO
This will copy the partition table over and set random GUID on the partitions on the destination device.
When using MBR you can use sfdisk to copy the partition table.
FROM="/dev/sdX" TO="/dev/sdY" sfdisk -d $FROM | sfdisk $TO