copy partition table from one disk to another

When replacing a failed disk in a RAID 1 array, it’s necessary to get the new disk setup properly with an identical partition table matching the existing disk. In this case sda has failed and has been replaced with a spare. To copy the partition table from sdb to sda do this:

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

Make absolutely sure you know which disk is which, otherwise you will blow out the good partition table on the running disk, with whatever is on the spare (probably no partition table at all).

share: