In this video, you'll learn about RAID devices. RAID configurations are pretty common on enterprise
hardware. The goal of RAID is to offer an array of independent disks. That's also where
it stands for Redundant Array of Independent Disks. And that is for increased redundancy.
If one of the disks fails, you still have storage left to take care of it. There are
different types of RAID. RAID 0 is striping. Striping means that you create one big disk
device out of multiple disk devices. In striping, you don't take care of redundancy. So if one
of the disks breaks, you're in trouble. RAID 1 is mirroring. So if one of the disks breaks,
then the other one takes over. RAID 5 is striping with distributed parity. And RAID 6 is striping
with dual distributed parity. RAID 5 and RAID 6 both are using different disk devices in
such a way that if one of the disk devices breaks, you still can continue using your
storage. Then there is RAID 10, which is a combination between mirrored and striped.
RAID devices can be purchased hardware-wise. You can also create software RAID devices.
And that's what we are going to do here. If you want to, you can use either an entire
disk or you can put a partition in your RAID device. If you put a partition inside, then
make sure that you are setting the RAID device type. Next, you would use the mdadm command.
MD stands for multiple device and ADM, obviously, for administrator. You define the device that
you want to create, as well as the level, as well as the number of disks. Next, you
put the file system on it, you make the configuration persistent, and you mount it. And finally,
you put everything in etcfsstep. And you can monitor the status of your RAID devices through
slashproc slash mdstat or using mdadm. Let me show you. As you can see in LSBLK, I have
added two more disks, NVMe0, N4, and N5. And that is what I'm going to use in my RAID configuration.
So do we have mdadm? Yeah, we do have mdadm. And I am going to use it to create the device
md0. The level is 1. RAID level 1 is a simple RAID mirroring. So one of the disks is used
as the backup of the other disk. RAID disks is 2. And then I need to mention my devices.
So devnvme0n4 and devnvme0n5. So it is telling us that this RAID device might not be suitable
for booting. We don't talk about booting. So that is okay. And I'm continuing to create
the array. And you can see the device is already started. So next, you put a file system on
it. And then you create the configuration, mdadm, minus minus detail, minus minus scan.
You write that to the file etc. mdadm.conf. That will make sure that your configuration
is persistent, and you can re-initialize your RAID device. Then we need a mount point, so
the RAID directory. And I'm going to mount devmd0 on slash RAID. And now if I copy stuff
to this RAID device, it will be stored there. So if you want to make it persistent, you
need to put it in etcfsstep. And in etcfsstep, you are going to define your device. This
time, devmd0 is okay, because the device will be detected based on the metadata information
that has been written to the hard disk. So I'm mounting my devmd0 on slash RAID. The
file system is just exe4. The mount options are default and 0 and 0. And that will make
sure that it is persistent. You want to know what is going on? Well, have a look at the
contents of proc mdstat, which is a proc file that is giving synchronization information
about your RAID device. Or alternatively, use mdadm minus minus detail on your RAID
device. Like this, this is giving a little bit more detail about the current state. Now
when you are working with RAID devices, occasionally you will have to replace a failing device.
In order to do so efficiently, it's a smart idea to have an unused RAID member as a hot
spare. So when you are creating, you can create this way with minus minus spare devices is
one. And then you can fail a device, you can do it manually to test if it is working. And
after failure, you remove the device, and then you add the device that was marked as
a spare device previously. And that's how you replace failing devices.