Linux ext2, ext3 and ext4 Stride & Stripe calculation on RAID

Trying to get the best performance out of a raid array can be confusing and frustrating.  A sometimes overlooked element is that of how you create your file system...

One of the biggest performance gains you can achieve on a raid array is by aligning your file system to the underlying chunk size of the raid arry.  By creating file system like this avoid overlaps which could see the number of arry chinks needing to be read cut in half! The net result of this is of course an increase in performance. To calculate the stride and stripe, you wil need to know a couple of thinks about your arry:

  • Type of RAID (RAID 1,5,6,10 etc)
  • The chunk size of the RAID array (there is a whole wold of discussion to be had on ensuring you set this correctly at raid creation time but this is for another article).
  • The number of data disks  (exclude the parity disks)
  • The file system block size.

So, we need to calculate the stride first.  Divide the array chunk size by the file system block size.

Next up, calculate the stripe size by multiplying the stripe by the number of data disks.

Lets look at an example:

4 drives in RAID5, with 256K chunks and a 4K file system block size.  The stride... 256k/4k = 64.  The stripe 64 x 3 = 192.

mkfs.ext3 -b 4096 -E stride=64 -E stripe-width=192 -O dir_index /dev/mdx

If your less keen on breaking out the calculator, then this excellent stride and stripe calculator should get you well on your way.

Go back