How do I copy the partition table from disk to disk?


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
Tags: copy, gpt, mbr, partition table, sfdisk, sgdisk
Last update:
2016-10-23 13:00
Author:
Chris Burton
Revision:
1.0
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags