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