Table of Contents
Welcome to another exciting tutorial! Today, we’ll learn to set up a RAID 10 array on a Raspberry Pi 4 or, you can also use the Raspberry Pi 5. But before we dive into the details, let’s talk a bit about what RAID 10 is and why you should consider building one.
What is RAID 10?
RAID 10, also known as ‘1+0’ or ‘striped mirror,’ is a combination of two RAID levels –
- RAID 1 (mirroring)
- RAID 0 (striping).
This means you get the best of both worlds – the redundancy and reliability of RAID 1 and the speed of RAID 0. It is an excellent choice for data protection and performance. Whether you’re running a home server, media center, or just need a reliable backup solution, RAID 10 can be your answer.
Things You Will Need
To get started, here’s everything you need for this project.
- A Raspberry Pi 4 or Raspberry Pi 5.
- A USB 3.0 hub, uses a hub that you can power with an external power supply.
- A microSD card (16GB or larger).
- A card reader.
- At least four solid-state drives or hard drives, ideally all the same size. You can choose different capacity drives but the RAID 10 will be twice the size of the smallest capacity drive. For instance, if you choose one 128GB and three 512 GB, the final storage you’ll get will be 256GB.
- Four SATA III to USB 3.0 cables or enclosures.
- A router and an Ethernet cable.
- A 3D-printed casing (optional).
- A Windows, macOS, or Ubuntu system.
Step 1: Install and Update Raspberry Pi OS
On your Windows, macOS, or Ubuntu system, connect the microSD card using a card reader. Also, download and use the Raspberry Pi Imager tool to install the Raspberry Pi operating system on your Raspberry Pi.
Make sure to enable SSH connection from the settings or just place an SSH file in the boot partition of the SD card after the flash.
Step 2: Connect to Raspberry Pi 4/5 via SSH
Connect to the Raspberry Pi via SSH. Use Putty on Windows and Terminal on Ubuntu and macOS. To know the IP address of the Raspberry Pi, use the Fing network scanner app or log in to your router admin panel and check the DHCP list.
- On Putty, type the IP address of the Raspberry Pi and click Open. On the Terminal, type ssh IPaddress
- Type the SSH username and password (you set up during OS flash) followed by Enter key press.
- Once logged in, run the below commands:
sudo apt-get update && sudo apt-get upgrade -y
Step 3: Install MDADM and Webmin
mdadm is a Linux utility you can use to manage and monitor software RAID devices. Us the below command to Install it.
sudo apt install mdadm
Next, install the Webmin server using the below commands:
sudo nano /etc/apt/sources.list
Paste the following at the end:
deb http://download.webmin.com/download/repository sarge contrib deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
Press Ctrl + X, type Y, and hit the Enter key to save the changes.
Then run the below commands to finish the installation.
wget -qO - http://www.webmin.com/jcameron-key.asc | sudo apt-key add - sudo apt update && sudo apt install webmin -y
Once Webmin is installed, access webmin via web browser at https://ip-address-of-pi:10000.
Step 4: Partition SSDs or HDDs for RAID 10
Log in to the Webmin interface using the SSH username and password. Then connect all four SSDs or hard drives to the Raspberry Pi 4 or 5 using a powered USB hub. and follow these steps:
- Go to the Hardware > Partitions on Local Disks option in the Webmin interface
- The first drive will be the SD card, which you should recognize from its storage size. You’ll need to create partitions on the other four connected drives.
- Click on the externally connected SSD or HDD drive (one at a time) and then click Wipe Partitions.
- Choose MS-DOS from the options and click Wipe and Re-Label.
- Then go back and click Add primary partition.
- Choose the Linux EXT from the drop-down and click Create.
- Repeat steps 3–6 to wipe all drive partitions and create a Linux RAID partition on all four drives.
Step 5: Create RAID 10 on Raspberry Pi
Once all the drives are formatted and partitioned, follow these steps to create a RAID 10 array.
- Go to Hardware > Linux RAID.
- From the drop-down, choose RAID 10 (Striped and Mirrored).
- Click the Create RAID device of a level button.
- Then choose the drive partitions we created from the ‘Partitions in RAID’ list.
- Press and hold the CTRL key and then click on the four listed Linux RAID partitions to select them.
- Keep everything else as default and click Create.
This will create a RAID 10 array, listed under the Hardware > Linux RAID section as /dev/md0.
Step 6: Format and Mount RAID 10 Partition
First, format the RAID10 array and create EXT4 file system.
sudo mkfs.ext4 -v -m .1 -b 4096 -E stride=32,stripe-width=64 /dev/md0
Create a directory
sudo mkdir /media/SambaNAS
sudo mount /dev/md0 /media/SambaNAS
Change the ownership of the directory.
sudo chown ravi:ravi /media/SambaNAS
At this stage, you can check the RAID10 array storage and status in the Webmin GUI..
Step 7: Add Drives to FSTAB
Find the UUID of the RAID10 partition.
Note down the UUID of the RAID 10 partition. Then run the following command to open the FSTAB and then paste the below line of code at the end.
sudo nano /etc/fstab
UUID=(my_uuid) /media/SambaNAS ext4 defaults,noatime 0 0
Replace the UUID with the UUID of your RAID 10 partition and press CTRL + X, type Y, and then hit the Enter key to save the changes. To see if changes are saved, type
To access the RAID 10 storage location on the network (NAS), you can install and configure the Samba server on Raspberry Pi via Webmin or SSH.
Video Guide to Setup RAID 10 on Raspberry Pi
And there you have it, your very own RAID 10 array is up and running on your Raspberry Pi! Congratulations! I hope you found this tutorial both informative and empowering. RAID 10 is an excellent choice for data protection and performance, and now you have the skills to set it up on your own.
Remember, data storage and redundancy are crucial, whether you’re managing a home server, storing precious memories, or safeguarding critical work files.
If you encounter any issues or have questions during your RAID 10 journey, don’t hesitate to leave a comment below. We’re here to help.
Regularly back up your data. RAID 10 is fantastic, but it’s not a substitute for backups. Keep those important files safe!