Skip to main content

Copy the partition table from one disk to another

Sometimes it is neccessary to copy the partition-table of one disk to another. Mostly this is needed when a disk should be replaced on a software-raid-array. The method described here also works for GPT-Tables.

Method for GPT Tables

Backup the table of /dev/sda

sgdisk --backup=table /dev/sda

Restore the table to the new disk

sgdisk --load-backup=table /dev/sdb

Backup and Restore from /dev/sda to /dev/sdb in one command

sgdisk -R /dev/sdb /dev/sda

Finally randomize the GUID of all partitions on the disk

sgdisk -G /dev/sdb

Method for MBR-Tables

Copy table from /dev/sda to /dev/sdb

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

If you don't see the partitions, read it again (Optional)

sfdisk -R /dev/sdb