Skip to contentSkip to conversation

converting RAID5 to RAID10

DISCUSSION martin f krafft 4 participants 6 messages Oct 5, 2006 MD RAID

lore
Share & tools
lore
#0 lore raw

I have a 1.5Tb RAID5 machine (3*750Gb disks + 1 spare) and need to move some write-intensive services there. Unfortunately, the performance is unacceptable. Thus, I wanted to convert the machine to RAID10.

My theory was: backup, remove the spare, set one disk faulty, remove it, create a degraded RAID10 on the two freed disks, copy data, kill RAID5, add disks to new RAID10.

Unfortunately, mdadm (2.5.3) doesn't seem to agree; it complains that it cannot assemble a RAID10 with 4 devices when I ask it to:

  mdadm --create -l 10 -n4 -pn2 /dev/md1 /dev/sd[cd] missing missing

I can kind of understand, but on the other hand I don't. After all, if you'll allow me to think in terms of 1+0 instead of 10 for a second, why doesn't mdadm just assemble /dev/sd[cd] as RAID0 and make the couple one of the two components of the RAID1? What I mean
is: I could set up RAID1+0 that way; why doesn't it work for RAID10?

Do you know of a way in which I could migrate the data to RAID10? Unfortunately, I do not have more 750Gb disks available nor a budget, and the 1.5Tb are 96% full.

Cheers,

Signature · 7 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
"if a man treats life artistically, his brain is his heart."
                                                        -- oscar wilde
#1 lore raw
Quoted 6 lines · On Thursday October 5, [email protected] wrote:

Unfortunately, mdadm (2.5.3) doesn't seem to agree; it complains that it cannot assemble a RAID10 with 4 devices when I ask it to:

  mdadm --create -l 10 -n4 -pn2 /dev/md1 /dev/sd[cd] missing missing

mdadm --create -l 10 -n 4 -pn2 /dev/md1 /dev/sdc missing /dev/sdd missing

Raid10 lays out data like
A A B B
C C D D
not
A B A B
C D C D
as you seem to expect.

So you could even do

mdadm --create -l 10 -n 4 -pn2 /dev/md1 missing /dev/sd[cd] missing

for slightly less typing.

There seems to be a bug in raid10 that is reports the wrong number of working drives. This is probably only in 2.6.18. Patch is below.

NeilBrown

### Diffstat output

 ./drivers/md/raid10.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid10.c +1 -1
diff .prev/drivers/md/raid10.c ./drivers/md/raid10.c
@@ -2079,7 +2079,7 @@ static int run(mddev_t *mddev)
 		disk = conf->mirrors + i;
 
 		if (!disk->rdev ||
-		    !test_bit(In_sync, &rdev->flags)) {
+		    !test_bit(In_sync, &disk->rdev->flags)) {
 			disk->head_position = 0;
 			mddev->degraded++;
 		}
#2 lore raw

also sprach Neil Brown <[email protected]> [2006.10.05.1214 +0200]:

Quoted 1 line

mdadm --create -l 10 -n 4 -pn2 /dev/md1 /dev/sdc missing /dev/sdd missing

Peter Samuelson of the Debian project already suggested this and it seems to work.

Thanks a lot, Neil, for the quick and informative response.

Signature · 7 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
spamtraps: [email protected]
 
"the ships hung in the sky in much the same way that bricks don't."
                                 -- hitchhiker's guide to the galaxy
#3 lore raw
In reply to martin f krafft
Quoted 20 lines

I have a 1.5Tb RAID5 machine (3*750Gb disks + 1 spare) and need to move some write-intensive services there. Unfortunately, the performance is unacceptable. Thus, I wanted to convert the machine to RAID10.

My theory was: backup, remove the spare, set one disk faulty, remove it, create a degraded RAID10 on the two freed disks, copy data, kill RAID5, add disks to new RAID10.

Unfortunately, mdadm (2.5.3) doesn't seem to agree; it complains that it cannot assemble a RAID10 with 4 devices when I ask it to:

  mdadm --create -l 10 -n4 -pn2 /dev/md1 /dev/sd[cd] missing missing

I can kind of understand, but on the other hand I don't. After all, if you'll allow me to think in terms of 1+0 instead of 10 for a second, why doesn't mdadm just assemble /dev/sd[cd] as RAID0 and make the couple one of the two components of the RAID1? What I mean
is: I could set up RAID1+0 that way; why doesn't it work for RAID10?

Quoted 4 lines

Do you know of a way in which I could migrate the data to RAID10? Unfortunately, I do not have more 750Gb disks available nor a budget, and the 1.5Tb are 96% full.

AFAIK, linux raid-10 is not exactly raid 1+0, it allows you to, for example, use 3 disks. You could create a raid-0, then later add that as a component to a raid-1. A tested backup would certainly be helpful, although it should work without it (and I can easily say that, as it's not my data that will be lost: YMMV!)

Jurriaan

#4 lore raw
Quoted 2 lines · Jurriaan Kalkman

AFAIK, linux raid-10 is not exactly raid 1+0, it allows you to, for example, use 3 disks.

I made a raid-10 device earlier today with 7 drives and I was surprised to see that it reported to use all of them. I thought it'd make one of them a spare (or complain about the odd number of drives).

How does that work? (Or is it the "number of drives reported" bug Neil referred to a moment ago? I use FC6's version of 2.6.18).

- ask

Signature · 1 line
http://www.askbjoernhansen.com/
#5 lore raw
Quoted 6 lines · On Thursday October 5, [email protected] wrote:
Quoted 2 lines · Jurriaan Kalkman

AFAIK, linux raid-10 is not exactly raid 1+0, it allows you to, for example, use 3 disks.

Quoted 6 lines

I made a raid-10 device earlier today with 7 drives and I was surprised to see that it reported to use all of them. I thought it'd make one of them a spare (or complain about the odd number of drives).

How does that work? (Or is it the "number of drives reported" bug Neil referred to a moment ago? I use FC6's version of 2.6.18).

If you wanted 6 drives and a spare you need to ask for in: -n6 -x1. If you asked for 7 drives in a raid10 you get them.
The data is laid out thus:

A A B B C C D
D E E F F G G
H H I I J J K
K L L M M N N
(each column in a drive, each letter is a chunk of data).

NeilBrown