Skip to Content

Copy GTP partiotion table between disks

When configuring RAID it’s quite important to have the same partition tables on every disk. I’v done this many times on msdos partition tables like this:

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

but it’s not working any more on GPT partition tables. Hopefully it still can be done but with different toolstack 😄

Install gdisk:

apt-get install -y gdisk

Then use sgdisk like this:

sgdisk -R /dev/sd_dest /dev/sd_src
sgdisk -G /dev/sd_dest

First command will copy partition from /dev/sd_src to /dev/sd_dest. Second will randomize partition UUID’s - needed only if you want to use disks in same machine (this is my case).

comments powered by Disqus