Creating and Managing a Software RAID

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

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.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

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
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
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 running mdadm -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
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

Additional Resources

You work for a small financial company and have been tasked with setting up a software RAID to store client data. The RAID level should be 5, and the device should be called /dev/md0 and use the following partitions as active devices: /dev/xvdf1, /dev/xvdg1, and /dev/xvdj1. It should also contain the following spare devices: /dev/xvdf2, /dev/xvdg2, and /dev/xvdj2. Once created, the configuration should be saved to /etc/mdadm.conf.

An ext4 filesystem should be created on the RAID device and it should be mounted on /mnt/raid. Ensure an entry to fstab has been added so that it will be remounted on boot. Next we need to fail the active RAID devices one-by-one and remove them from the RAID. We need to ensure that the RAID doesn’t fail during this process. The following devices should be added to RAID as spares: /dev/xvdf3, /dev/xvdg3, and /dev/xvdj3.

What are Hands-on Labs

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!