How to configure RAID-0 on Fedora 34

To Configure RAID-0 on Fedora 34

Introduction:

RAID is a data storage virtualization technology that connects multiple physical disk drive components together as a logical unit to ensure data redundancy and improve performance. RAID 0 refers to the concept of storing data on drives that are split and mirrored. It is possible to lose the entire data from a corrupted drive.

Installation Procedure:

Step 1: Check the OS version by using the below command

 [root@linuxhelp ~]# cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy

Step 2: Install the mdadm package by using the below command.

[root@linuxhelp ~]# dnf install mdadm 
Fedora Modular 34 - x86_64                                                                                 8.7 kB/s | 6.7 kB     00:00    
Fedora Modular 34 - x86_64 - Updates                                                                        65 kB/s | 7.0 kB     00:00    


Fedora Modular 34 - x86_64 - Updates                                                                        65 kB/s | 146 kB     00:02    
Fedora 34 - x86_64 - Updates                                                                                54 kB/s | 7.0 kB     00:00    
Fedora 34 - x86_64 - Updates                                                                               1.2 MB/s | 4.7 MB     00:04    
Fedora 34 - x86_64                                                                                         7.5 kB/s | 6.8 kB     00:00    
MySQL 8.0 Community Server                                                                                 5.2 kB/s | 2.6 kB     00:00    
MySQL Connectors Community                                                                                 9.5 kB/s | 2.6 kB     00:00    
MySQL Tools Community                                                                                      9.9 kB/s | 2.6 kB     00:00    
Remi's Modular repository - Fedora 34 - x86_64                                                             1.1 kB/s | 858  B     00:00    
Remi's Modular repository - Fedora 34 - x86_64                                                             605 kB/s | 503 kB     00:00    
Remi's RPM repository - Fedora 34 - x86_64                                                                 1.3 kB/s | 858  B     00:00    
Remi's RPM repository - Fedora 34 - x86_64                                                                 2.5 MB/s | 2.8 MB     00:01    
Dependencies resolved.
Install  1 Package

Installed:
  mdadm-4.1-7.fc34.x86_64                                                                                                                  

Complete!

Step 3: Check the disk block by using the below command.

 [root@linuxhelp ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
└─sda2   8:2    0   19G  0 part /home
sdb      8:16   0   10G  0 disk 
sdc      8:32   0   10G  0 disk 
sr0     11:0    1  1.9G  0 rom  /run/media/linuxhelp/Fedora-WS-Live-34-1-2
zram0  252:0    0  4.1G  0 disk [SWAP]

Step 4: Create the partition by using the below command

[root@linuxhelp ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.36.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x0f7d4e1b.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +5G

Created a new partition 1 of type 'Linux' and of size 5 GiB.

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.

Command (m for help): p
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0f7d4e1b

Device     Boot Start      End  Sectors Size Id Type


/dev/sdb1        2048 10487807 10485760   5G fd Linux raid autodetect


Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step 5: Repeat the partition process as followed in the above step using the below command.

[root@linuxhelp ~]# fdisk /dev/sdc

Welcome to fdisk (util-linux 2.36.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xf7e5a544.

Command (m for help): n
Partition type
  p   primary (0 primary, 0 extended, 4 free)
  e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519): +5G

Created a new partition 1 of type 'Linux' and of size 5 GiB.

Command (m for help): t


Selected partition 1
Hex code or alias (type L to list all): l

Aliases:
  linux          - 83
  swap           - 82
  extended       - 05
  uefi           - EF
  
raid           - FD
  lvm            - 8E
  linuxex        - 85
Hex code or alias (type L to list all): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.

Command (m for help): p
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf7e5a544

Device     Boot Start      End  Sectors Size Id Type
/dev/sdc1        2048 10487807 10485760   5G fd Linux raid autodetect

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step 6: Check the disk block by using the below command.

 [root@linuxhelp ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
└─sda2   8:2    0   19G  0 part /home
sdb      8:16   0   10G  0 disk 
└─sdb1   8:17   0    5G  0 part 

sdc      8:32   0   10G  0 disk 
└─sdc1   8:33   0    5G  0 part 
sr0     11:0    1  1.9G  0 rom  /run/media/linuxhelp/Fedora-WS-Live-34-1-2
zram0  252:0    0  4.1G  0 disk [SWAP]

Step 7: Check the RAID availability by using the below command.

[root@linuxhelp ~]# mdadm -E /dev/sd[b-c]1
mdadm: No md superblock detected on /dev/sdb1.
mdadm: No md superblock detected on /dev/sdc1.

Step 8: Create the RAID-0 configuration by using the below command.

[root@linuxhelp ~]# mdadm --create /dev/md5 --level=stripe --raid-devices=2 /dev/sd[b-c]1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.

Step 9: Check the RAID-0 availability by using the below command.

[root@linuxhelp ~]# mdadm -E /dev/sd[b-c]1
/dev/sdb1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
Array UUID : 1db9640a:a9cb3fc6:ff68236a:61b9db18
           Name : linuxhelp:5  (local to host linuxhelp)
  Creation Time : Thu Dec  2 02:38:57 2021
     Raid Level : raid0
   Raid Devices : 2

 Avail Dev Size : 10475520 (5.00 GiB 5.36 GB)
    Data Offset : 10240 sectors
   Super Offset : 8 sectors
   
Unused Space : before=10160 sectors, after=0 sectors
          State : clean
    Device UUID : 0b70ed4f:a9105586:f8f1414f:a8224ece

    Update Time : Thu Dec  2 02:38:57 2021
  Bad Block Log : 512 entries available at offset 8 sectors
       Checksum : 96a36534 - correct
         Events : 0

     Chunk Size : 512K

   Device Role : Active device 0
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : 1db9640a:a9cb3fc6:ff68236a:61b9db18
           Name : linuxhelp:5  (local to host linuxhelp)
  Creation Time : Thu Dec  2 02:38:57 2021
     

Raid Level : raid0
   Raid Devices : 2

 Avail Dev Size : 10475520 (5.00 GiB 5.36 GB)
    Data Offset : 10240 sectors
   Super Offset : 8 sectors
   Unused Space : before=10160 sectors, after=0 sectors
          State : clean
    Device UUID : c8fc0e9b:960792b7:ff1a71c3:368b8103

    Update Time : Thu Dec  2 02:38:57 2021
  Bad Block Log : 512 entries available at offset 8 sectors
       Checksum : bc647a74 - correct
         Events : 0

     Chunk Size : 512K

   Device Role : Active device 1
   Array State : AA ('A' == active, '.' == missing, 'R' == replacing)

Step 10: Check the RAID-0 configured status by using the below command.

[root@linuxhelp ~]# cat /proc/mdstat
Personalities : [raid0] 
md5 : active raid0 sdc1[1] sdb1[0]
      10475520 blocks super 1.2 512k chunks
      
unused devices: <none>

Step 11: Check the RAID-0 configured status using the alternative command given below.

[root@linuxhelp ~]# mdadm --detail /dev/md5
/dev/md5:
           Version : 1.2
     Creation Time : Thu Dec  2 02:38:57 2021
        Raid Level : raid0
        Array Size : 10475520 (9.99 GiB 10.73 GB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Thu Dec  2 02:38:57 2021
             State : clean 
   
 Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

        Chunk Size : 512K

Consistency Policy : none

              Name : linuxhelp:5  (local to host linuxhelp)
              UUID : 1db9640a:a9cb3fc6:ff68236a:61b9db18
            Events : 0

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1

Step 12: Create the directory using the below command.

[root@linuxhelp ~]# mkdir /mnt/raid0

Step 13: Change the system file format using the below command.

 [root@linuxhelp ~]# mkfs.ext4 /dev/md5
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 2618880 4k blocks and 655360 inodes
Filesystem UUID: f7be5aa7-31f9-4578-9832-cf69027ef294
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            

Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

Step 14: Check the UUID by using the below command.

[root@linuxhelp ~]# blkid /dev/md5
/dev/md5: UUID="f7be5aa7-31f9-4578-9832-cf69027ef294" BLOCK_SIZE="4096" TYPE="ext4"

Step 15: Now, open the fstab configuration file and change the permanent mount by using the below command.

[root@linuxhelp ~]# vim /etc/fstab

Step 16: Create mount using the below command.

[root@linuxhelp ~]# mount -av
/                        : ignored
/boot                    : already mounted
/home                    : already mounted


/mnt/raid0               : successfully mounted

Step 17: Check the hard disk details by using the below command.

[root@linuxhelp ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        2.1G     0  2.1G   0% /dev
tmpfs           2.1G     0  2.1G   0% /dev/shm
tmpfs           835M  1.9M  833M   1% /run
/dev/sda2        19G  4.3G   15G  23% /
/dev/sda2        19G  4.3G   15G  23% /home
/dev/sda1       976M  166M  743M  19% /boot
tmpfs           2.1G   32K  2.1G   1% /tmp
tmpfs           418M  112K  418M   1% /run/user/1000

/dev/sr0        1.9G  1.9G     0 100% /run/media/linuxhelp/Fedora-WS-Live-34-1-2
/dev/md5        9.8G   37M  9.3G   1% /mnt/raid0

Step 18: Change the directory to this location and list the files using the below command.

[root@linuxhelp ~]# cd /mnt/raid0/
 [root@linuxhelp raid0]# ls -l
total 16
drwx------ 2 root root 16384 Dec  2 02:42 lost+found

Step 19: Create new file using cat command and list the files using the below command.

[root@linuxhelp raid0]# cat >> test
This is the test file

Step 20:Listing the files

[root@linuxhelp raid0]# ls -l
total 20
drwx------ 2 root root 16384 Dec  2 02:42 lost+found
-rw-r--r-- 1 root root    22 Dec  2 05:13 test

With this the process of installing RAID 0 On Fedora 34 has come's to an end

Tag : RAID Fedora Linux
FAQ
Q
What are the benefits of using drives set up as a RAID 0?
A
RAID 0 (disk striping) set will use the maximum amount of available storage capacity of each drive in the array, and allows for faster access and retrieval of data.
Q
What is the difference between "hardware" and "software" RAID 0 configurations?
A
Hardware-based RAID 0 uses a physical controller (either as a separate plug-in board or as part of the motherboard) that provides for the striping of data across the drives in the volume.
With a software-based RAID 0 volume, the drives are attached to a normal drive controller and software controls the order and writing to drives in the volume set.
Q
How many drives are needed for a RAID 0 volume?
A
A minimum of two hard disk drives must be used to create a RAID 0 volume. The number of drives used in the array can be odd or even, unlike RAID 1.
Q
What is meant by the term "disk striping"?
A
Striping data refers to storing consecutive segments of logically sequential data on different storage devices so that they can be accessed individually.
Q
What is a "RAID 0" configuration?
A
RAID 0 (zero) volume sets are a collection of hard disk drives that are combined and accessed together based on a predetermined configuration to allow for data striping across multiple drives. "RAID" stands for "Redundant Array of Independent Disks". A RAID 0 set is also known as a "striped without parity" and a "non-redundant" volume.