VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-create-raid-arrays-with-mdadm-on-ubuntu

โ‡ฑ Create RAID Arrays with mdadm on Ubuntu | DigitalOcean


Create RAID Arrays with mdadm on Ubuntu

Updated on March 25, 2026
Not using Ubuntu 22.04?
Choose a different version or distribution.
Ubuntu 22.04
๐Ÿ‘ Create RAID Arrays with mdadm on Ubuntu

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

Tutorial Series: How To Configure RAID Arrays on Ubuntu

RAID allows you to manage separate storage drives as a unified device with better performance or redundancy properties. In this series, weโ€™ll walk through RAID concepts and terminology, create software RAID arrays using Linuxโ€™s mdadm utility, and learn how to manage and administer arrays to keep your storage infrastructure running smoothly.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Last step editing the fstab echo โ€˜/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0โ€™ | sudo tee -a /etc/fstab

should be

echo โ€˜/dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 2โ€™ | sudo tee -a /etc/fstab

The 2 in the 0 space allows the system to boot the main os first then the array after. If left to 0 there is reports (and experienced myself) of the array not assembling in enough time before the system fully boots resulting in the nofail trigger to never report why it did not load. This is shown here fstab(5) - Linux manual page (man7.org)

Hi, thank you for this awesome tutorial (and others).

On a new Ubuntu 22.04 install I created a RAID 10 array per your code (sudo mdadm --create --verbose /dev/md0 --level=10 --layout=f2 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd) using f2 for a far/2-copies setup on a 4Tb x 4 array to get approx. 8Tb. Iโ€™ve created/mounted/saved per all of your instructions. I also set USB shares to mount at /media/ instead of /media/user/ per this tutorial. I started yesterday afternoon and currently when I run โ€œcat /proc/mdstatโ€ the resync = 13.7%.

My 2 questions, please and thank you:

Do I need to keep this computer on until the resync is finished, or can I reboot and assume it will continue where it left off?

At what point can I add md0 to Samba and start copying data onto the new array?

Newbie here, sorry:(

OK so I have followed this how-to several times now but seem to have ongoing issues with the array stability? Today I went to access the array as I had copied 1.5TB of data to it and it wasnโ€™t accessible? Said the super block was unreadable and I could not save the array. So now I am rebuilding it again as a Raid 6 volume. Currently waiting for the build to finish. I read the comment below about changing the 0 to a 2 so that the array would load at boot time and used that config. Is this causing me issues? I am running Ubuntu 22.04.3 LTS with a 256gb SSD OS drive and the 4 834gb SSD drives for the array which gives me a 1.7tb disk for storage. I am not a big Linux guy my day job is Windows admin so this stuff is a bit foreign to me. I am using this as a Photoprism photo respository and donโ€™t want to get all my photos on the array only to lose them down the road? Any help is much appreciated.

After following this guide for RAID 0 my RAID was not coming up automatically after reboot. I created the RAID on the partition instead of the device (used sda1 instead of sda) and itโ€™s working now.

There should be a section added to resetting devices. For drives that were formatted GTP there is a possibility that they will loose their superblock upon reboot causing the array to fail. This can be cleared off by sgdisk --zap /dev/sdX I spent a few days trying to figure out why my raid5 array wouldnโ€™t survive reboot. This fixed the problem by clearing whatever corrupted partition data was on the drive.

First, congrats on and thanks for an excellent article. Just what I need, as I want to implement a software raid at home.

I hate to be pedanticโ€ฆ

You have a typesetting issue above. In the code boxes, up in the first section on resetting the drives for the array, when you show a pathntame, such as /dev/sda, or /dev/whatever, your html causes a gap to appear that looks like a space between /dev/ and whatever follows. This looks to a beginner like a space. If you use the copy button, or copy manually, the path is correct in the copy buffer, but if you are retyping, you may be tricked into thinking that there is an extra separate argument.

The HTML is more intricate right there.

<span class="token parameter variable">--stop</span> /dev/<mark>md0</mark>

Itโ€™s the <mark> that does it.

This is on Chrome using a Chromebook.

Hi team,

If I got this heading where if I copied it, it will link up to the wrong heading

Creating and Mounting the Filesystem

It will link to:

Creating a RAID 0 Array

It needs to link to the sub heading in here as I am using RAID1 only, thanks.

Creating a RAID 1 Array

๐Ÿ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOceanโ€™s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow โ€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

ยฉ 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.