2

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.

9

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

  • keys += "-x0".. – poige Mar 31 '11 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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