-   Linux - Hardware (
-   -   Weird behaviour of mdadm/software RAID5 (

robbe751 02-02-2007 11:47 PM

Weird behaviour of mdadm/software RAID5

I have a setup like the following:
-3xSATA Seagate 400GB (same drives) on an ASUS M2NPV-VM
-/dev/sd[a|b|c] are members of the RAID5 /dev/md0

The status of /dev/md0 is clean, persistent sb etc.

Now I noticed that /dev/sda has no partition on it. /dev/sdb and sdc have an 'fd' autodetect partition on them. This is weird already.
So I go ahead and remove sda from the array, zero the superblocks and for good measure do a

sudo dd if=/dev/zero of=/dev/sda count=1M

Now I partition sda properly with sda1 as 'fd' autodetect. When I now

sudo mdadm /dev/md0 --add /dev/sda1

I only get

mdadm: add new device failed for /dev/sda1 as 3: Invalid argument

The funny thing is, when I --add /dev/sda instead, it works and starts rebuilding the array. Why do I have to add the whole disk, rather than the partition? This doesn't make sense to me.

Any hints or directions?


jonwatson 02-02-2007 11:57 PM

That sounds somwehat logical to me. When you set up a RAID5 with 3 disks, you lose a disk as the RAID uses it for...well...the mirror and other RAIDey stuff. It's not a user-accessible partitioned drive much like a swap partition isn't a user-accessible partition.

Check out a RAID calculator for fun and games:

Electro 02-03-2007 01:55 AM

Post your /etc/mdadm.conf and the steps that you did to create the array.

From the mdadm manual, it stated it will create a spare when creating a RAID-5 array, so technically you need four hard drives for RAID-5. You can get around this by specifying the option --force. I agree this way as the minimum quantity of drives for RAID-5 setups because it provides redundancy after the array is created using three hard drives and including a hot spare.

To make software RAID-5 be reliable, I recommend four separate IDE/SATA controllers. This will be more reliable when a controller fails. However, when considering using RAID-5, I strongly recommend hardware RAID controllers because software RAID doing RAID-5 transactions will penalize your computer if you are not using a system with multiple processors.

All times are GMT -5. The time now is 07:47 PM.