It's common problem you will have to deal with when you replace a disk in a Linux software array. The first step is always to prepart the partition table after you replaced the bad disk.

Here is just a quick steps:

Copy the partition created by fdisk

Copy the partition table from sda --> sdb

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

copy the partition table created by parted

Copy the partition table from sda --> sdb

sgdisk -R /dev/sdb /dev/sda  # copy sda partition table to sdb
sgdisk -G /dev/sdb # Randomizes the GUID on the disk and all the partitions

Note: not like sfdisk, the disk sda is the disk you want to copy the partition table from.

sgdisk is in the gdisk package which is available in most of linux distributions.

 

That's it!