[mythtv-users] Question re: available SATA ports and linux software RAID

Ian Clark mrrooster at gmail.com
Tue Apr 12 12:24:02 UTC 2011


On 7 April 2011 16:26, Simon Hobson <linux at thehobsons.co.uk> wrote:
> Ian Clark wrote:
>
>>Oh, and it's also worth remembering that for RAID5 you should ideally
>>have a number of drives that's a power of 2 plus 1, this should be a
>>power of 2 plus 2 for RAID 6 (so a raid5 array is ideally 3 drives, 5
>>drives, 9 drives etc etc)
>
> Where did that come from ? I've never heard it before, and TBH I
> can't see any logical reason for it.

Admittedly my raid array is on NetBSD so some of the limitations may
not apply, but I suspect they do.

Basically you want to ensure that any given write to the raid array
writes a full stripe of data (so with 3 drives you would be writing 2
data blocks and 1 parity block.) otherwise you have to read the
existing data to recalculate the parity, which is very slow.

Now often filing system block sizes are set at a power of 2, for
example 16kb, 32kb, 64kb, and ideally you want your stripe size to
contain this much data, or an exact multiple of it. eg, if you have a
64kb fs block size you will probably, and almost definatly when
writing a large file like myth does, write data in 64k chunks. In
order that you don't need to do a read/calculate/write cycle you will
also want to ensure that a single 'stripe' of the raid contains 64kb
of data, now as in raid 5  one drive holds the parity the amount of
data per stripe is one less than the number of drives in the array (as
one drive is parity), so if you had a 32k stripe unit size you'd be
writing 64kb of data to 2 drives and 32kb of parity to the third, but
you wouldn't need to read existing data to ensure the parity is
correct beforehand.

You should also ensure your partition is aligned on the start of a
stripe boundry too, otherwise you'll be writing a full stripe of data,
but not aligned to the start of a stripe boundry, which will again
trigger the read/calc/write behaviour.

Now, as I said this is using ffs on NetBSD so it might be that you can
set the blocksize on, say, xfs to a non power of 2, so it might not be
an issue. It's worth bearing in mind though.

For comparison, I used to have a 4 disc raid 5 array, I could write to
this at about 25-30MB/sec a second (because of this mentioned issue),
when I replaced it with a 3 disc raid 5 array and got everything
aligned correctly the write speed shot up to over 100MB/sec.

http://mail-index.netbsd.org/netbsd-users/2010/04/09/msg006047.html
and
http://mail-index.netbsd.org/netbsd-users/2010/04/11/msg006050.html

detail my issues with raid5 and slowness. :)

Apologies if my explanation isn't very clear, it makes my head spin a
bit too I'm afraid.

Cheers,

Ian


More information about the mythtv-users mailing list