Creating RAID-0 (Stripe) in Linux

Creating RAID-0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux





About 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

  1. RAID 0 has High Performance.
  2. Zero Capacity Loss in RAID 0. No Space will be wasted.
  3. Zero Fault Tolerance ( Can’t get back the data if anyone of disk fails).
  4. Write and Reading will be Excellent.


Requirements

The minimum number of disks is 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.

Install ‘mdadm‘ package: The mdadm is a small program, which will allow us to configure and manage RAID devices in Linux.


check my youtube video "Creating RAID-0 (Stripe) in Linux" for your reference.


Creating partitions for RAID

Now create 2 partitions for raid, with the help of following commands.

#fdisk /dev/sd*
  1. Press ‘n‘ for creating a new partition.
  2. Then choose ‘P‘ for Primary partition.
  3. Next, select the partition number as 1.
  4. Give the default value by just pressing two times Enter key.
  5. Next press ‘P‘ to print the defined partition.
Please follow the same above instructions to create a partition on sd*(2) drive.

After creating partitions, verify both the drivers are correctly defined for RAID using the following commands.

#mdadm --examine /dev/sd[*-*]
#mdadm --examine /dev/sd[*-*]1


Creating RAID md devices 

Now since we have all the partitions with us, we will create RAID 0 array on those partitions, with the help of following commands.

# mdadm -Cv -l0 -c64 -n2 /dev/md0 /dev/sd{*,*}1
    -C, --create (Create a new array.)
    -v, --verbose (Be  more  verbose about what is happening.)
    -l, --level=  (Set RAID level.)
    -c, --chunk= (Specify chunk size of kilobytes.)

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

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

# cat /proc/mdstat

Create file-system and mount point

raid 0 array is ready, we will create a filesystem on top of /dev/md0 so it can be used for storing data.

#mkfs.xfs /dev/md0

Once xfs filesystem has been created for Raid device, now create a mount point directory and mount the device /dev/md0 under it.


# mkdir /raid0

# mount /dev/md0 /raid0/


Next, verify that the device /dev/md0 is mounted under /raid0 directory.

#df -hT

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                /raid0              xfs    defaults         0 0

Run mount ‘-a‘ to check if there is any error in fstab entry.

# mount -a

That’s it, we have seen here, how to configure RAID0 striping with raid levels by using two hard disks. In the next article, we will see how to setup RAID1.

check my youtube video "Creating RAID-0 (Stripe) in Linux" for your reference.



Comments

Post a Comment

Contact Form

Name

Email *

Message *

Popular posts from this blog

Red Hat Certified Systems Administrator – RHCSA (EX200) Ex@m practice 2022

Step-by-Step Install and Configure OpenLDAP on RHEL7/CentOS 7 Linux