Migration from RAID1 the RAID5 turned out to be much easier than I thought 🙄 are broadly 5 simple steps a little waiting and 1 a beer for courage.
To me the system has created RAID array md0 involving 2 disk sda and sdb. I'll add to them the 3rd sdc to create the RAID5 3 disc. Generally this is for scientific purposes, the acrobatics of virtualka I have not yet tested in real environment, but don't expect dramas and the real time machine.
- Create the same file system layout as other drives us – sfdisk -d /dev/sdb | sfdisk /dev/sdc
- Build upon our current array of RAID5 – mdadm –grow /dev/md0 –level=5
- Add the new disk to the array – mdadm –manage /dev/md0 –add /dev/sdc . Here comes the thin point that the array is still going to be RAID1 and won't start sync because the new disc is spare
- The most important moment sdc becomes active and starts the synchronization – mdadm –grow /dev/md0 –raid-devices=3 . A good time to open the beer if not done 😉 stay in no case process!!!
- Once completed the synchronization stuck to resize the partition because the loss of space in 1/e RAID1 and RAID5 for n e 1-1/n
The big bonus is that you don't have a system restart or pulling and making additional arrays.
sfdisk -d /dev/sdb | sfdisk /dev/sdc mdadm --grow /dev/md0 --level=5 mdadm --manage /dev/md0 --add /dev/sdc mdadm --grow /dev/md0 --raid-devices=3 resize2fs /dev/md0
Good night 😛