Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

From the mdadm man page:

"When creating a RAID5 array, mdadm will automatically create a degraded array with an extra spare drive. This is because building the spare into a degraded array is in general faster than resyncing the parity on a non-degraded, but not clean, array. This feature can be overridden with the --force option."

So I have 4 hard drives I'm going to want to drop into an array... The howto I'm using specifies to use one of them as the 'spare'...

AKA:

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 --spare-devices=1 /dev/sde1

What I don't understand is why this occurs, my assumption is that I would end up with a 3 drive array and a hot spare... What if I don't want that and I want a 4 drive array, I see that I can do that with the -force option...

I'm just wondering why this is the default and if I'm missing anything...

Thanks in advance.

share|improve this question
    
Found this: marc.info/?l=linux-raid&m=112044009718483&w=2 In case anyone else has the same question. –  Gary Mar 31 '11 at 16:04

1 Answer 1

up vote 8 down vote accepted

That behavior (using a spare) should really be invisible to you; what it's saying there is that it's going to do some drive building trickery, and instead of sweeping the disks and building the parity channel up during the build (slow!), it's going to build the array on three devices and throw the last device in after the fact, to do the parity build in the background.

Your suspicion about the problem with the command as you have it is dead on. If you run that, it'll generate a 3-disk array on 2 disks, then add the third disk from being the temporary hot-spare into the array.. leaving you with, still, a hot spare at the end of it.

You'll want this, instead; mdadm will still do its trickery with the hot-spare, but it'll be invisible to you (you'll see in /proc/mdstat after the creation, that it'll immediately jump into the process of loading data onto the 4th disk):

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

share|improve this answer
    
keys += "-x0".. –  poige Mar 31 '11 at 8:13
    
That's kind of what I thought... Thanks –  Gary Mar 31 '11 at 13:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.