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,680 --> 00:01:01,919 with dual distributed parity. RAID 5 and RAID 6 both are using different disk devices in 10 00:01:01,919 --> 00:01:06,519 such a way that if one of the disk devices breaks, you still can continue using your 11 00:01:06,519 --> 00:01:12,959 storage. Then there is RAID 10, which is a combination between mirrored and striped. 12 00:01:12,959 --> 00:01:17,639 RAID devices can be purchased hardware-wise. You can also create software RAID devices. 13 00:01:17,639 --> 00:01:22,519 And that's what we are going to do here. If you want to, you can use either an entire 14 00:01:22,519 --> 00:01:28,320 disk or you can put a partition in your RAID device. If you put a partition inside, then 15 00:01:28,320 --> 00:01:35,080 make sure that you are setting the RAID device type. Next, you would use the mdadm command. 16 00:01:35,080 --> 00:01:41,760 MD stands for multiple device and ADM, obviously, for administrator. You define the device that 17 00:01:41,760 --> 00:01:46,879 you want to create, as well as the level, as well as the number of disks. Next, you 18 00:01:46,879 --> 00:01:52,919 put the file system on it, you make the configuration persistent, and you mount it. And finally, 19 00:01:52,919 --> 00:01:58,639 you put everything in etcfsstep. And you can monitor the status of your RAID devices through 20 00:01:58,639 --> 00:02:06,760 slashproc slash mdstat or using mdadm. Let me show you. As you can see in LSBLK, I have 21 00:02:06,760 --> 00:02:14,600 added two more disks, NVMe0, N4, and N5. And that is what I'm going to use in my RAID configuration. 22 00:02:14,600 --> 00:02:22,240 So do we have mdadm? Yeah, we do have mdadm. And I am going to use it to create the device 23 00:02:22,240 --> 00:02:30,240 md0. The level is 1. RAID level 1 is a simple RAID mirroring. So one of the disks is used 24 00:02:30,240 --> 00:02:38,759 as the backup of the other disk. RAID disks is 2. And then I need to mention my devices. 25 00:02:38,759 --> 00:02:50,039 So devnvme0n4 and devnvme0n5. So it is telling us that this RAID device might not be suitable 26 00:02:50,039 --> 00:02:55,639 for booting. We don't talk about booting. So that is okay. And I'm continuing to create 27 00:02:55,639 --> 00:03:02,119 the array. And you can see the device is already started. So next, you put a file system on 28 00:03:02,119 --> 00:03:11,960 it. And then you create the configuration, mdadm, minus minus detail, minus minus scan. 29 00:03:11,960 --> 00:03:20,600 You write that to the file etc. mdadm.conf. That will make sure that your configuration 30 00:03:20,600 --> 00:03:26,520 is persistent, and you can re-initialize your RAID device. Then we need a mount point, so 31 00:03:26,520 --> 00:03:35,080 the RAID directory. And I'm going to mount devmd0 on slash RAID. And now if I copy stuff 32 00:03:35,080 --> 00:03:45,360 to this RAID device, it will be stored there. So if you want to make it persistent, you 33 00:03:45,360 --> 00:03:54,360 need to put it in etcfsstep. And in etcfsstep, you are going to define your device. This 34 00:03:54,360 --> 00:04:00,759 time, devmd0 is okay, because the device will be detected based on the metadata information 35 00:04:00,759 --> 00:04:07,559 that has been written to the hard disk. So I'm mounting my devmd0 on slash RAID. The 36 00:04:07,559 --> 00:04:15,360 file system is just exe4. The mount options are default and 0 and 0. And that will make 37 00:04:15,360 --> 00:04:20,079 sure that it is persistent. You want to know what is going on? Well, have a look at the 38 00:04:20,079 --> 00:04:27,279 contents of proc mdstat, which is a proc file that is giving synchronization information 39 00:04:27,279 --> 00:04:34,079 about your RAID device. Or alternatively, use mdadm minus minus detail on your RAID 40 00:04:34,079 --> 00:04:40,079 device. Like this, this is giving a little bit more detail about the current state. Now 41 00:04:40,079 --> 00:04:46,519 when you are working with RAID devices, occasionally you will have to replace a failing device. 42 00:04:46,519 --> 00:04:52,519 In order to do so efficiently, it's a smart idea to have an unused RAID member as a hot 43 00:04:52,519 --> 00:04:59,519 spare. So when you are creating, you can create this way with minus minus spare devices is 44 00:04:59,519 --> 00:05:05,519 one. And then you can fail a device, you can do it manually to test if it is working. And 45 00:05:05,519 --> 00:05:10,959 after failure, you remove the device, and then you add the device that was marked as 46 00:05:10,959 --> 00:05:14,959 a spare device previously. And that's how you replace failing devices.