• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to configure Test RAID 0 on Debian 11.3

  • 00:04 lsb_release -a
  • 00:16 lsblk
  • 00:32 apt-get install mdadm
  • 01:13 sudo mdadm -E /dev/sd[b-c]
  • 01:40 sudo fdisk /dev/sdb
  • 02:50 sudo fdisk /dev/sdc
  • 03:51 sudo mdadm -E /dev/sd[b-c]
  • 04:16 sudo mdadm -C /dev/md0 -l 0 -n 2 /dev/sdb1 /dev/sdc1
  • 04:57 sudo mkfs.ext4 /dev/md0
  • 05:12 sudo mdadm --detail /dev/md0
  • 05:39 mkdir raid
  • 05:49 mount /dev/md0 raid/
  • 06:08 vim /etc/fstab
  • 07:10 df -h
  • 07:23 cd raid/
  • 07:30 touch x y z
  • 07:44 mkdir XX YY ZZ
  • 07:53 ls -la
  • 08:18 sudo umount raid/
  • 08:32 sudo mdadm /dev/md0 -f /dev/sdb1
  • 09:09 nano /etc/fstab
  • 09:27 init 6
  • 09:35 cd raid/
  • 09:41 ls -la
{{postValue.id}}

To configure and test RAID 0 on Debian 11.3

Introduction:

RAID 0 creates striping to increase read/write speeds as data on separate disks can be read and written simultaneously. In order to increase disk access speed, you should use this level of RAID.

Installation Procedure:

Step1: Check the version of the Debian 11.3 by using the below command

root@LinuxHelp: ~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
Now list the disk by executing the following command

Step2: Now list the disk by executing the following command

root@linuxhelp: ~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   60G  0 disk
├─sda1   8:1    0   59G  0 part /
├─sda2   8:2    0    1K  0 part
└─sda5   8:5    0  975M  0 part [SWAP]
sdb      8:16   0   10G  0 disk
sdc      8:32   0   10G  0 disk
sr0     11:0    1  3.6G  0 rom

Step3: Install Prerequisites by using the below command:

root@linuxhelp:~# apt-get install mdadm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  exim4-base exim4-config exim4-daemon-light gsasl-common libgnutls-dane0
  libgnutls30 libgsasl7 libmailutils7 libntlm0 mailutils mailutils-common
Suggested packages:
  exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks gnutls-bin
  mailutils-mh mailutils-doc dracut-core

The following NEW packages will be installed:
  exim4-base exim4-config exim4-daemon-light gsasl-common libgnutls-dane0
  libgsasl7 libmailutils7 libntlm0 mailutils mailutils-common mdadm
The following packages will be upgraded:
  libgnutls30
1 upgraded, 11 newly installed, 0 to remove and 66 not upgraded.
Need to get 5,671 kB/7,012 kB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 mdadm amd64 4.1-11 [457 k                                                                                                                      B]
Get:2 http://security.debian.org/debian-security bullseye-security/main amd64 li                                                                                                                      bgnutls-dane0 amd64 3.7.1-5+deb11u2 [395 kB]

Step4: Check the disk whether there is already raid is configured or not by using the below command

root@linuxhelp:~# sudo mdadm -E /dev/sd[b-c]
mdadm: No md superblock detected on /dev/sdb.
mdadm: No md superblock detected on /dev/sdc.

Step5: Now create a partition by using the below command

root@linuxhelp:~# sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.36.1).
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 0x70697ae9.

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):




First sector (2048-20971519, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519):                                                                                                                       +1G

Created a new partition 1 of type 'Linux' and of size 1 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): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step6: Now follow the steps to create another partition by using the below command

root@linuxhelp:~# sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.36.1).
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 0x5cbc5163.

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):
First sector (2048-20971519, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-20971519, default 20971519):                                                                                                                       +1G





Created a new partition 1 of type 'Linux' and of size 1 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): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Step7: Verify the changes on both drives using the same mdadm command:

root@linuxhelp:~# mdadm -E /dev/sd[b-c]
/dev/sdb:
   MBR Magic : aa55
Partition[0] :      2097152 sectors at         2048 (type fd)
/dev/sdc:
   MBR Magic : aa55
Partition[0] :      2097152 sectors at         2048 (type fd)

Step8: Create RAID by using the below command

root@linuxhelp:~#sudo mdadm -C /dev/md0 -l 0 -n 2 /dev/sdb1 /dev/sdc1 
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.

Step9: Now format the raid in ext4 format by executing the below command

root@linuxhelp:~#sudo mkfs.ext4 /dev/md0 
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 523264 4k blocks and 130816 inodes
Filesystem UUID: e679f0af-2d22-4bca-95e4-5822bfbe211d
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

Step10: Now list the RAID details by enter the below command

root@linuxhelp:~#sudo mdadm --detail /dev/md0 
/dev/md0:
           Version : 1.2
     Creation Time : Sat Sep  3 23:15:58 2022
        Raid Level : raid0
        Array Size : 2093056 (2044.00 MiB 2143.29 MB)
      Raid Devices : 2
     Total Devices : 2
       Persistence : Superblock is persistent

       Update Time : Sat Sep  3 23:15:58 2022
             State : clean
    Active Devices : 2
   Working Devices : 2
    Failed Devices : 0
     Spare Devices : 0

            Layout : -unknown-
        Chunk Size : 512K

Consistency Policy : none

              Name : linuxhelp:0  (local to host linuxhelp)
              UUID : c5f66406:6ef1fa24:d0a80cc8:b4ce4fe2
            Events : 0

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

Step11 :Now create the directory for mount the raid to the drive by using the below command

root@linuxhelp:~# mkdir raid

Step12 :Now mount the raid to the directory by using the below command

root@linuxhelp:~# mount /dev/md0  raid/
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,nosuid,relatime,size=1472156k,nr_inodes=368039,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=299024k,mode=755 0 0
/dev/sda1 / ext4 rw,relatime,errors=remount-ro 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0

/dev/md0 /root/raid ext4 rw,relatime,stripe=256 0 0

Step13 :Add the line for permanent mounting by using the below command

root@linuxhelp:~# vim /etc/fstab 
/dev/md0 /root/raid ext4 rw,relatime,stripe=256 0 0

Now list the drive by executing the below command

root@linuxhelp:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.5G     0  1.5G   0% /dev
tmpfs           293M  1.5M  291M   1% /run
/dev/sda1        58G  7.2G   48G  13% /
tmpfs           1.5G     0  1.5G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           293M  104K  292M   1% /run/user/1000
/dev/md0        2.0G   24K  1.9G   1% /root/raid

Step14: Now enter into the raid directory and add some files on the directory by using the below command

root@linuxhelp:~# cd raid/
root@linuxhelp:~/raid# touch x y z
root@linuxhelp:~/raid# mkdir XX YY ZZ
root@linuxhelp:~/raid# ls -la
total 36
drwxr-xr-x 6 root root  4096 Sep  3 23:20 .
drwx------ 6 root root  4096 Sep  3 23:19 ..
drwx------ 2 root root 16384 Sep  3 23:16 lost+found
-rw-r--r-- 1 root root     0 Sep  3 23:19 x
drwxr-xr-x 2 root root  4096 Sep  3 23:20 xx
-rw-r--r-- 1 root root     0 Sep  3 23:19 y
drwxr-xr-x 2 root root  4096 Sep  3 23:20 yy
-rw-r--r-- 1 root root     0 Sep  3 23:19 z
drwxr-xr-x 2 root root  4096 Sep  3 23:20 zz

Step15: Unmount the directory and test the RAID 0 by using the below command

root@linuxhelp:~#sudo umount raid/

Step16: Now I am failing the sdb1 partition by using the below command

root@linuxhelp:~#sudo mdadm /dev/md0 -f /dev/sdb1 
mdadm: set device faulty failed for /dev/sdb1:  Device or resource busy

Step17: Now command the mounting from the fstab file by executing the below command

root@linuxhelp:~#vim /etc/fstab 

Step18: Restart my distro by executing the following command

root@linuxhelp:~# init 6

Step19: After the system is restarted then I am enter into the raid directory and list the directory all the data’s from the raid is corrupted

root@linuxhelp:~# cd raid/
root@linuxhelp:~/raid# ls -la
rwxr-xr-x 2 root root 4096 Sep  3 23:16 .
drwx------ 6 root root 4096 Sep  3 23:24 ..

Conclusion:

By this to configure and Test RAID 0 on Debian 11.3 has come to an end.

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is RAID 0?

A

RAID 0 will create striping to increase read/write speeds as the data can be read and written on separate disks at the same time. This level of RAID is what you want to use if you need to increase the speed of disk access.

Q

How many drives are needed for a RAID 0 volume?

A

To establish a RAID 0 volume, a minimum of at least 2 hard disk drives are required. Unlike RAID 1, the number of drives used in the array can be an odd or even number.

Q

Is RAID 0 or 1 better?

A

The write performance of RAID 0 is better than RAID 1. While the write performance of RAID 1 is slower than RAID 0.

Q

Which RAID is the fastest?

A

RAID 0 is by far the fastest RAID type. However, it is also the only RAID type without fault tolerance. If one drive fails, all data in the RAID 0 array are lost.

Q

Which command used to already raid is configured or not?

A

Use the following commands sudo mdadm -E /dev/sd[b-c]

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.