Saturday, May 4, 2024
155
rated 0 times [  155] [ 0]  / answers: 1 / hits: 169630  / 2 Years ago, thu, september 15, 2022, 6:43:36

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.


More From » partitioning

 Answers
2

Install gdisk which is available in the Ubuntu Universe repositories.



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



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


The first command copies the partition table of sdX to sdY (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.


[#43795] Thursday, September 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingwhin

Total Points: 332
Total Questions: 112
Total Answers: 115

Location: Burkina Faso
Member since Tue, Apr 26, 2022
2 Years ago
;