- 1 1. Introduction
- 2 2. Basics of RAID 1
- 3 3. Building RAID 1 with Software RAID (mdadm)
- 4 4. How to Configure RAID 1 During Ubuntu Installation
- 5 5. RAID 1 Operation and Troubleshooting
- 6 6. Using Hardware RAID
- 7 7. Frequently Asked Questions (FAQ)
- 7.1 Q1. Can RAID 1 replace backups?
- 7.2 Q2. What happens if one disk fails during RAID 1 configuration?
- 7.3 Q3. Can I use RAID 1 on Ubuntu Desktop?
- 7.4 Q4. How can I periodically check the RAID status after configuring RAID 1?
- 7.5 Q5. Do I need to reinstall GRUB after replacing a disk in RAID 1?
- 7.6 Q6. Which is safer, mdadm or hardware RAID?
- 7.7 Q7. Is it possible to temporarily stop or restart a RAID array?
- 8 8. Conclusion
1. Introduction
Why Build RAID 1 on Ubuntu?
Ubuntu is a widely used Linux distribution, from personal to enterprise levels. Its high reliability and flexibility make it a popular choice for server applications. By building RAID 1 (mirroring) in an Ubuntu environment, you can ensure data redundancy and minimize the risk of data loss due to disk failure.
RAID 1 offers the advantage of writing the same data to two or more disks in real-time, allowing the entire system to continue operating even if one disk fails. Therefore, implementing RAID 1 is an effective protection measure for Ubuntu environments handling important files and services.
Differences Between Software RAID and Hardware RAID
There are two main methods for building RAID. One is hardware RAID, which is built using a dedicated RAID controller or the RAID functionality of the motherboard. The other is software RAID, which is configured using software on the OS (mainly mdadm
on Linux).
In Ubuntu, software RAID is the mainstream choice due to its cost-effectiveness and configuration flexibility. This article will focus on how to build RAID 1 in Ubuntu, covering installation-time configuration, operational and management points, and how to handle failures comprehensively.
What You Will Learn in This Article
By reading this guide, you will gain the following knowledge and skills:
- Fundamentals of RAID 1 and its operation on Ubuntu
- Procedure for building RAID 1 using software RAID (mdadm)
- RAID 1 rebuilding, status checking, and troubleshooting
- Differences and key considerations between Ubuntu Server and Desktop
- Practical FAQs and configuration knowledge for GRUB and fstab
Once RAID is built, it doesn’t require much maintenance, but understanding the initial setup is crucial. This article will explain practical information clearly, even for beginners, so please read to the end.
2. Basics of RAID 1
Types of RAID Levels and Features of RAID 1
RAID (Redundant Array of Independent Disks) is a technology that combines multiple hard disks to improve data safety and access speed. There are several “levels” of RAID, each with its own characteristics.
Typical RAID levels include:
- RAID 0: Uses striping for increased speed but has no redundancy
- RAID 1: Ensures redundancy through mirroring (the main topic of this article)
- RAID 5: Uses parity information across three or more disks for redundancy
- RAID 6: An enhanced version of RAID 5 with two parity blocks for higher fault tolerance
- RAID 10 (1+0): A configuration combining RAID 1 and RAID 0
Among these, RAID 1 employs the “mirroring” method, which writes the same data to two disks. Therefore, even if one disk fails, data can be read from the other, providing excellent availability.
Mirroring Mechanism (Diagram Image)
The mechanism of RAID 1 is very simple. For example, consider Disk A and Disk B:
[Writing]
User saves File A → Simultaneously written to Disk A and Disk B
[Reading]
Reading can be done from either disk, allowing for performance optimization
As you can see, data is always duplicated, making RAID 1 highly resistant to physical failures. This is its greatest advantage.
Differences Between Software RAID and Hardware RAID
There are two main ways to build RAID:
- Software RAID (e.g., mdadm)
The primary method used in Ubuntu. It performs RAID control at the OS level, offering flexible configuration and cost advantages. It provides the most freedom in building and managing RAID arrays and is widely used in general server construction. - Hardware RAID (RAID card or BIOS-integrated function)
Configures RAID using a dedicated controller. It reduces CPU load and is recognized by the OS as a single disk. However, recovery can be difficult if the controller fails.
What is Fake RAID (BIOS RAID)?
Some motherboards offer RAID functionality at the BIOS level. This is also known as “Fake RAID” or “BIOS RAID.”
While it appears to be hardware RAID, Fake RAID is actually controlled at the driver level, making its structure similar to software RAID. Although partially supported by Ubuntu, software RAID using mdadm is generally easier to manage and offers better recoverability, so Fake RAID is not typically recommended.
3. Building RAID 1 with Software RAID (mdadm)
3.1 Preparation and Requirement Check Before Building
To build RAID 1, you need at least two physical disks (or unused partitions). Disks already used as system disks are not suitable, so prepare dedicated storage.
First, check the target disks.
lsblk
Or check the details with:
sudo fdisk -l
We will proceed assuming the disks are /dev/sdb
and /dev/sdc
.
Note: Always ensure that the target disks do not contain important data before building. They will be formatted during RAID creation, and all data will be erased.
3.2 Installing mdadm
mdadm
is included in the standard Ubuntu repositories and can be easily installed with the following commands:
sudo apt update
sudo apt install mdadm
During installation, you may be asked about email notification settings, but these can be changed later. You can proceed with the default settings initially.
3.3 Steps to Create a RAID 1 Array
Once you have confirmed the target disks, create the RAID 1 array with the following command:
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
Command Explanation:
/dev/md0
: The name of the newly created RAID device--level=1
: Specifies RAID level 1 (mirroring)--raid-devices=2
: The number of devices to use in the configuration/dev/sdb /dev/sdc
: The actual disks to be used
After creation, you can check the status with the following command:
cat /proc/mdstat
If the output shows /dev/md0
along with synchronization information, the RAID 1 creation was successful.
3.4 Persistent Configuration of RAID (mdadm.conf and fstab)
The RAID array will not be automatically recognized after a reboot unless you configure it for persistence.
First, save the current RAID configuration to mdadm.conf
.
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
Next, create a file system on the RAID array (e.g., ext4):
sudo mkfs.ext4 /dev/md0
Create a mount point and mount it:
sudo mkdir -p /mnt/raid1
sudo mount /dev/md0 /mnt/raid1
After verifying it works, add it to /etc/fstab
using its UUID for automatic mounting:
sudo blkid /dev/md0
Based on the output UUID, add the following line to /etc/fstab
:
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/raid1 ext4 defaults 0 0
Now, the RAID 1 array will be automatically mounted after a reboot.
4. How to Configure RAID 1 During Ubuntu Installation
4.1 Steps to Configure RAID on Ubuntu Server Installer
The Ubuntu Server installer supports advanced storage configurations such as RAID and LVM. Here’s how to configure RAID 1.
Step 1: Boot from Installation Media
Write the Ubuntu Server ISO to a USB drive or similar and boot the target machine.
Step 2: Complete Network and Basic Settings
Complete the initial settings such as language, keyboard, and network configuration in order.
Step 3: Proceed to Storage Configuration
Instead of “Guided,” select “Custom Storage Layout.”
Step 4: Configure RAID
- Select two empty disks.
- Create partitions (e.g., /boot, swap, /, etc.).
- Select “Create Software RAID.”
- Choose RAID 1 and select the target devices to configure the array.
- Assign a file system to the RAID array and specify the mount point.
Step 5: Install Bootloader (GRUB)
It is recommended to install GRUB on both disks in a RAID configuration. This ensures that the system can boot even if one disk fails.
4.2 Using RAID on Ubuntu Desktop
Ubuntu Desktop does not have a built-in RAID configuration feature during installation. Therefore, if you want to use RAID 1, you will need to follow these steps:
Method 1: Manually Configure RAID from Live Environment → Install Desktop Environment
- Boot from a Live USB.
- Build RAID 1 using
mdadm
. - Install the Desktop environment on the RAID device (e.g., /dev/md0).
- Adjust the settings for
grub
andfstab
.

This method is a bit more involved but offers high flexibility and is effective if you want to use RAID 1 with a GUI environment.
Method 2: Configure RAID on Server Edition → Add GUI Packages Later
Install the Server edition, which allows RAID configuration, and then add the ubuntu-desktop
meta-package to build the GUI environment.
sudo apt update
sudo apt install ubuntu-desktop
This method is highly stable and recommended if you want to add a GUI to an already RAID-configured environment.
Desktop vs. Server Selection Criteria
Comparison Item | Server Edition | Desktop Edition |
---|---|---|
Ease of RAID Configuration | ◎ Built into the installer | △ Manual configuration required |
GUI Availability | × (CLI-focused) | ◎ (GUI standard) |
Beginner-Friendly | △ Requires familiarity | ◎ Easy installation |
Flexibility | ◎ Specialized for server use | ○ Can be adapted with customization |
When considering operation centered around RAID, choosing the Server edition from the beginning allows for smoother construction. If you prefer Desktop, configuring from a Live environment or adding a GUI later is suitable.
5. RAID 1 Operation and Troubleshooting
5.1 Monitoring and Checking RAID Array Status
Regularly monitoring the status of your RAID 1 array is crucial for early detection of failures. You can check the current status of the RAID array with the following command:
cat /proc/mdstat
This command displays the synchronization status of the RAID array and whether any disks have failed. During synchronization, it will show something like [UU]
, and if there is an underscore like [_U]
, it indicates that one disk is missing.
For more detailed information, use the following command:
sudo mdadm --detail /dev/md0
The output will show the status of each device, UUID, rebuild progress, etc. Consider setting up regular log checks or email notifications.
5.2 Handling Disk Failure and Rebuilding Procedure
A major strength of RAID 1 is that operation can continue even if one disk fails. However, you need to respond promptly when a failure occurs.
【Step 1】Identify the Failed Disk
In the mdadm --detail
output, if a device is listed as “Removed” or “Faulty,” that is the problematic disk.
【Step 2】Remove the Failed Disk from the RAID Array
sudo mdadm /dev/md0 --remove /dev/sdX
(Replace /dev/sdX
with the actual disk name)
【Step 3】Prepare a New Disk
Install a new disk, and if you need to create a partition:
sudo fdisk /dev/sdX
It is preferable to set the type to fd
(Linux RAID autodetect) for RAID.
【Step 4】Add the New Disk to the RAID Array and Start Resynchronization
sudo mdadm /dev/md0 --add /dev/sdX
After this, you can check the rebuilding progress with cat /proc/mdstat
. This may take anywhere from a few minutes to several hours.
5.3 GRUB Installation and Ensuring Redundancy
In a RAID 1 configuration, installing the bootloader (GRUB) on both disks allows the system to continue booting even if one disk fails.
To install GRUB on the other disk in an already installed system:
sudo grub-install /dev/sdX
sudo update-grub
(Replace /dev/sdX
with the new disk)
Update the GRUB configuration:
sudo update-grub
By performing these steps, you will be able to boot the system by simply switching the boot order in the BIOS, even if one disk fails. Multiple GRUB installations are essential to maximize the redundancy of RAID.
6. Using Hardware RAID
6.1 What is Hardware RAID?
Hardware RAID configures RAID arrays using a dedicated RAID controller (RAID card). Since the RAID processing is handled by the controller rather than the OS or CPU, it offers performance advantages and reduces CPU load.
Also, the OS recognizes it as a single disk, so you can treat it as regular storage without configuring mdadm.
6.2 Advantages and Disadvantages of Using Hardware RAID on Ubuntu
Advantages:
- RAID processing is handled by hardware, reducing CPU load.
- RAID can be configured at the BIOS level, allowing OS-independent implementation.
- Faster data recovery in case of failure, with many models supporting hot-swapping.
Disadvantages:
- If the RAID card itself fails, recovery can be difficult without the same model and firmware.
- Dependent on the RAID card, making flexible migration and debugging challenging.
- Higher cost (RAID cards can range from several hundred to thousands of dollars).
6.3 Checking and Managing Hardware RAID on Ubuntu
If a machine with Ubuntu installed has a RAID card connected, the OS will display the RAID array as a regular block device (e.g., /dev/sda
). Therefore, it will not be recognized by the mdadm command.
To check the status of the RAID array, you need to use the dedicated utility provided by the RAID card manufacturer.
Common RAID cards and tools:
Manufacturer | Tool Name (Example) | Notes |
---|---|---|
LSI / Broadcom | storcli or MegaCLI | Commonly installed in many servers |
HP / HPE | hpssacli or ssacli | For ProLiant series |
Dell | omreport (OpenManage) | For Dell-specific servers |
Intel | Intel RAID Web Console , etc. | Some offer GUI support |
To use these on Ubuntu, you need to download and install the Linux-compatible package (.deb) from the manufacturer’s official website.
6.4 Be Aware of the Difference from Fake RAID (BIOS RAID)
There is also “Fake RAID,” which looks like hardware RAID but actually emulates RAID at the BIOS level. Since it configures RAID by providing drivers to the OS, its behavior is essentially similar to software RAID.
Using Fake RAID on Ubuntu requires special configurations for “dmraid” or “mdadm,” and it is prone to more recovery and compatibility issues, so it is generally not recommended for beginners.
6.5 When Should You Choose Hardware RAID?
Consider implementing hardware RAID in the following situations:
- Large-scale server applications managing a large amount of storage centrally.
- When RAID card-specific features such as hot-swapping or battery-backed cache are required.
- When you want to concentrate CPU resources on tasks other than storage control.
- When you need stricter failure detection and log management than software RAID offers.
Conversely, for small file servers or personal use, software RAID using mdadm offers better cost-performance and flexibility.
7. Frequently Asked Questions (FAQ)
Q1. Can RAID 1 replace backups?
A1. No, RAID 1 is not a substitute for backups.
RAID 1 is a redundant configuration to prevent system downtime due to disk failure. If you accidentally delete files, are affected by malware, or experience data corruption due to OS issues, both disks will be equally affected. Therefore, it is essential to use it in conjunction with a separate backup.
Q2. What happens if one disk fails during RAID 1 configuration?
A2. The system will continue to operate normally on the remaining healthy disk.
Since RAID 1 is a mirrored configuration, the system will continue to run even if one disk physically fails. After confirming the error in the logs, you can replace the failed disk with a new one, re-add it to the RAID array, and resynchronize to recover.
Q3. Can I use RAID 1 on Ubuntu Desktop?
A3. Yes, it is possible. However, you cannot configure RAID from the installer.
Since the standard Ubuntu Desktop installer does not have a RAID configuration feature, you can use the following two methods:
- Manually configure RAID from a Live USB before installing the OS.
- Configure RAID on Ubuntu Server and then install the GUI.
The latter is less prone to issues and is recommended for beginners.
Q4. How can I periodically check the RAID status after configuring RAID 1?
A4. Use cat /proc/mdstat
or mdadm --detail /dev/md0
.
To check the operating status of the RAID, use the following commands:
cat /proc/mdstat
sudo mdadm --detail /dev/md0
You can also set up notification settings in /etc/mdadm/mdadm.conf
to receive email alerts.
Q5. Do I need to reinstall GRUB after replacing a disk in RAID 1?
A5. Yes, you need to install GRUB on the replacement disk as well.
In a RAID 1 configuration, installing GRUB on both disks ensures redundancy. If you only install it on one, the system may not boot if that disk fails.
sudo grub-install /dev/sdX
sudo update-grub
(Replace /dev/sdX
with the new disk)
Q6. Which is safer, mdadm or hardware RAID?
A6. It depends on the usage environment, but for personal use or small servers, mdadm is generally easier to handle and safer.
Hardware RAID is high-performance and reliable, but recovery can be difficult if the RAID card fails, and you may need the same model card. On the other hand, since mdadm is self-contained within Linux, there is a lot of information available for troubleshooting, making it easier to deal with issues.
Q7. Is it possible to temporarily stop or restart a RAID array?
A7. Yes, it is possible to stop and restart an array. However, caution is required.
Example stop command:
sudo mdadm --stop /dev/md0
Example restart (re-assemble) command:
sudo mdadm --assemble --scan
Note: Make sure to configure mdadm.conf
and initramfs
so that the array is automatically assembled at boot time.
8. Conclusion
RAID 1 is for “Ensuring Redundancy”
The greatest feature of RAID 1 is its ability to duplicate data in real-time, allowing operation to continue even if one disk fails. This helps avoid unexpected service interruptions due to hardware failures. However, it’s crucial to remember that RAID is not a substitute for backups. A separate backup system is essential for dealing with deletion, overwriting, and virus damage.
RAID Options in Ubuntu
In Ubuntu, you can choose a RAID configuration method according to your situation and purpose:
Configuration Method | Features | Recommended Use |
---|---|---|
mdadm (Software RAID) | Flexible and low-cost to build. Abundant information available. | Personal users, small servers |
Hardware RAID | High-performance, low CPU load. Expensive and recovery can be difficult. | Enterprise use, large storage environments |
Fake RAID (BIOS RAID) | Hybrid nature. Not recommended for Ubuntu. | Generally best to avoid |
Especially for Ubuntu users, building with mdadm is the most practical option.
Operation and Maintenance After Building Determine Reliability
Building RAID is just the starting point. Regular status checks, prompt response to failures, and proper configuration of GRUB and fstab are key to achieving long-term stable operation. Here are some important maintenance points:
- Regular checks with
cat /proc/mdstat
andmdadm --detail
- Understanding the RAID array rebuilding procedure
- Boot redundancy through multiple GRUB installations
- Using regular backups in conjunction
Finally
Even if RAID seems difficult, with Ubuntu and mdadm
, it can be built simply using command-line operations. By referring to the content of this article, even those new to RAID should be able to create a robust system environment that is resistant to problems.
We hope you will utilize RAID 1 in your future server operations and system design to enjoy a safe and stable Linux life.