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.

Sabya
  • 746
  • 3
  • 9
  • 22
  • 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 '12 at 14:55

3 Answers3

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.

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • 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 '12 at 05:03
  • Did you let the reshape operation finish? – Shane Madden Apr 24 '12 at 05: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 '13 at 07: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.

adaptr
  • 16,479
  • 21
  • 33
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.

Jeff Ferland
  • 20,239
  • 2
  • 61
  • 85