- Lab
- A Cloud Guru
Creating and Managing a Software RAID
RAID is used to combine multiple devices into one or more logical units. In this hands-on lab, we are tasked with creating a RAID 5 array, failing active devices and observing the behavior, and adding new devices to the RAID to replace the ones that have failed.
Path Info
Table of Contents
-
Challenge
Create a RAID 5 Array Based on the Instructions
Use the
mdadm
command to create the RAID 5 array.mdadm -C /dev/md0 -l raid5 -n 3 /dev/xvdf1 /dev/xvdg1 /dev/xvdj1 -x 3 /dev/xvdf2 /dev/xvdg2 /dev/xvdj2
Create the
mdadm.conf
file to ensure the RAID is available on boot.mdadm -D -s -v > /etc/mdadm.conf
-
Challenge
Create an Ext4 Filesystem, Mount It, and Ensure It Persists Through a Reboot
Use the
mkfs
command to create an ext4 filesystem on/dev/md0
.mkfs -t ext4 /dev/md0
Create the
/mnt/raid
mount point.mkdir /mnt/raid
Mount
/dev/md0
on/mnt/raid
.mount -t ext4 /dev/md0 /mnt/raid
Use the
blkid
command to obtain the UUID of/dev/md0
:blkid /dev/md0
Use a text editor to open
/etc/fstab
and add the following entry at the bottom of the file (using the UUID observed in the previous step):UUID=uuid_of_md0 /mnt/raid ext4 defaults 0 0
-
Challenge
Fail the Active Devices in the Array One at a Time and Remove Them
Fail the active devices using the
-f
option (Note: Wait until a spare device has been added to the array before proceeding to the next to prevent RAID failure. The state can be checked by runningmdadm -D /dev/md0
).mdadm -f /dev/md0 /dev/xvdf1 mdadm -f /dev/md0 /dev/xvdg1 mdadm -f /dev/md0 /dev/xvdj1
Remove failed devices from the array.
mdadm -r /dev/md0 /dev/xvdf1 /dev/xvdg1 /dev/xvdj1
-
Challenge
Add Three New Devices to the Array Based on the Instructions
Add new devices to
/dev/md0
.mdadm -a /dev/md0 /dev/xvdf3 /dev/xvdg3 /dev/xvdj3
Update
/etc/mdadm.conf
with new configuration changes.mdadm -D -s -v > /etc/mdadm.conf
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.