What is mdadm
The mdadm utility can be used to create and manage storage arrays using Linux’s software RAID capabilities. Administrators have great flexibility in coordinating their individual storage devices and creating logical storage devices that have greater performance or redundancy characteristics.
Creating a RAID 0 Array
The RAID 0 array works by breaking up data into chunks and striping it across the available disks. This means that each disk contains a portion of the data and that multiple disks will be referenced when retrieving information. This option Require minimum of 2 storage devices
In the following examples we are simulate 4 storage devices
To get started, find full informations for the raw disks that you will be using for the raid:
lsblk -o NAME,SIZE,FSTYPE,TYPE,MOUNTPOINT
Output looks like
NAME SIZE FSTYPE TYPE MOUNTPOINT
sdc 500G disk
sdd 500G disk
sde 500G disk
sdf 500G disk
vda 20G disk
├─vda1 200G ext4 part /
└─vdb1 100G part
As above, we have 4 disks without a filesystem, each 500G in size. In this example, these devices have been given the /dev/sdc and /dev/sdd /dev/sde /dev/sdf identifiers for this session. These will be the raw components we will use to build the array.
Create the Array
To create a RAID 0 array ,we need to pass them in to the mdadm –create command. You will have to specify the device name you wish to create (/dev/md0 in our exmaple), the RAID level, and the number of devices:
sudo mdadm --create --verbose /dev/md0 --level=0 --raid-devices=4 /dev/sdc /dev/sdd /dev/sde /dev/sdf