Autor: Simon Fecha: A: Devuan ML Asunto: Re: [DNG] [OT] Help on change (split) partitions of an md raid
Thinking a bit more about this, there is another way to do it which may be useful if your backup is on slow media (such as a USB-2 drive) :
1) On md2, fail one drive (I’ll use drive 2 here), then remove it from the array, then remove the raid metadata from it (three md commands that I wouldn’t even try and recall from memory !)
You now have your data still on drive 1 in the original md2 array which now only has one drive in it (and hence no redundancy).
2) delete drive 2 part 2, create new parts 2 & 3 on drive 2
3) create a new md2 array (it needs to have a different name). You need to explicitly tell it two drives and there’s an option to say a drive is missing. Ditto with a new md3 array.
You now have your new arrays set up. You can mount them wherever you want so you can copy your data to them.
4) Copy your data from the original md2 with your preferred tool - some prefer cp, I prefer rsync, some will use mv, some will …
You now have your data on the new arrays.
5) unmount and stop the original md2, and remove the raid metadata from drive 1 part 2
6) delete drive 1 part 2, create your new partitions to match those on drive 2
7) Add the new partitions to the relevant arrays. md will now rebuild the array by copying data from the existing partition to the one just added. You can check progress with cat /proc/mdstat. You can also use the arrays while they are rebuilding, but system performance is degraded (there’s tuning options if that’s a problem, but generally it isn’t).
8) Unmount your new arrays from their temporary locations, and mount them where they should be. Update stab, and rebuild your initramfs.
I leave reading of the man pages as an exercise for the curious :D