Score:0

mdadm how to use an array as a "member disk" in another array

se flag

I HAD a 4-disk RAID 5 array with MDADM. One of the disks failed. I bought a new disk three times the size of original disks as replacement.

I now have

  • 3x5TB disks in a degraded RAID5
  • 1x16TB disk free unused

I want to change the existing raid from 5 to a-sort-of 1+0 where only the old disks would be the "0" part:

  • 3x5TB disks in RAID0
  • 1x16TB disk

The above would be assembled in the RAID 1 I want to end up with.

I'm thinking I should:

  • add the new disk in a new, degraded, RAID 1
  • copy all the data from the degraded RAID 5
  • change mount points to the new array
  • tear down the RAID5 and make a RAID0 from it
  • add the RAID0 to the RAID1

Alternatively, as a fallback I could replace the last step with creation of a btrfs RAID 1 volume.

Could this work?

Score:1
za flag

Yes, this should work. But there is better way to achieve something like this.

If you ever wondered how RAID10 or RAID60 are built, it's like this: system builds a number of small RAID1 or RAID6 arrays and then combines them into large "RAID0" array. Not vice versa, like having many RAID0-s mirrored or assembled with additional parity devices.

To achieve similar setting, do the following:

  • Partition large disk to three partitions, each to be equal the size of a single partition of smaller disk,
  • Make "degraded" RAID1 arrays out of each partitions, like mdadm --create /dev/mdN -l1 -n2 /dev/sdXY missing
  • Make them LVM PVs pvcreate /dev/mdN and build LVM VG out of these three PVs vgcreate my_vg /dev/mdN /dev/mdM /dev/mdP,
  • Create logical volumes as needed, migrate data, remove old array
  • Repartition smaller disks to have a single partition and add each disk into its RAID1s

This way you:

  • avoid MD over MD (which could be assembled by hand, but I am not sure it will assemble automatically on boot)
  • introduce LVM, which improves volume management; the LVM over MD is very standard and supported configuration
  • when one of smaller disks die, you'll replace it and only resync that part; if you went the "raid1 out of raid0" way, you'd to sync the whole data.

This last argument actually describes why the redundancy is always done on the lowest level and combining of these smaller redundant pieces (stripes) is given to the higher levels.

velis avatar
se flag
Just so we're clear on this: I think dividing up the big disk into small partitions and then RAID0-ing them places a bit of stress on said disk, I would think. For this particular use case I don't think it's a good approach. But I DID think of using something else for second-level. LVM seems fine (I'm using it on existing array). I'm also thinking maybe I could use the controller itself, it can do RAID 0 -1 just fine. But I DO agree with your point that a small disk failure in RAID0 would mean entire array going away, not just the single disk.
Nikita Kipriyanov avatar
za flag
I've actually done this myself, the system works and it is smart enough to order accesses properly. Synology DSM could employ this approach; its SHR ("hybrid RAID") mode implements exactly same idea. To stress the big disk less you may set its parts in RAIDs into "write-mostly" mode, so it wouldn't be used for reads until the corresponding small disk dies. See MD RAID manual about this.
velis avatar
se flag
Perhaps this is true. It definitely ticles me in the right places. I think I'm going to spin up a VM, test this, see what happens. Thanks for your effort, you've been most helpful
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.