ext4 Stride & Stripe Width Calculator
When a filesystem sits on a RAID array, mkfs.ext4 needs to know how many blocks fit in one chunk (stride) and in one full stripe (stripe-width). Get them wrong and every parity update becomes a read-modify-write. Pick the array's geometry and this returns both numbers, the matching XFS options, and the size of a full stripe.
mkfs options
Pass these to mkfs.ext4 -E
- Stride
- Stripe width
- Data disks
- Chunk
- Full stripe
- Array members
—
—
XFS, same geometry
—
| Block size | Stride | Stripe width |
|---|
How the numbers are worked out
- Stride is the chunk expressed in filesystem blocks. A 64 KiB chunk with 4 KiB blocks is
65536 / 4096 = 16blocks, sostride=16. The chunk size must be a whole multiple of the block size or no whole stride exists, which is why a 6 KiB chunk is refused. - Stripe width is the stride times the data disks. RAID 6 over eight disks keeps two for parity, so six hold data:
16 × 6 = 96. RAID 5 over eight disks would give seven data disks and a width of 112; a mirror has one data disk, so its width equals the stride and the value does not matter. - A full stripe is the chunk times the data disks. Here that is 384 KiB. A write that covers a whole stripe needs no old parity read, so it never pays the read-modify-write penalty; that is the write pattern these two options exist to encourage.
- ext4 uses the pair to size its allocation groups. With them set, the block allocator places file data in chunk-sized runs aligned to the array, so sequential writes line up with whole stripes instead of straddling them. Without them ext4 assumes the chunk is one block and spreads a write across every disk in the worst possible way.
- XFS takes the geometry in bytes.
-d su=64k,sw=6is the same information: the stripe unit and the count of data disks, with parity left out ofsw. mdadm'schunkis the stripe unit, so it maps straight ontosu. - What it does not do. No partition alignment, no 4Kn or 512e sector size, no SSD erase-block or zone alignment, no thin provisioning or snapshots, no mdadm layout other than near-2 for RAID 10, and no benchmark of the result. It reports geometry, not throughput; everything runs in your browser with no storage, uploads or network access.