To create a software RAID array can be used the mdadm utility
Install mdadm
Type the following command under RHEL / CentOS / Fedora Linux:
# yum install mdadm
Type the following command under Debian / Ubuntu Linux:
# apt-get update && apt-get install mdadm
Create the Array
# mdadm —create /dev/md0 —level=raid1 —raid-devices=2 /dev/sdb /dev/sdc
You can check that your RAID was made successfully by executing the command
# cat /proc/mdstat
Create and Mount the Filesystem
Formatting a RAID drive using the MKFS command:
# mkfs.ext4 -F /dev/md0
Create a new folder for the RAID to mount to with the mkdir command.
# mkdir -p /mnt/raid1
Use the mount command and bind the RAID array to the new /mnt/raid1 folder.
# mount /dev/md0 /mnt/raid1
Add the new filesystem mount options to the /etc/fstab file for automatic mounting at boot:
# echo ‘/dev/md0 /mnt/raid1 ext4 defaults,nofail,discard 0 0’ | sudo tee -a /etc/fstab
Your RAID 1 array should now automatically be assembled and mounted each boot.