This is a continuation of the Ultimate HTPC Build Article. I know that was 3 years ago, but I’m bad at procrastinating. In this guide, you will create a RAID array. First with two drives in RAID1. And then later adding more drives and converting your RAID array into RAID5 or RAID6.
RAID1 – Beginnings
The first two common RAID levels are RAID0 and RAID1.
In RAID0, there is no redundancy. If you lose a disk, you lose all data on that disk. RAID0 is a glorified way to create a single logical volume from multiple physical disks. There’s also performance benefits, but a home theater PC like we’re building does not demand particularly fast storage.

RAID1 is the simplest redundancy tactic: complete redundancy. All volumes in a RAID1 array are kept identical, allowing all but one to fail to restore the entire array. A RAID1 array with two 8TB hard drives will only have 8TB of logical space, but require 16TB of physical storage.

If you choose to start with 2 disks, it’s recommended to use RAID1. Any more advanced RAID levels require at least 3 drives to be useful, and RAID0 does not allow for drive failures, putting your data at risk.
The Commands
After installing your two identical hard drives and booting into Linux, get the names of the hard drives with
lsblk
Let’s say they were sd
b and sdc
. Note that I do not specify partition names because the drives do not have to be formatted.
Next install mdadm. This is the tool we will use to manage our software RAID.
sudo apt update
sudo apt install mdadm
To create the array, run
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sd
c
Side note, if you are starting with extra disks and want to skip straight to RAID5 or RAID6, use one of the two alternate commands below
sudo mdadm --create --verbose /dev/md0 --level=5 --raid-devices=2 /dev/sdb /dev/sdc /dev/sdd sudo mdadm --create --verbose /dev/md0 --level=6 --raid-devices=2 /dev/sdb /dev/sdc ...
This will start the process of creating and building the array. You can monitor progress with
sudo mdadm --detail /dev/md0
or
cat /proc/mdstat
Once the build is complete, it must be formatted. Run
sudo mkfs.ext4 /dev/md0
Finally, you need to specify a permanent mount point for it. I mount mine conveniently at /raid
sudo mkdir /raid
sudo mount /dev/md0 /raid
sudo echo “/dev/md0 /raid ext4 default,nofail,discard 0 0” >> /etc/fstab
And you’re all good to go! After adding a 3rd drive in the future, read the next section.
RAID5 – Progress
When you add additional disks, it is recommended to change from total redundancy to parity. A RAID5 array will use one drive for parity, with the others making full use of their physical capacity. This means that an array of three 8TB drives (24TB total physical storage) will have 16TB of usable storage. If any one drive in the array fails, it can be reconstructed from the others.

Below is the sequence of commands to add a 3rd disk, /dev/sdX, to your RAID1 array and change it and change to RAID 5.
sudo mdadm --grow /dev/md0 -l 5
sudo mdadm /dev/md0 --add-spare /dev/sdX
sudo mdadm --grow /dev/md0 -n 3
This will begin the process of rebuilding your RAID into level 5 across all 3 hard drives. You may continue using the system while it rebuilds, but disk performance will be degraded. You can check on rebuild progress with
sudo mdadm --detail /dev/md0
or
cat /proc/mdstat
When the rebuild is complete, resize your filesystem to take advantage of the new disk space with
sudo resize2fs /dev/md0
In the future if you ever need to add another disk, just run:
sudo mdadm /dev/md0 --add-spare /dev/sdX
sudo mdadm --grow /dev/md0 -n ##
# Wait for rebuild to finish...
sudo resize2fs /dev/md0
Once you have 5 or more drives, I recommend reading the next section.
RAID6 – Completion
RAID level 6 has two drives dedicated to parity, which allows two drives to fail and be reconstructed from the remaining. RAID6 requires at least three drives, although it needs at least 4 to be more useful than RAID1. I would personally switch to RAID6 after adding your fifth drive.

Converting to a RAID6 is simple. You MUST have at least three drives in the RAID before running this command.
sudo mdadm --grow /dev/md0 -l
6
Again, monitor the status of the operation with
sudo mdadm --detail /dev/md0
or
cat /proc/mdstat
And you RAID is good to go! If you would like to add more drives in the future, follow the same instructions as in the previous section.