4

I have created a raid10 array using mdadm. Metadata version is 1.2. I want to convert this to a raid0 array, is it possible?

P.S. I am having terabytes of data, I want to avoid copying the data over.

1
  • 2
    If you can't afford to copy your data, are you sure that RAID-0 is the correct choice? A four disk RAID-0 has an extremely high likelihood to fail, and when it does you lose everything.
    – Zoredache
    Apr 16, 2012 at 14:55

3 Answers 3

5

Yes.

As of mdadm version 3.2.1, and running a "suitably recent kernel" (whatever that means, I'd guess at least 3.0), a reshape from RAID10 to RAID0 is possible. This means a pretty recent Linux distribution; the system that you're running on may need an upgrade, or you may need to temporarily boot to a live CD type of environment with newer tools to do the conversion.

To make the change, it'll be something along these lines:

mdadm /dev/md0 --grow --level=0
resize2fs /dev/md0

And do keep in mind the caveats that have been mentioned. Running anything on RAID0 is incredibly risky; you will see a failure eventually.

3
  • I tried this. It converted the array easily. But when I rebooted. The system failed to boot up. I am in AWS.
    – Sabya
    Apr 24, 2012 at 5:03
  • Did you let the reshape operation finish? Apr 24, 2012 at 5:29
  • Hi Sabya. I'm guessing you put the mounting in fstab right? If it's the case, what I do is that I do the mounting manually because in EC2 when the system can't mount the EBS drives it won't start SSH service either. So either find a script to mount the drives after SSH or do it manually.
    – Maziyar
    Aug 30, 2013 at 7:28
3

No.

What you CAN do is remove the mirrors from the RAID-10 array, make those new spares into a new RAID-0 array, move all data over, and then add the remaining drives to the new RAID-0 array.

If mdadm supported growing RAID-0 arrays. Which it doesn't.

Switch to LVM instead.

0

Well, that's what I get for trying to answer with a complicated theoretical scenario without having a VM handy to test it on. It's just not going to happen... but the comments below are good explanation and maybe worth saving.

Yes, you can. It's ugly, not easy, and prone to really screwing it up, but...

See this answer on Superuser.com for the gist of things. You should fail two drives out of your array, but make sure that they are the correct two drives. Do this with the system in read-only mode so that if you fail the wrong drives out in software you can restore them back and try again.

Once you've failed those drives, mark them into a new RAID 0. You can't grow a RAID 0, so when you initialize it you'll need to initialize all four drives at once (you could do two then two more, but it must have all four to start). You'll need to make sure that the first two drives you add in are in the right order and not the mirrored pair.

Again, do everything in read-only mode first to test that this works and you have the right drives in the right order first.

5
  • RAID-0 cannot have missing members. It will not start.
    – adaptr
    Apr 16, 2012 at 14:00
  • @adaptr Adjusted to late-start it or to just load all four when the system is offline. Apr 16, 2012 at 14:29
  • Except that won't work either. RAID-0 stripes data across all drives simultaneously, so you cannot construct one with only 2 drives containing data.
    – adaptr
    Apr 16, 2012 at 14:30
  • @adaptr Dammit, you're right. Apr 16, 2012 at 14:33
  • In fact, my proposal to use LVM is moderately safe if he mounts the degraded RAID-10 read-only; whatever you do, don't ever mount a degraded array read-write!
    – adaptr
    Apr 16, 2012 at 15:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .