System Foundations - Linux RAID

Veröffentlicht am: 14 April 2020
auf dem Kanal: The Expat Professor
429
like

Lab 0x05 - Linux RAID

Overview
This lab will guide the student through creating a RAID array from image files created within a virtual machine. These principles translate directly to creating an array using physical devices. sudo -s is recommended as nearly all of the commands will require root-level/superuser access privileges.

Requirements
Linux Physical or Virtual Machine

Part 1 - Create and Allocate the Disk Image Files
for num in 0 1 2 3 4; do dd if=/dev/zero of=./disk$num.img bs=1M count=1024; done

for num in 0 1 2 3 4; do losetup -f disk$num.img; done

losetup -l

Part 2 - Create and Verify the RAID Array

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=5 /dev/loop{0..4}

/dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4
mdadm --detail /dev/md0


Part 3 - Format and Mount the Array
Make the partition
parted /dev/md0 mklabel msdos
parted /dev/md0 mkpart primary ext2 0% 100%

Format the partition
mkfs.ext4 -L RAID00 /dev/md0p1

Mount the partition
mount /dev/md0p1 /mnt

Copy files to the partition
ll /mnt/
cp /etc/* /mnt/
ll /mnt/

Check the Size and Details of the Array
lsblk
df -h

Part 4 - Cause a Drive Failure
Unmount the array
umount /mnt
ll /mnt/

Stop the array
mdadm --stop /dev/md0

Delete a disk image
rm -f disk3.img

Remove the loopback
losetup -d /dev/loop3

Start the array without a drive
mdadm --assemble /dev/md0 --verbose --force /dev/loop{0,1,2,4}

Optional (before restarting array)
Mark the Drive as "failed"
mdadm /dev/md0 --fail /dev/loop3

Remove the failed drive
mdadm /dev/md0 --remove /dev/loop3

Check the array status
mdadm --detail /dev/md0

Mount the partition
mount /dev/md0p1 /mnt

Verify the Contents
ll /mnt/


Part 5 - Repair the Array
Recreate and Add disk3.img
dd if=/dev/zero of=./disk3.img bs=1M count=1024
losetup /dev/loop3 disk3.img
mdadm /dev/md0 --add /dev/loop3

Verify that the Array is rebuilding
mdadm --detail /dev/md0
It may take about 80 seconds for the array to rebuild

Part 6 - Remove the Array
mdadm --detail /dev/md0
umount /mnt
ll /mnt/
mdadm --stop /dev/md0
mdadm --remove /dev/md0 #(if present)
losetup -D
mdadm --examine --scan




Thank you for dropping by!

Please join me:
   / paulwpoteete  
  / paulwpoteete  
  / paulwpoteete  


Auf dieser Seite können Sie das Online-Video System Foundations - Linux RAID mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer The Expat Professor 14 April 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 429 Mal angesehen und es wurde von like den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!