Creating Software RAID0 (Stripe) On Two Devices' Using Mdadm' Tool in Linux
Creating Software RAID0 (Stripe) On Two Devices' Using Mdadm' Tool in Linux
Creating Software RAID0 (Stripe) On Two Devices' Using Mdadm' Tool in Linux
Main concept of using RAID is to save data from Single point of failure, means
if we using a single disk to store the data and if it’s failed, then there is no
chance of getting our data back, to stop the data loss we need a fault tolerance
method. So, that we can use some collection of disk to form a RAID set.
Requirements
Minimum number of disks are allowed to create RAID 0 is 2, but you can add
more disk but the order should be twice as 2, 4, 6, 8. If you have a Physical
RAID card with enough ports, you can add more disks.
Here we are not using a Hardware raid, this setup depends only on Software
RAID. If we have a physical hardware raid card we can access it from it’s
utility UI. Some motherboard by default in-build with RAID feature,
there UI can be accessed using Ctrl+I keys.
If you’re new to RAID setups, please read our earlier article, where we’ve
covered some basic introduction of about RAID.
IP Address : 192.168.0.225
# ls -l /dev | grep sd
Check Hard Drives
3. Once the new hard drives detected, it’s time to check whether the attached
drives are already using any existing raid with the help of following ‘mdadm’
command.
In the above output, we come to know that none of the RAID have been
applied to these two sdb and sdc drives.
Step 3: Creating Partitions for RAID
4. Now create sdb and sdc partitions for raid, with the help of following fdisk
command. Here, I will show how to create partition on sdb drive.
# fdisk /dev/sdb
Create Partitions
Note: Please follow same above instructions to create partition on sdc drive
now.
5. After creating partitions, verify both the drivers are correctly defined for
RAID using following command.
-C – create
-l – level
-n – No of raid-devices
7. Once md device has been created, now verify the status of RAID
Level, Devices and Array used, with the help of following series of commands
as shown.
# cat /proc/mdstat
Verify RAID Level
# mdadm -E /dev/sd[b-c]1
# mkfs.ext4 /dev/md0
Create ext4 Filesystem
9. Once ext4 filesystem has been created for Raid device, now create a mount
point directory (i.e. /mnt/raid0) and mount the device /dev/md0 under it.
# mkdir /mnt/raid0
# df -h
11. Next, create a file called ‘tecmint.txt‘ under the mount point /mnt/raid0,
add some content to the created file and view the content of a file and
directory.
# touch /mnt/raid0/tecmint.txt
# cat /mnt/raid0/tecmint.txt
# ls -l /mnt/raid0/
12. Once you’ve verified mount points, it’s time to create an fstab entry
in /etc/fstab file.
# vim /etc/fstab
Add the following entry as described. May vary according to your mount
location and filesystem you using.
/dev/md0 /mnt/raid0 ext4 defaults 0
0
13. Run mount ‘-a‘ to check if there is any error in fstab entry.
# mount -av
# cat /etc/mdadm.conf
That’s it, we have seen here, how to configure RAID0 striping with raid levels
by using two hard disks.