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

Mon Nov 23 18:12:06 UTC 2020
centos at niob.at <centos at niob.at>

On 23/11/2020 17:16, Ralf Prengel wrote:
> Backup!!!!!!!!
>
> Von meinem iPhone gesendet

You do have a recent backup available anyway, haven't you? That is: Even 
without planning to replace disks. And testing such strategies/sequences 
using loopback devices is definitely a good idea to get used to the 
machinery...

On a side note: I have had a fair number of drives die on me during 
RAID-rebuild so I would try to avoid (if at all possible) to 
deliberately reduce redundancy just for a drive swap. I have never had a 
problem (yet) due to a problem with the RAID-1 kernel code itself. And: 
If you have to change a disk because it already has issues it may be 
dangerous to do a backup - especially if you do a file based backups - 
because the random access pattern may make things worse. Been there, 
done that...

peter

>> Am 23.11.2020 um 17:10 schrieb 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
>>
>>