[CentOS] Replacing SW RAID-1 with SSD RAID-1

Mon Nov 23 16:09:37 UTC 2020
centos at niob.at <centos at niob.at>

On 23/11/2020 16:49, Frank Bures wrote:
> On 11/23/20 10:46 AM, Simon Matter wrote:
>>> Hi,
>>> I want to replace my hard drives based SW RAID-1 with SSD's.
>>> What would be the recommended procedure?  Can I just remove one drive,
>>> replace with SSD and rebuild, then repeat with the other drive?
>> I suggest to "mdadm --fail" one drive, then "mdadm --remove" it. After
>> replacing the drive you can "mdadm --add" it.
>> If you boot from the drives you also have to care for the boot loader. I
>> guess this depends on how exactly the system is configured.
If you can the new disks while the original 2 disks are still available 
then grow, add, wait, fail, remove, shrink. That way you will never 
loose redundancy...

# grow and add new disk

mdadm --grow -n 3 /dev/mdX -a /dev/...

# wait for rebuild of the array

mdadm --wait /dev/mdX

# fail old disk

mdadm --fail /dev/sdY

# remove old disk

mdadm /dev/mdX  --remove /dev/sdY

# add second disk

mdadm /dev/mdX --add /dev/...

# wait

mdadm --wait /dev/mdX

# fail and remove old disk

mdadm --fail /dev/sdZ

mdadm /dev/mdX  --remove /dev/sdZ

# shrink

mdadm  --grow -n 2 /dev/mdX