Hosting » DigitalOcean » How do I create a RAID array with Mdadm on Ubuntu 18.04 DigitalOcean?

How do I create a RAID array with Mdadm on Ubuntu 18.04 DigitalOcean?

Last updated on September 25, 2022 @ 2:33 pm

How to create a RAID array with mdadm on Ubuntu 18.04 DigitalOcean?

Now that Ubuntu 18.04 LTS is released, it is time to explore the new features and improve your productivity. Among other things, the new release includes a new tool called mdadm. mdadm is a powerful utility for managing RAID arrays.

In this article, we will show you how to create a RAID array with mdadm on Ubuntu 18.04 LTS.

First, we will show you how to install mdadm on Ubuntu 18.

After that, we will show you how to create a RAID array with mdadm. Finally, we will show you how to add a new disk to the RAID array.

1. Install mdadm on Ubuntu 18.04 LTS

To install mdadm on Ubuntu 18.04 LTS, you first need to install the Ubuntu kernel and the mdadm package. Then, you can install mdadm with the following command:

sudo apt-get install mdadm

2. Create a RAID array with mdadm

To create a RAID array with mdadm, you first need to specify the root device and the number of disks that the RAID array will use. The root device is the device from which the RAID array will boot.

In this example, we will use /dev/md0 as the root device and two disks, /dev/sda and /dev/sdb, as the disks in the RAID array.

To create the RAID array, use the following command:

mdadm –create –level=5 –raid-devices=2 /dev/md0

The –level=5 option specifies that the RAID array will use five levels of protection. The –raid-devices=2 option specifies that the RAID array will use two disks.

PRO TIP: RAID (Redundant Array of Independent Disks) is a storage technology that combines multiple physical disk drives into a single logical unit so that the failure of one disk drive does not result in data loss.

Mdadm is a Linux utility used to manage and monitor RAID devices.

Ubuntu 18.04 includes support for RAID 0, RAID 1, and RAID 10.

Creating a RAID array with Mdadm on Ubuntu 18.04 is a relatively straightforward process, but there are a few things you need to know before you get started.

1. Make sure you have enough disk drives for your desired RAID level. For example, if you want to create a RAID 0 array, you will need at least two disk drives.

2. Choose the disks you want to use for your RAID array carefully. All of the disks in your array must be of the same size and type.

3. Be aware that creating a RAID array will erase all data on the selected disk drives. Make sure you have backups of any important data before proceeding.

4. Follow the instructions carefully to avoid accidentally destroying your data or causing other problems.

3. Add a new disk to the RAID array

To add a new disk to the RAID array, use the following command:

mdadm –add /dev/sdc

4. Remove a disk from the RAID array

To remove a disk from the RAID array, use the following command:

mdadm –remove /dev/sda

5. Check the status of the RAID array

To check the status of the RAID array, use the following command:

mdadm –detail /dev/md0

Conclusion

In this article, we showed you how to create a RAID array with mdadm on Ubuntu 18.

We also showed you how to add a new disk to the RAID array and remove a disk from the RAID array.

Drew Clemente

Drew Clemente

Devops & Sysadmin engineer. I basically build infrastructure online.