Creating an additional software RAID (Linux)
Please use the “Print” function at the bottom of the page to create a PDF.
Valid for: customisable Dedicated Servers and Bare Metal Servers with software RAID and Linux
If you order a customisable Dedicated Server or a customisable Bare Metal Server with software RAID and additional storage, a Level 1 software RAID is only created for the server’s primary storage. In this case, you need to create a separate software RAID for the additional storage.
This article explains the advantages and disadvantages of the main RAID levels and the criteria you should consider when selecting the appropriate RAID level. It then uses an example to show how to use the mdadm program to create a separate Level 1 software RAID in Linux for the additional HDD, SSD, or NVMe storage devices you have purchased. We recommend this procedure to make the most of the benefits of RAID 1.
Depending on your use case, you can also set up RAID systems with other RAID levels for your storage devices.
Notes
If you order a customisable Dedicated Server or Bare Metal Server with software RAID, you must create a separate software RAID for the additional storage in the following cases:
You have ordered a customisable Dedicated Server or a customisable Bare Metal Server with software RAID that uses HDD storage as the primary storage and NVMe storage as additional storage.
You have ordered a customisable Dedicated Server or a customisable Bare Metal Server with software RAID that uses NVMe storage as the primary storage and HDD, SSD, or NVMe storage as additional storage.
Please Note
This article assumes that you have good knowledge of Linux server administration. The commands in this article must be adapted to your server’s configuration. Check and adjust them before you partition and format the storage devices and before you set up the additional software RAID. Otherwise, data loss may occur.
A RAID is no substitute for a backup. Back up your important data regularly.
Preparation: Installing the required software
On modern minimal installations (particularly AlmaLinux, Rocky Linux, and Debian), the tools for partitioning and RAID management are not always pre-installed. Before you start, install them with the following commands:
Ubuntu 24.04, Ubuntu 26.04, Debian 12, and Debian 13
apt update
apt install mdadm parted
AlmaLinux 9, AlmaLinux 10, Rocky Linux 9, and Rocky Linux 10
dnf install mdadm parted
Criteria for selecting the appropriate RAID level
RAID systems offer greater data security, higher speeds, or both. However, they are no substitute for regular backups. You should therefore back up your data regularly to prevent data loss.
You can determine which RAID level is suitable for your server by answering the following questions:
Which operating system is used on the server, and which RAID levels does it support?
What storage capacity is required? How much of the capacity of the storage devices used should be usable?
What are the requirements for read and write speeds?
What are the requirements for data security?
An overview of the main RAID levels
The following table lists the main RAID levels, along with their advantages and disadvantages:
| RAID 0 | RAID 1 | RAID 5 | RAID 6 | RAID 10 (1+0) | |
|---|---|---|---|---|---|
| Minimum number of storage devices (HDD, SSD, or NVMe) | 2 | 2 | 3 | 4 | 4 |
| Method used | Striping | Mirroring | Striping and parity | Striping and double parity | Striping of mirrored data |
| Fault tolerance | none | failure of one drive | failure of one drive | failure of two drives | failure of one drive per sub-array |
| Capacity utilisation |
100% Number of storage devices × capacity |
50% Capacity of one storage device |
67% (Number of storage devices – 1) × capacity |
50% (Number of storage devices – 2) × capacity |
50% (Number of storage devices / 2) × capacity |
| Write speed | very high | low | medium | low | medium |
| Read speed | very high | medium | high | high | very high |
| Advantages |
Higher bandwidth than single drives More input/output operations per second than single drives |
Full redundancy Data security and speed can optionally be increased with a suitable controller or software |
Increased reliability through parity Good price-performance ratio in terms of redundancy and storage efficiency |
High reliability thanks to double parity Slightly improved read throughput compared to single drives |
Increased read speed compared to single drives Increased reliability of the storage devices used |
| Disadvantages |
Higher probability of failure than single drives No redundancy: if a storage device fails, a large proportion of the data is lost |
The storage capacity of the array is at most as large as the capacity of the smallest storage device High cost |
Write speed is reduced compared to single drives Only part of the total storage capacity of the storage devices can be used |
Write speed is significantly reduced compared to single drives Only part of the total storage capacity can be used, particularly in smaller arrays |
Significantly reduced maximum available storage capacity If two storage devices in the same sub-array fail, the entire array fails |
Creating a separate Level 1 software RAID for the additional storage devices
This section explains how to partition the additional storage devices you have purchased. You will then learn how to use mdadm to create a separate Level 1 software RAID and add the additional storage devices to it.
Partitioning the additional storage devices
- Log in to the server as the root user.
To check the status of the software RAID, enter the following command:
cat /proc/mdstat
Information such as the following is displayed:
root@1B5A354:~# cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sdb1[0] sda1[1]
523200 blocks [2/2] [UU]
md4 : active raid1 sdb4[0] sda4[1]
1947523072 blocks super 1.2 [2/2] [UU]
bitmap: 0/15 pages [0KB], 65536KB chunk
md3 : active raid1 sdb3[0] sda3[1]
3904512 blocks super 1.2 [2/2] [UU]
md2 : active raid1 sdb2[0] sda2[1]
1427456 blocks super 1.2 [2/2] [UU]
unused devices: <none>
Notes
If the command cat /proc/mdstat returns the message No such file or directory, the MD RAID kernel module may not be loaded or may not be available.
If no software RAID exists yet, one of the following messages is displayed:
root@1B5A354:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]or
[root@90398B0 ~]# cat /proc/mdstat
Personalities :
unused devices: <none>This is the case if you have purchased a Dedicated Server or Bare Metal Server with hardware RAID. In this case, follow the steps in the article Creating an additional hardware RAID (Linux) to create an additional RAID.
Make a note of the names of the existing RAID arrays.
To list the existing disks and partitions, enter the following command:
root@1B5A354:~# fdisk -l
The fdisk program is a command-line tool for partitioning disks. You can use it to view, create, and delete partitions.
Look for disks without partitions whose size matches the additional disks you have ordered. Make a note of the names of these unpartitioned disks.
To display the existing disks with their model names and serial numbers, enter the following command:
root@1B5A354:~# ls -laht /dev/disk/by-id
Make a note of the model names and serial numbers of the existing disks.
To create a new GPT partition table and a primary partition that uses all the available space on each additional disk, adapt the commands below and then enter them. Only specify the additional, unpartitioned disks you noted. Otherwise, you will delete the data on the existing disks.
The -a opt option specifies that the optimal alignment mode is used. The mkpart primary command creates a new primary partition. The values 0% and 100% specify the start and end points of the new partition, so the partition occupies all the available space on the disk.
HDD/SSD
parted /dev/sda mklabel gpt -a opt
parted /dev/sda mkpart primary 0% 100%parted /dev/sdb mklabel gpt -a opt
parted /dev/sdb mkpart primary 0% 100%or
parted /dev/sdc mklabel gpt -a opt
parted /dev/sdc mkpart primary 0% 100%parted /dev/sdd mklabel gpt -a opt
parted /dev/sdd mkpart primary 0% 100%NVMe
parted /dev/nvme1n1 mklabel gpt -a opt
parted /dev/nvme1n1 mkpart primary 0% 100%parted /dev/nvme0n1 mklabel gpt -a opt
parted /dev/nvme0n1 mkpart primary 0% 100%To make sure that the kernel recognises the new partition tables, enter the command below. It instructs the kernel to re-read the partition tables and displays a summary of the partitions.
partprobe -s
Creating an additional RAID
To use the additional storage devices, create a new RAID array for them. This allows you to use the additional storage space independently of the existing RAID array. Then format the RAID array and mount it permanently.
Please Note
Before creating the RAID 1 array, make sure that you are using two identical storage devices of the same size.
Make sure that you specify the partitions, not the entire disks. Partition names end in 1 for SATA disks (e.g. /dev/sdc1) and in p1 for NVMe disks (e.g. /dev/nvme0n1p1).
To create a new RAID 1 array, adapt the following command and then enter it. Replace NUMBER with a number that is not yet used by an existing RAID array (e.g. 5 if md1 to md4 already exist). Replace PARTITION1 and PARTITION2 with the names of the new partitions:
mdadm --create /dev/mdNUMBER --level=1 --raid-devices=2 /dev/PARTITION1 /dev/PARTITION2
Examples:
Additional NVMe storage:
mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1
Additional HDD or SSD storage:
mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
or
mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1
After you enter the command, messages such as the following are displayed:
AlmaLinux 10
[root@localhost ~]# mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array?Debian 13
root@localhost:~# mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
To optimalize recovery speed, it is recommended to enable write-indent bitmap, do you want to enable it now? [y/N]?
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array [y/N]?Ubuntu 26.04
root@B2BFA03:~# mdadm --create /dev/md5 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
To optimalize recovery speed, it is recommended to enable write-indent bitmap, do you want to enable it now? [y/N]?
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array [y/N]?Confirm the prompts with Y. The additional software RAID is created.
To check the status of the software RAIDs, enter the following command:
[root@localhost ~]# cat /proc/mdstat
To format the RAID array with the file system of your choice, enter the matching command:
ext4
mkfs -t ext4 /dev/NAME-OF-RAID-ARRAY
Example:
[root@localhost ~]# mkfs -t ext4 /dev/md5
XFS
mkfs.xfs /dev/NAME-OF-RAID-ARRAY
Example:
[root@localhost ~]# mkfs.xfs /dev/md5
To create a directory in which to mount the new RAID, enter the following command:
mkdir /mnt/NEW-DIRECTORY
Examples:
mkdir /mnt/ext4drive
or
mkdir /mnt/xfsdrive
To mount the new software RAID, enter the following command:
mount /dev/NAME-OF-RAID-ARRAY /mnt/NEW-DIRECTORY
Example:
mount /dev/md5 /mnt/ext4drive
or
mount /dev/md5 /mnt/xfsdrive
To determine the UUID of the new software RAID, enter the following command:
blkid /dev/NAME-OF-RAID-ARRAY
Example:
blkid /dev/md5
Make a note of the UUID.
To mount the additional software RAID automatically at boot time, adapt the command below and then enter it:
echo 'UUID=UUID-OF-NEW-RAID /mnt/NEW-DIRECTORY FILE-SYSTEM defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
Examples:
ext4
echo 'UUID=3bc93d27-57a3-452b-b52f-71b21d74bd0c /mnt/ext4drive ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
XFS
echo 'UUID=ff4c71eb-1091-4742-a04f-06060887b20c /mnt/xfsdrive xfs defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
If you are using SSDs or NVMe drives, enter the command below. It enables regular TRIM operations, which help maintain the performance and lifespan of the drives.
systemctl enable --now fstrim.timer
To check the entries in the /etc/fstab file, enter the following command:
cat /etc/fstab
To reload the systemd configuration, enter the following command:
[root@localhost ~]# systemctl daemon-reload
To check the /etc/fstab file for errors, enter the following command:
mount -a
To check the available disk space, enter the following command:
df -h
Restart the system.
To check whether the RAID has been mounted, enter the following command:
mount