Step-by-Step Tutorial: Configure Software RAID 0 in Linux

Deepak Prasad

RAID, Linux

In this article I will share the steps to configure software raid 0 i.e. stripping raid where the data is stored in strips. I will explain this in more detail in the upcoming chapters. I have written another article with comparison and difference between various RAID types using figures including pros and cons of individual RAID types so that you can make an informed decision before choosing a RAID type for your system.

Step-by-Step Guide to Configure Software RAID 0 in Linux


What is RAID 0?

RAID-0 is usually referred to as "striping." This means that data in a RAID-0 region is evenly distributed and interleaved on all the child objects. For example, when writing 16 KB of data to a RAID-0 region with three child objects and a chunk-size of 4 KB, the data would be written as follows:

4 KB to object 0
4 KB to object 1
4 KB to object 2
4 KB to object 0



Create Software RAID 0 Array

There are below certain steps which you must follow before creating software raid 0 on your Linux node. Since I have already perform ed those steps in my older article, I will share the hyperlinks here

Important Rules of Partitioning

Partitioning with fdisk

Now we have our partitions available with us which we can validate using lsblk

[root@node1 ~]# lsblk
sda               8:0    0   30G  0 disk
├─sda1            8:1    0  512M  0 part /boot
└─sda2            8:2    0 27.5G  0 part
  ├─centos-root 253:0    0 25.5G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0    3G  0 disk
└─sdb1            8:17   0    3G  0 part
sdc               8:32   0    3G  0 disk
└─sdc1            8:33   0    3G  0 part
sr0              11:0    1 1024M  0 rom


Create software RAID 0

Now since we have all the partitions with us, we will create software RAID 0 array on those partitions

[root@node1 ~]# mdadm -Cv -l0 -c64 -n2 /dev/md0 /dev/sd{b,c}1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.


-C, --create
       Create a new array.
-v, --verbose
       Be  more  verbose about what is happening. 

-l, --level=
       Set RAID level.  When used with --create, options are: linear, raid0,  0,  stripe,  raid1,  1,  mirror,
       raid4,  4,  raid5,  5, raid6, 6, raid10, 10, multipath, mp, faulty, container.  Obviously some of these
       are synonymous.

-c, --chunk=
       Specify chunk size of kilobytes.

-n, --raid-devices=
       Specify  the number of active devices in the array.


Verify the changes

Now since our software raid 0 array is created successfully. Verify the changes using below command

[root@node1 ~]# cat /proc/mdstat
Personalities : [raid0]
md0 : active raid0 sdc1[1] sdb1[0]
      6283264 blocks super 1.2 64k chunks

unused devices:


Create file-system and mount point

Now since our software raid 0 array is ready, we will create a filesystem on top of /dev/md0 so it can be used for storing data. For the sake of this article I will create an ext4 filesystem but you can create any other filesystem on your software raid 0 as per your requirement

[root@node1 ~]# mkfs.ext4 /dev/md0
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=32 blocks
393216 inodes, 1570816 blocks
78540 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1608515584
48 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

Next we need a mount point to access the software raid 0 array file system.

[root@node1 ~]# mkdir /raid0_stripping
[root@node1 ~]# mount /dev/md0 /raid0_stripping

Now since we have our mount point and we have mounted our software raid 0 array on our mount point. Let us check the details of our software raid 0 array.

[root@node1 ~]# df -h /raid0_stripping
Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        5.8G   24M  5.5G   1% /raid0_stripping

So now this software raid 0 array can be used to store your data. But currently since we have temporarily mounted this filesystem, it will not be available after reboot.

To make the changes reboot persistent, add the below content in your /etc/fstab

/dev/md0        /raid0_stripping        ext4    defaults        0 0

Next save your file and reboot your node.

Once the node is UP make sure your software raid 0 array is mounted on your mount point i.e.

[root@node1 ~]# df -h /raid0_stripping
Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        5.8G   24M  5.5G   1% /raid0_stripping


Lastly I hope the steps from the article to configure software raid 0 array on Linux was helpful. So, let me know your suggestions and feedback using the comment section.

Managing RAID in Linux

Views: 216

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can reach out to him on his LinkedIn profile or join on Facebook page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to

Thank You for your support!!

Leave a Comment

We try to offer easy-to-follow guides and tips on various topics such as Linux, Cloud Computing, Programming Languages, Ethical Hacking and much more.

Programming Languages