How to setup Software RAID 0 on Fedora 22 Server

Software RAID 0 is another way to create a redundant array used for high availability and reliability in large scale environment. Here I want to show you how to setup or create Software RAID 0 on a Fedora 22 Server. At least we need 2 identical disks to create Software RAID. And we need a tool called mdadm which is available via Fedora repository. You may test to create this Software RAID on a testing environment, VirtualBox or other virtual machine as well.

A. Install mdadm tool on Fedora 22

On my case, I have mdadm tool installed on my Fedora 22 Server. You can install this tool using this command

dnf install mdadm

B. Prepare the disks

First, make sure you have two empty disks connected to the server and then verify it. I use two 10 GB disks connected to the server. Next we need to detect and verify the disks. Use the following command to see the list.

ls -l /dev | grep sd

Output

raid on fedora 22 server 1

As you can see I have two disks marked as sdb and sdc. These disks will be used for Software RAID 0.

C. Create Partition for RAID

Here we will create a new partition on the disks for RAID. First, we are going to create partition on the first disk /dev/sdb

fdisk /dev/sdb

Next follow these instruction to create a new partition on the /dev/sdb.

  • Press n for creating new partition
  • Choose p for creating new primary partition
  • Select partition number as 1
  • Give default values by pressing Enter twice
  • Press t to choose the partition
  • Type fd for Linux RAID Auto and press Enter
  • Press w to write the changes

Now type this command to see the summary

fdisk -l /dev/sdb

Output

raid on fedora 22 server 2Make sure you have one partition with Linux Raid Autodetect system listed.

Do the same steps for the next disk. Now check the disks and verify both drives correctly defined for RAID using this command below

mdadm –examine /dev/sd[b-c]
mdadm –examine /dev/sd[b-c]1

Output

raid on fedora 22 server 3

D. Creating RAID md Devices

Next we need to create md device (for example /dev/md0) and apply raid level. Use the following command to create new md device

mdadm -C /dev/md0 -l raid0 -n 2 /dev/sd[b-c]1

Output

raid on fedora 22 server 4

Now verify the md device.

cat /proc/mdstat

Output

raid on fedora 22 server 5

mdadm -E /dev/sd[b-c]1

Output

raid on fedora 22 server 6

mdadm –detail /dev/md0

Output

raid on fedora 22 server 7

 

Formatting the RAID device

We need to format the RAID device /dev/md0 and mount it before use

mkfs.ext4 /dev/md0

Output

raid on fedora 22 server 8

 

Mount the device

Next we need to mount the raid device

mkdir /mnt/raid0
mount /dev/md0 /mnt/raid0

raid on fedora 22 server 9

 

Now we have mounted the RAID0 device to /mnt/raid0. We can start use this device to store files or share it over the network.

Admin

Leave a Reply

Your email address will not be published. Required fields are marked *