LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Growing Raid 1 (but reducing disks) (https://www.linuxquestions.org/questions/linux-software-2/growing-raid-1-but-reducing-disks-4175687316/)

jnoake 12-23-2020 01:51 AM

Growing Raid 1 (but reducing disks)
 
Hi,
I have:

Raid 0 MD2 |--------------5Tb---------------|
on
Raid 1 MD0 |----2Tb---|
Raid 1 MD1 |-------3Tb--------|


MD0 = sde, sdf (2Tb each)

MD1 = sdc, sdd (3Tb each)


I want to migrate the Raid 0 MD2 volume data onto a 10Tb raid 1.


sda, sdb (10Tb each)


Can I achieve this using the raid rebuild tools so that I end up with:

Raid 1 MD0 |--------------------------10Tb----------------------|

MD0 = sda, sdb (10Tb Each)


MD1 = (gone)

MD2 = (gone)



, or would it be necessary to create a new raid1 and then rsync the Raid 0 MD2 volume to it.


Raid 1 MD3 |--------------------------10Tb----------------------|
rsync ^

Raid 0 MD2 |--------------5Tb---------------|


Does that make sense?

syg00 12-23-2020 02:32 AM

I was about to say this should be reasonably straight-forward - if time consuming. However the RAID wiki page titled "A_guide_to_mdadm" states thus:
Quote:

Raid-0 can be converted to raid-10, or to raid-4/5/6.
You might need to investigate further before proceeding.

berndbausch 12-23-2020 02:48 AM

This is a weird setup, and I don't quite understand. RAID 0 is striping, which means that half of md2's data resides on md0 and md1, respectively. You can convert md0 to a four-disk array, then remove the two smaller disks (see below), but this will only give you half of the striped data. Am I missing something?

EDIT: I do wonder how much time you'd save by growing a mirrored array vs. just rsync'ing the filesystem. Not so much, perhaps?

According to the kernel.org RAID wiki:
Quote:

Raid 1 stores identical copies across all drives. As such, this has the simplest procedure for adding and removing drives. When a new drive is added, the data is copied across from one of the existing drives. When removing a drive, the drive can simply be deleted from the array.
EDIT2: svg00's quotation comes from the same Wiki page.

jnoake 12-23-2020 04:42 AM

Quote:

Originally Posted by berndbausch (Post 6198858)
This is a weird setup, and I don't quite understand...


I started with the 2Tb and got the additional 3Tb disks later. I wanted a single mountpoint for the whole 5Tb and the raid 0 did the job.


I was hoping for a response that would have given me a straightforward way, time is not really the issue.
If it could have been a case of banging the 10Tb in , adding it to the existing raid somehow and just letting it get on with it, followed by the 2nd 10 for the mirror and removing the previous four, that would have been cool with little or no downtime.


Given the answers so far it seems that I would be better creating a new raid1 and rsync'ing, that is just a pain since it has to be rsync'ed with the OS services paused to prevent losing changes - that could take half a day downtime and then putting it in place of the existing raid0, fstab edits etc.
Can't just add the 10's and extend as I am out of sata ports.

berndbausch 12-23-2020 05:21 AM

I misunderstood this, and of course I did not know your SATA port limitation.

First, you can remove one drive from each mirror, e.g. sdc and sde, thereby making room for attaching the new drives. The mirrors should continue to function with a single disk each.

After that, personally I would create a new RAID md3 from the two new disks and rsync the data from md2 to md3.

Or build another RAID1 (let's call it md4) on top of md2 and md3, then let the md driver perform the synchronization, then remove md2. Not sure if the now degraded md4 can be undone after that. That's why the rsync method seems safer.

Another thought: Build md3 on a different system and rsync the data over the network.

jnoake 12-23-2020 06:59 AM

Quote:

Originally Posted by berndbausch (Post 6198905)
I misunderstood this, and of course I did not know your SATA port limitation.

First, you can remove one drive from each mirror, e.g. sdc and sde, thereby making room for attaching the new drives. The mirrors should continue to function with a single disk each.

After that, personally I would create a new RAID md3 from the two new disks and rsync the data from md2 to md3.

Or build another RAID1 (let's call it md4) on top of md2 and md3, then let the md driver perform the synchronization, then remove md2. Not sure if the now degraded md4 can be undone after that. That's why the rsync method seems safer.

Another thought: Build md3 on a different system and rsync the data over the network.


Thank you, this is the advice I needed.


All times are GMT -5. The time now is 11:59 PM.