Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm’ Tool in Linux – Part 2

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Babin Lonston

I'm Working as a System Administrator for last 10 year's with 4 years experience with Linux Distributions, fall in love with text based operating systems.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

35 Responses

  1. Mark Miller says:

    Hello, I’m stuck at Step 4 with the following error: “cannot open /dev/sdb1: Device or resource busy”

    Any thoughts on how to continue?

    Regards, Mark

    • @Mark Miller

      What does cat /proc/mdstat gives ?

      Assume you have already tried creating raid in this disk before.

      Alright first you need to make the disk super block size to zero.

      Stop the RAID using

      # mdadm –stop /dev/md0

      Then reset the super-block size using below command

      # sudo mdadm –zero-superblock /dev/sda1

      Then remove the partition and recreate and follow the raid creation steps it will work.

    • @Mark Miller

      Assume you have already tried raid setup in this disk.
      Check using # cat /proc/mdstat

      Then stop the RAID using

      # mdadm –manage /dev/md0 –stop

      Then reset the superblock for sda disk

      # mdadm –zero-superblock /dev/sda

      Remove the partitions using fdisk

      Then try to create your RAID let me know how it went through..

  2. Babin says:

    @Priya Dividing and Writing data’s across multiple disk was defined by default Programming no idea were it was defined. RAID 0 was defined as striping. May be kernel Order’s to do RAID 0 to do the striping.

  3. Priya Prabhakar says:

    HI Babin,

    I want to clarify one doubt. When you said that while striping on 2 disk – disk0 and disk1 for RAID-0 The data “TECDH”in which T will be saved in disk0 and E will be saved in disk1 how it knows it should be saved alternatively, somewhere any program or any code that instruct this RAID setup to save the data in this way?

    Thanks in advance.

  4. KM says:

    Great work bro..appreciate it..

  5. k.nitesh says:

    excellent work………..

  6. @Khoi D. Dinh Most welcome, thanks for your feedback

  7. @ Omipenuin

    I’am pretty sure you have not saved the RAID configuration, So what after a restart you can’t see the disks.

    After creating a RAID set first you have to save the RAID configuration by using below command.

    # mdadm –detail –scan –verbose >> /etc/mdadm.conf

    After that just Restart and check for the raid device under

    # ls -l /dev/md0

    It want to list the md0 while we list. Now on-wards follow the below steps. After this Don’t create the file-system in md0 and don’t plan to mount it, cos you need LVM right.

    Then start to create the LVM by creating a Pv

    # pvcreate /dev/md0

    Then create a VG

    # vgcreate vg_tec /dev/md0

    Then create the LV for 500MB (just i’am using for demonstration, use your required size here)

    # lvcreate -n lv_tec -L 500M vg_tec

    Just list the lv using devices if so we can see which device holds the LVM

    # lvs -o+devices

    Then Make the file-system

    # mkfs.ext4 /dev/vg_tec/lv_tec

    Mount the file-system now

    # mkdir -p /mnt/lv_tec

    # mount /dev/vg_tec/lv_tec /mnt/lv_tec/

    # mount -av

    Then add the fstab entry

    # vim /etc/fstab

    Then restart the system

    # init 6

    After restart just check the mount point now

    # df -h

    or check the devices

    # lvs -o+devices

    Still you can’t find the LVM let me know.

    • Omipenuin says:

      Thanks Babin I will do it soon.Will update you about success or failure.

      And again thanks for teaching us in-depth about Software RAID you really spent so much time on this and we are thankful for that.

      • Omipenuin says:

        @Babin. I started to implement all the tuts you taught. Today I worked on this Part2 Implementing RAID0. After creating RAID0 and saving the conf of RAID i implemented LVM on RAID0 .

        And damn it worked. Issue before was just like you said previously i never saved the raid settings previously but now i saved the settings and after restarted system both raid and lvm are available.

        Simply great tutorial. THANKS

  8. Khoi D. Dinh says:

    Thank you.

  9. Omipenuin says:

    Babin when you make a tut for RAID 1 also make LVM on it.

    I tried many times to make LVM work on Software Raid 1 initially it works but when I restart then boom no lvm. LVM gone like never happened

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.