• WordPress
  • cPanel
  • Softaculous
  • KVM Virtualization
  • Vmware Virtualization
  • Proxmox
Monday, May 12, 2025
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
No Result
View All Result
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux
LinuxBoost
  • Home
  • Almalinux
  • CentOS
  • Debian
  • Fedora
  • Ubuntu
  • Red Hat Enterprise Linux
  • Rocky Linux
  • OpenSUSE
  • Arch Linux
  • Oracle Linux

How to Create RAID 1 on OpenSUSE

in Linux OS, OpenSUSE
How to Create RAID 1 on OpenSUSE

When it comes to ensuring data redundancy and reliability, RAID 1 (Redundant Array of Independent Disks) is an excellent choice for server administrators and home users alike. This article will guide you through the process of how to create RAID 1 on OpenSUSE, using mdadm, a powerful and flexible tool for managing RAID arrays.

Preparing for RAID 1 Setup

Before diving into the RAID 1 setup process, make sure you have at least two hard drives or SSDs of the same size installed on your system. Additionally, ensure you have root access or administrative privileges. You can reset your root password if needed.

How to Create RAID 1 on OpenSUSE

Install mdadm on OpenSUSE

First, you need to install mdadm on your OpenSUSE system. Open a terminal and enter the following command:

sudo zypper install mdadm

Enter your password when prompted, and mdadm will be installed.

Partition the Disks on OpenSUSE

Now that mdadm is installed, you need to partition your disks on OpenSUSE. You can use the fdisk utility to create partitions. In this example, we’ll use /dev/sdb and /dev/sdc as our two disks for RAID 1.

sudo fdisk /dev/sdb
sudo fdisk /dev/sdc

Follow these steps for both disks:

  1. Press n to create a new partition.
  2. Press p for a primary partition.
  3. Press 1 for the partition number.
  4. Press Enter twice to accept the default start and end values.
  5. Press t to change the partition type.
  6. Enter fd to set the partition type to Linux RAID Auto.
  7. Press w to write the changes and exit.

Create the RAID Array

With your partitions ready, it’s time to create the RAID 1 array. Run the following command:

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

This command creates a RAID 1 array with the name /dev/md0, using the partitions /dev/sdb1 and /dev/sdc1.

You can check the progress of the RAID 1 array creation with the following command:

cat /proc/mdstat

Wait for the array to finish building before proceeding to the next step.

Format the RAID Array

Once your RAID 1 array is built, format it using the mkfs.ext4 command:

sudo mkfs.ext4 /dev/md0

Mount the RAID Array

Create a new directory to mount your RAID 1 array:

sudo mkdir /mnt/raid1

Mount the RAID array to the newly created directory:

sudo mount /dev/md0 /mnt/raid1

To ensure that the RAID 1 array mounts automatically at boot, edit the /etc/fstab file:

sudo vim /etc/fstab

Add the following line at the end of the file:

/dev/md0 /mnt/raid1 ext4 defaults 0 0

Save the changes and exit.

Configure mdadm on OpenSUSE

To make sure that your RAID 1 array is recognized and assembled correctly during boot, update the mdadm configuration file:

sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf

This command appends the output of the mdadm --detail --scan command to the /etc/mdadm.conf file, ensuring that your RAID 1 array is correctly recognized during the boot process.

Test Your RAID 1 Array

To test your RAID 1 array, you can create a sample file on the mounted RAID 1 directory:

echo "This is a test file on RAID 1" | sudo tee /mnt/raid1/testfile.txt

Now, simulate a disk failure by removing one of the disks from the RAID 1 array. In this example, we’ll remove /dev/sdb1:

sudo mdadm /dev/md0 --fail /dev/sdb1
sudo mdadm /dev/md0 --remove /dev/sdb1

Check the contents of the RAID 1 directory to ensure that your test file is still accessible:

cat /mnt/raid1/testfile.txt

You should see the output “This is a test file on RAID 1.”

To add the removed disk back to the RAID 1 array, run the following command:

sudo mdadm /dev/md0 --add /dev/sdb1

Monitor the rebuilding process with:

cat /proc/mdstat

Wait for the rebuilding process to complete.

Conclusion

You have successfully set up a RAID 1 array on your OpenSUSE system using mdadm. RAID 1 provides data redundancy and fault tolerance, ensuring that your data remains safe even if one of the disks fails.

Now that you have a working RAID 1 setup, you may want to explore other Linux-related topics like how to manage software packages on OpenSUSE, how to install a LAMP stack on OpenSUSE, or how to set up an email server on OpenSUSE.

ShareTweet
Previous Post

How to Create and Manage Users on OpenSUSE

Next Post

How to Create RAID 5 on OpenSUSE

Related Posts

How to Install Tomcat on Rocky Linux

How to Install Apache Tomcat on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Set up NTP Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

How to Install Bacula Backup Server on Rocky Linux

Leave a Reply Cancel reply

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

Golden Host VPS
  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.

  • Privacy Policy
  • Terms and Conditions
  • About Us
  • Contact Us

Copyright © 2023 linuxboost.com All Rights Reserved.