Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

How Striping Works

RAID 0 cuts data into chunks of a fixed size and writes the first chunk to disk one, the second to disk two, and so on, starting again at disk one after the last. A 1 MiB file on a two-disk array with 512 KiB chunks ends up as one half on each disk. The array appears as one device, for example /dev/md0.

No disk holds a complete file and there is no parity or mirror. That is where the speed comes from, and also the risk.

Capacity and Speed

DisksUsable capacityDisks that may fail
2 × 1 TB2 TB0
4 × 1 TB4 TB0
  • Capacity: the sum of the disks. Use disks of the same size; many RAID implementations count each disk as the smallest one.
  • Throughput: large sequential reads and writes are spread over all disks and grow roughly with the number of disks.
  • IOPS: many small requests in parallel are shared between disks, so the total rises. A single small request is not faster, because it still waits for one disk.

No Redundancy: How the Risk Grows

Every disk holds a share of every large file, so losing one disk loses the array. The more disks, the higher the chance that one of them fails. As arithmetic only, assume that each disk has a 2% chance of failing in a year:

DisksChance the array fails in a year
12%
23.96%
47.76%
814.92%

The figure is 1 minus 0.98 to the power of the number of disks. The 2% is an assumption for the example, not a rate for any real disk model. Recovery tools cannot help much either: the surviving disks hold fragments, not files.

Where RAID 0 Is Acceptable

  • Scratch space: temporary files of builds, renders, or data processing.
  • Caches: data that is fetched again from its source when lost.
  • Data that can be rebuilt: search indexes or test databases created from a dump.
  • Replicated nodes: a server whose data also lives on other servers, so a failed node is rebuilt from them.

Never keep the only copy of anything on RAID 0, and never put the operating system there unless reinstalling it is part of the plan.

Chunk Size

The chunk size is how much data goes to one disk before the next disk takes over. Linux mdadm uses 512 KiB unless you set another value with --chunk, given in KiB. Larger chunks suit large sequential files; smaller chunks spread medium-sized requests over more disks. For most servers the default is a good choice. Changing it later is possible with mdadm --grow, but that reshape rewrites the whole array and takes hours, so choose before you create it.

Create a RAID 0 Array with mdadm

Warning: the create command overwrites the disks you list. Back up anything on them and confirm the device names with lsblk first:

lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
sudo mkfs.ext4 /dev/md0

Saving the array to mdadm.conf, mounting it, and adding it to fstab follow the same steps as for other levels, shown in mdadm RAID: set up software RAID on Linux.

Watch the Disks Anyway

RAID 0 cannot rebuild anything, so the only warning you get is the one the disks give themselves. Check them with smartctl and copy data off when reallocated sectors or media errors start to rise.

Other RAID Levels

  • RAID 1: mirrors the disks, so one may fail.
  • RAID 5: striping with one disk of parity.
  • RAID 6: striping with two disks of parity.
  • RAID 10: RAID 0 speed built on mirrored pairs, the usual choice when you want striping and safety.

For capacity at other disk counts, see the RAID calculator and levels overview.

Was this answer helpful?
Loading...