Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

I'm looking for a one or two command solution, not just using GNU parted to output the partition sizes and then manually making them again.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Install gdisk which is available from sourceforge as well as from the Ubuntu Universe repositories.

Then use the sgdisk command (man page here) like so

sgdisk -R=/dev/sdb /dev/sda
sgdisk -G /dev/sdb

The first command copies the partition table of sda to sdb (be careful not to mix these up). The second command randomizes the GUID on the disk and all the partitions. This is only necessary if the disks are to be used in the same machine, otherwise it's unnecessary.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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