1
00:00:00,000 --> 00:00:11,780
In this video, you'll learn about RAID devices. RAID configurations are pretty common on enterprise

2
00:00:11,780 --> 00:00:18,940
hardware. The goal of RAID is to offer an array of independent disks. That's also where

3
00:00:18,940 --> 00:00:26,219
it stands for Redundant Array of Independent Disks. And that is for increased redundancy.

4
00:00:26,219 --> 00:00:31,040
If one of the disks fails, you still have storage left to take care of it. There are

5
00:00:31,040 --> 00:00:36,880
different types of RAID. RAID 0 is striping. Striping means that you create one big disk

6
00:00:36,880 --> 00:00:42,599
device out of multiple disk devices. In striping, you don't take care of redundancy. So if one

7
00:00:42,599 --> 00:00:49,279
of the disks breaks, you're in trouble. RAID 1 is mirroring. So if one of the disks breaks,

8
00:00:49,279 --> 00:00:56,200
then the other one takes over. RAID 5 is striping with distributed parity. And RAID 6 is striping

9
00:00:56,660 --> 00:01:01,939
with dual distributed parity. RAID 5 and RAID 6 both are using different disk devices in

10
00:01:01,939 --> 00:01:06,540
such a way that if one of the disk devices breaks, you still can continue using your

11
00:01:06,540 --> 00:01:12,980
storage. Then there is RAID 10, which is a combination between mirrored and striped.

12
00:01:12,980 --> 00:01:18,220
RAID devices can be purchased hardware-wise. You can also create software RAID devices.

13
00:01:18,220 --> 00:01:23,180
That's what we are going to do here. If you want to, you can use either an entire disk

14
00:01:23,199 --> 00:01:28,760
or you can put a partition in your RAID device. If you put a partition inside, then make sure

15
00:01:28,760 --> 00:01:36,000
that you are setting the RAID device type. Next, you would use the mdadm command. MD

16
00:01:36,000 --> 00:01:41,839
stands for multiple device and ADM, obviously, for administrator. You define the device that

17
00:01:41,839 --> 00:01:46,919
you want to create, as well as the level, as well as the number of disks. Next, you

18
00:01:46,919 --> 00:01:52,919
put a file system on it. You make the configuration persistent and you mount it. And finally,

19
00:01:52,919 --> 00:01:58,160
you put everything in etcfsstep. And you can monitor the status of your RAID devices

20
00:01:58,160 --> 00:02:06,440
through slashproc slash mdstat or using mdadm. Let me show you. As you can see in LSBOK,

21
00:02:06,440 --> 00:02:12,720
I have added two more disks, NVMe 0, N4, and N5. And that is what I'm going to use in my

22
00:02:12,720 --> 00:02:20,839
RAID configuration. So do we have mdadm? Yeah, we do have mdadm. And I am going to use it

23
00:02:20,839 --> 00:02:28,440
to create the device md0. The level is one. RAID level one is a simple RAID mirroring.

24
00:02:28,440 --> 00:02:36,800
So one of the disks is used as the backup of the other disk. RAID disks is two. And

25
00:02:36,800 --> 00:02:47,600
then I need to mention my devices. So dev NVMe 0, N4, and dev NVMe 0, N5. So it is telling

26
00:02:47,600 --> 00:02:53,240
us that this RAID device might not be suitable for booting. We don't talk about booting.

27
00:02:53,240 --> 00:02:59,320
So that is OK. And I'm continuing to create the array. And you can see the device is already

28
00:02:59,320 --> 00:03:07,320
started. So next, you put a file system on it. And then you create the configuration

29
00:03:07,320 --> 00:03:18,679
mdadm, minus minus detail, minus minus scan. And you write that to the file etc mdadm.conf.

30
00:03:18,679 --> 00:03:23,399
That will make sure that your configuration is persistent. And you can reinitialize your

31
00:03:23,399 --> 00:03:29,160
RAID device. Then we need a mount point, so the RAID directory. And I'm going to mount

32
00:03:29,160 --> 00:03:38,639
dev md0 on slash RAID. And now if I copy stuff to this RAID device, it will be stored

33
00:03:38,639 --> 00:03:50,199
there. So if you want to make it persistent, you need to put it in etc fsstep. And in etc

34
00:03:50,199 --> 00:03:57,720
fsstep, you are going to define your device. This time, dev md0 is OK, because the device

35
00:03:57,720 --> 00:04:03,320
will be detected based on the metadata information that has been written to the hard disk. So

36
00:04:03,320 --> 00:04:11,080
I'm mounting my dev md0 on slash RAID. The file system is just ext4. The mount options

37
00:04:11,080 --> 00:04:17,679
are default and 0 and 0. And that will make sure that it is persistent. You want to know

38
00:04:17,679 --> 00:04:24,839
what is going on? Well, have a look at the contents of proc mdstat, which is a proc file

39
00:04:24,839 --> 00:04:30,440
that is giving synchronization information about your RAID device. Or alternatively,

40
00:04:30,440 --> 00:04:36,600
use mdadm minus minus detail on your RAID device. Like this, this is giving a little

41
00:04:36,600 --> 00:04:42,799
bit more detail about the current state. Now, when you are working with RAID devices, occasionally

42
00:04:42,799 --> 00:04:49,200
you will have to replace a failing device. In order to do so efficiently, it's a smart

43
00:04:49,200 --> 00:04:55,959
idea to have an unused RAID member as a hot spare. So when you are creating, you can create

44
00:04:55,959 --> 00:05:02,640
this way with minus minus spare devices is one. And then you can fail a device. You can

45
00:05:02,640 --> 00:05:08,239
do it manually to test if it is working. And after failure, you remove the device, and

46
00:05:08,239 --> 00:05:13,239
then you add the device that was marked as a spare device previously. And that's how

47
00:05:13,239 --> 00:05:15,040
you replace failing devices.

