Lvm – Hybrid RAID with LVM + mdadm

lvmraid

So I've been looking Synology and their idea of Hybrid RAID to make mixed drive RAID arrays both fault tolerant and efficient.

So, I'm testing an idea (performance isn't a concern here), with a mixed array of

  • 2x 2TB
  • 1x 250GB

I was thinking that if they were partitioned into half the size of the lowest denomination – that combining RAID with LVM could yield a redundant FS spanning 3 disks (or more) efficiently.

|     250GB     |   |       2TB      |   |       2TB      |
|---------------|   |----------------|   |----------------|
| 125GB | 125GB |   | 1.87TB | 125GB |   | 1.87TB | 125GB |
| sda1  | sda2  |   | sdb1   | sdb2  |   | sdc1   | sdc2  |
    |       |           |       |            |        |
    |       |           |       |            |        |
    |-------|-----------|-------|            |        |
            |    0      |                    |        |
            |----0------|--------------------|--------|
                 0      |       1            |
                 0      |-------1------------| 
                 0              1  2
                md0           md1  md2


md0 = 125GB  + 125GB
md1 = 125GB  + 125GB
md2 = 1875GB + 1875GB

    = 2125GB Spanned RAID1 storage

So then, create a volume group on LVM comprising of physical volumes md0, md1 and md2 – then just create logical volumes on top.


In theory – this is completely fine – and I'm aware the'll be performance impacts (this isn't a concern).

So the next evolution is to be able to be add a disk of any size – and for it to do the maths automatically.

But where I'm hitting a small wall is how you would keep chopping up the primary disk partitions – on disks running active VG's

Ie. If you added a 500GB disk to the example above – it would require 2x 250GB partitions to be created on any of the other disks (or 2x 125 and 2x 250 – but lets not get into complications),

Its not like you can fdisk a running LVM volume group, take a 1875GB primary partition, then create a 1625GB and 250GB partition, set up the RAID array, then add them back to the existing volume group.

Best Answer

There doesn't seem to be an actual question, but here are some thoughts:

  • This is only worthwhile if your time is valueless; otherwise, just buy another 2 TB hard disk, make them a 3-drive RAID 5 set and quit messing about.
  • If it were possible to grow software RAID 10 volumes under Linux, that would solve your issue, since you could just add the drive and it would sort it out. Unfortunately this doesn't seem to be the case (at least on the mdadm & md version on my system). But if you didn't care about growing the array, RAID 10 is definitely a better answer than your setup above.
  • And finally, there isn't really any way to add the 500 GB drive you mention without a lot of manual data movement. To accomplish it you could (but i wouldn't):
    • create 2 x 125 and 1 x 250 on the new drive (let's assume they're sdd1-3)
    • move sda1 to sdd1: add sdd1 to md0; change number of copies to 3; wait for resync; remove sda1 from md0; change number of copies to 2
    • repeat for sda2 -> sdd2 (md1)
    • remove sda2, resize sda1 to 250 GB
    • create md3 from sda1 and sdd3
    • add md3 to your volume group

Hope that makes sense.

Side note:

  • Dear HP, AutoRAID arrays were the best thing since sliced bread. Bring them back.
Related Topic