What is RAID0? Speed, risks and setup
Author: Domeny.ForSale editorial team Published
In brief: RAID0 combines at least two disks into a single storage space and distributes data across them, which can increase read and write speeds. However, it offers no fault tolerance: losing one disk usually means losing access to the entire array. In Linux, you can create a software RAID0 array using mdadm, but this setup is best reserved for data you can recreate or that is protected by a separate backup.
How RAID0 distributes data across disks
RAID is a way of organising several disks into a single logical unit, called an array. RAID0 uses striping: splitting data into chunks that are written in turn to different disks. It creates neither an extra copy nor the information needed to reconstruct missing chunks.
For example, a file may be split so that the first chunk goes to disk A, the second to disk B, and the third back to A. During reads, both devices can work in parallel. The system sees a single storage space where you can create a file system and store directories.
Two 1 TB disks provide nominally around 2 TB of space before overheads. The system may display a different figure because of how it converts units. With disks of different capacities, space utilisation depends on the RAID0 implementation, so the simplest approach is to use disks with similar capacities and performance.
What speeds to expect
For large, sequential reads and writes, two similar disks can deliver performance close to the sum of their individual capabilities. This does not mean the computer will run twice as fast. Launching applications, handling small files and operations that need fast response times may benefit much less.
Performance is also limited by the controller, interfaces, the devices’ shared connection to the rest of the computer, the processor and how the application works. Two fast SSDs will not deliver their full benefit if their combined transfer rate exceeds the bandwidth of the shared connection. An array does not eliminate the latency of an individual drive either.
Before choosing RAID0, measure a real task: copying a large amount of material, exporting a video or processing a dataset. Compare the completion time with running the task on a single disk. If you want to assess the drives rather than mainly RAM, the test should use more data than the available cache can hold.
When RAID0 makes sense and what failure means
RAID0 can be useful as workspace for temporary files, local data for computations or material whose originals are stored on another drive. For example, a video editor might keep the original footage and project in a separate, protected location and use the array for intermediate files. A failure then costs the time needed to regenerate the data, rather than destroying the only copy of the work.
It is not a good choice for your only photo archive, business documents or the data of a service that must remain available. Every disk is an essential part of the array. Adding more drives increases the number of devices whose failure can stop it working.
If one disk fails, you cannot simply replace it and rebuild the data from the others, as you can with an array that has redundancy—extra information used for recovery. The surviving drives contain only some of the chunks. Professional recovery is sometimes possible, but it depends on the damage and offers no guarantee.
If surviving a disk failure matters more, consider RAID1, which stores mirrored copies of the data. You still need a separate backup: neither of these arrays, on its own, protects against accidental file deletion or files being encrypted by malware.
How to create RAID0 in Linux using mdadm
mdadm is a tool for managing software arrays in Linux. The following example assumes two empty, additional disks: /dev/sdb and /dev/sdc. These commands destroy data on the specified devices. Do not run them without checking the disk names and backing up any files you need.
First, inspect the devices:
lsblk -o NAME,SIZE,MODEL,SERIAL,FSTYPE,MOUNTPOINTS
Compare capacities, models and serial numbers. Make sure the selected disks do not contain the operating system, active partitions or data you need. Install the mdadm package using your distribution’s package manager; for example, in Debian and Ubuntu:
sudo apt install mdadm
Create the array, file system and mount point:
sudo mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
cat /proc/mdstat
sudo mkfs.ext4 /dev/md0
sudo mkdir -p /mnt/raid0
sudo mount /dev/md0 /mnt/raid0
These commands also assume that /dev/md0 is not already in use by another array. If the tool warns about existing data or signatures, stop and establish where they came from rather than automatically confirming the operation.
What to configure after creating the array
Mounting the array once is not enough to ensure it works correctly after a restart. Check the array detection configuration in mdadm; the configuration file’s location and whether initramfs needs updating depend on the distribution. Verify the instructions in its official documentation.
For persistent mounting in /etc/fstab, use the file system’s UUID, which you can obtain with sudo blkid /dev/md0, rather than assuming the device name will stay the same. Test the entry before restarting and set the directory permissions to suit the user or application.
Before moving your work onto the array, settle one question: where will you restore the data from if the array is lost? If the answer is “nowhere”, first prepare a backup or choose a different disk configuration.
See also: What is a VPN?
