LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-14-2009, 07:25 PM   #1
jimbro727
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Rep: Reputation: 0
Migrate RAID0 array to RAID10 with mdadm


I just built a new system and had intended on running 4 identical drives in raid1+0, but one of the drives was bad, so to get the system up and running while I waited for a replacement, I created a raid0 array with two of the drives. I now have the replacement, and was wondering what the best way was to add the other two drives and migrate to raid1+0.

Conceptually, the two drives currently in a raid0 array just need to be mirrored in individual raid1 arrays - assuming I understand this correctly (I'm new to raid). I'm just not sure how to accomplish this with mdadm.

Thank you!

-Jimmy
 
Old 07-15-2009, 06:07 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.16.2
Posts: 1,571
Blog Entries: 13

Rep: Reputation: 182Reputation: 182
Well, it's funny you should mention that, because that's how I have my system configured, sort of. So hopefully I can help you.

Just to make sure we're all on the same page, please describe your raid0 setup.

Is it

(1) firmware raid relying on dmraid (usually on the mobo)?
(2) hardware raid seen by Linux as a regular drive?
(3) software raid using mdadm loaded from a separate boot drive?

And, we'll need to know your distro as part of the description, as raid setups vary slightly..
 
Old 07-16-2009, 01:15 AM   #3
jimbro727
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
Well, it's funny you should mention that, because that's how I have my system configured, sort of. So hopefully I can help you.

Just to make sure we're all on the same page, please describe your raid0 setup.

Is it

(1) firmware raid relying on dmraid (usually on the mobo)?
(2) hardware raid seen by Linux as a regular drive?
(3) software raid using mdadm loaded from a separate boot drive?

And, we'll need to know your distro as part of the description, as raid setups vary slightly..
Great!

I have both drives partitioned in to three parts. One for /boot, one for swap, and the rest for the root. Each partition is type fd. I have the boot partition in raid1 (which I didn't mention, because I'll just create the same partition structure on the two new drives and add the boot partition to the raid1 array). I have the swap partition in a raid0 array (I don't know what I'm going to do with that space on the two other drives - I didn't properly plan this out, I should have made the partition on each drive 1/4 of my total swap and put them all in to a raid0 array). Then the last partition is in a raid0 array.

I use mdadm with raid support built in to the kernel, here's the grub entry:
Code:
title Gentoo Linux 2.6.30-vanilla
root (hd0,0)
kernel /boot/kernel-2.6.30-vanilla root=/dev/md3
My distro is Gentoo and I'm using a vanilla kernel from kernel.org.

Let me know if you need any other info.

Thank you!
 
Old 07-17-2009, 10:13 AM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.16.2
Posts: 1,571
Blog Entries: 13

Rep: Reputation: 182Reputation: 182
Well, I would start by duplicating the disk structures of the previous disks with something like
Code:
sfdisk -d /dev/sda |sfdisk /dev/sdc
sfdisk -d /dev/sdb |sfdisk /dev/sdd
where sda, sdb are your current disk and sdc, sdd are the new disks. Obviously this locks you into your existing choices with your swap partition space sizes for now, but you can always change those partitions later.

Then I'd create the mirrors with something like
Code:
mdadm --create /dev/md4 ---level=0 --raid devices=2 /dev/sdc /dev/sdd

and

Code:
mdadm --create /dev/md5 ---level=1 --raid devices=2 /dev/md2 /dev/md4
where md2 is the name of your previous raid0 array you want mirrored.

Now you should be able to mount md5 rather than md2 as root. Don't forget

mdadm -D --scan >> mdadm.conf (wherever Gentoo keeps it) And add a new Grub entry to try it out. Hope that works...
 
Old 07-17-2009, 11:15 AM   #5
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.16.2
Posts: 1,571
Blog Entries: 13

Rep: Reputation: 182Reputation: 182
BTW, I didn't specify partitions in the above post; you probably need to do that when you make "md4" above. Post your fdisk -l and mdadm -D /dev/md{1,2,3...} if you have problems.
 
Old 07-17-2009, 02:54 PM   #6
jimbro727
LQ Newbie
 
Registered: Jul 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by mostlyharmless View Post
Well, I would start by duplicating the disk structures of the previous disks with something like
Code:
sfdisk -d /dev/sda |sfdisk /dev/sdc
sfdisk -d /dev/sdb |sfdisk /dev/sdd
where sda, sdb are your current disk and sdc, sdd are the new disks. Obviously this locks you into your existing choices with your swap partition space sizes for now, but you can always change those partitions later.

Then I'd create the mirrors with something like
Code:
mdadm --create /dev/md4 ---level=0 --raid devices=2 /dev/sdc /dev/sdd

and

Code:
mdadm --create /dev/md5 ---level=1 --raid devices=2 /dev/md2 /dev/md4
where md2 is the name of your previous raid0 array you want mirrored.

Now you should be able to mount md5 rather than md2 as root. Don't forget

mdadm -D --scan >> mdadm.conf (wherever Gentoo keeps it) And add a new Grub entry to try it out. Hope that works...
Thank you very much for the help!

Doesn't this create a raid 0+1 array? A mirrored array consisting of striped arrays? I was looking to create a raid 1+0 array - which I believe is supported as its own level (10) rather than creating the mirrored sets and striped sets separately (I'm not sure if there's a difference there or not), but I could be wrong.

Is there a performance difference between raid 0+1 and 1+0?

Thanks again,

Jim
 
Old 07-17-2009, 08:01 PM   #7
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.16.2
Posts: 1,571
Blog Entries: 13

Rep: Reputation: 182Reputation: 182
I don't think that with your given configuration that you can convert to raid 10; I suppose you could do the above steps and then assemble them this way:

mdadm --assemble --level=1 --raid-devices=2 /dev/sda /dev/sdc /dev/md1
mdadm --assemble --level=1 --raid-devices=2 /dev/sdb /dev/sdd /dev/md2
mdadm --assemble --level=0 --raid-devices=2 /dev/md1 /dev/md2 /dev/md3

I'm not sure it'll work, and you'd better backup first!
You're right, otherwise you get raid 0+1, which is not quite as nice. If not, just start from scratch with raid10

Last edited by mostlyharmless; 07-17-2009 at 08:03 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
software RAID10 - does the disk order in mdadm matter ? banan.olek Linux - Server 4 09-06-2011 01:57 PM
soft raid10 with mdadm with everything ONLY on raid Alkisx Ubuntu 3 03-01-2009 05:41 PM
RAID10 Recovery Issue - mdadm segfault marc2112 Linux - Server 2 02-15-2009 09:25 AM
XP NTFS on RAID0 - mdadm mounting problems iainmackay85 Linux - Hardware 3 11-17-2008 11:15 AM
mdadm: no devices ... were found after RAID0 install hedpe Linux - Software 4 06-28-2007 02:38 PM


All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration