Software RAID on linux with mdadm Campus-Booster ID: Copyright © SUPINFO. All rights reserved Software RAID
Your trainer… Presenter’s Name Software RAID Title: **Enter title or job role. Accomplishments: **What makes the presenter qualified to present this course. Education: **List degrees if important. Publications: **Writings by the presenter on the subject of the course or presentation. Contact: **Campus-Booster ID:
Create a loop device: to use RAID without additional disk Know all differents RAID levels: choose the level for your need Install and configure RAID software: when we had no hardware solution Monitoring RAID devices: to be alerted of arrays problem By completing this course, you will: Software RAID Course objectives
Loop devices: know and manipulate loop devices System preparation: Configure the linux kernel and disks to use RAID mdadm installation: the software RAID solution RAID implementation: increase performance and implement fault tolerance Monitoring and maintenance: Change disk or be aware of any problems Software RAID Course’s plan: Course topics
Loop Devices Introduction to Loop Devices Software RAID
Preview Loop devices Here are chapters we will talk about: Loop devices presentation Example
Presentation Loop devices Loopback device Same operations as a real disk, example: Can be bound to a file FileVirtual disk Become /dev/loop[0-7] fdisk /dev/loop0 mkfs.ext3 /dev/loop0
Example Loop devices Creation of a 10Mo file Bind /dev/loop0 device to image.loop Unbind: dd if=/dev/zero of=image.loop bs=1024k count=10 losetup /dev/loop0 image.loop losetup –d /dev/loop0
Stop-and-think Loop devices Do you have any questions ?
Introduction to RAID Redundant Array of Independent Disks Software RAID
Preview RAID introduction Here are the chapters we will see: Introduction Stripping Mirroring RAID 5 RAID 1+0
Abbreviation R edundant A rray of I ndependent D isks
Introduction Objective: using inexpensive disks Disks aggregation: the OS only sees one logical disk. Disks capacity addition (RAID 0, JBOD) Enhanced performance (RAID 0, 5) Fault tolerance (RAID 1, 5) Increase capacity, performance, security (RAID 5) Hardware and Software implementation IMPORTANT: it's not a backup solution! RAID introduction
Raid – Historique 1987, Berkeley University: birth of the first 5 Raid levels RAID (1-5) Raid 0, 6, 7 and Jbod added after Level 0 and Jbod without fault tolerance (no redundancy) RAID introduction
RAID 0 (Stripping) RAID 0 Enhanced performance No fault tolerance RAID introduction
RAID 1 (mirroring) Raid level 1 or Mirroring Fault tolerance Enhanced performance on data reading Disadvantage: not very disk space efficient 2 Disks of 40Go = 1 Raid device of 40Go RAID introduction
RAID 5 Raid level 5 Mix between reliability and performance Read/Write Data on all disks Parity check system RAID introduction
RAID 1+0 Raid 1+ Raid 0 Need 4 Disks minimum Mix Raid 0 performance with Raid 1 Reliability RAID introduction
Stop-and-think RAID introduction Do you have any questions ?
Software Raid Implementation Software Raid installation on Linux Software RAID
Preview Software RAID implementation These are the chapters that we will approach : Kernel configuration mdadm installation Disks preparation RAID device
Kernel configuration Linux kernel must support Raid devices 1 Verify Raid support: 2 Reconfigure the kernel if needed: Software RAID implementation cat /boot/config-2.6.x | grep RAID
mdadm installation mdadm: Tool to manage raid devices Install from sources: Mandriva: urpmi mdadm Software RAID implementation
Disks preparation Partitions need to support raid 1 disk = only 1 partition Warning: All data will be lost ! 1 Launch fdisk or any other partition manager of your choice 2 Create a partition for the entire disk 3 Modify partition type to type FD (Linux RAID autodetect) Software RAID implementation fdisk /dev/hdb
Raid device Raid device = Virtual partition Represented by: /dev/md X is a number: 0 to 15 Example: /dev/md1 16 Raid partitions maximum No partitioning required on raid device. Software RAID implementation
Stop-and-think Software RAID implementation Do you have any questions ?
Configuration and use of Software RAID Implementation of different Raid types. Software RAID
Preview Configuration and use of Software RAID These are the chapters that we will approach : The mdadm command RAID 1 Implementation RAID 5 Implementation RAID 0+1 Implementation
The mdadm command Only one command for all management: mdadm --create : Raid device to create (/dev/md1) --level= : Raid level (0,1,5,...) --raid-devices= : number of physical disks and their access path Configuration of Software RAID mdadm --create --level= \ > --raid-devices=... mdadm --create --level= \ > --raid-devices=...
Raid 1 implementation Data duplicated: writing synchronously on all disks 2 disks minimum Creation of a Raid 1 device /dev/md0 Mirroring of /dev/sdb1 and /dev/sdc1 Configuration of Software RAID mdadm --create /dev/md0 --level=1 \ > --raid-devices=2 /dev/sdb1 /dev/sdc1 mdadm --create /dev/md0 --level=1 \ > --raid-devices=2 /dev/sdb1 /dev/sdc1
Raid 5 implementation Fault tolerance and performance 3 disks minimum Configuration of Software RAID mdadm --create /dev/md1 --level=5 \ > --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 \ > --spare-devices=1 /dev/sde1 mdadm --create /dev/md1 --level=5 \ > --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1 \ > --spare-devices=1 /dev/sde1
Raid 1+0 implementation Raid 1 + Raid 0 First we create two RAID 1 Configuration of Software RAID mdadm --create /dev/md1 --level=1 \ > --raid-devices=2 /dev/sdd1 /dev/sde1 mdadm --create /dev/md1 --level=1 \ > --raid-devices=2 /dev/sdd1 /dev/sde1 mdadm --create /dev/md2 --level=0 \ > --raid-devices=2 /dev/md0 /dev/md1 mdadm --create /dev/md2 --level=0 \ > --raid-devices=2 /dev/md0 /dev/md1 mdadm --create /dev/md0 --level=1 \ > --raid-devices=2 /dev/sdb1 /dev/sdc1 mdadm --create /dev/md0 --level=1 \ > --raid-devices=2 /dev/sdb1 /dev/sdc1 And then the RAID 0 from the two RAID 1 sets
Stop-and-think Configuration of Software RAID Do you have any questions ?
Maintenance and monitoring Maintenance and monitoring of Raid devices Software RAID
Preview Maintenance and monitoring These are the chapters that we will approach : Simulate a faulty disk Hot add / remove Monitoring your arrays
Simulate a faulty disk Hot add and remove of disk Simulate a faulty disk: See the changes: 1 2 Maintenance and monitoring mdadm /dev/md0 -f /dev/sdc1 mdadm --detail /dev/md0 [ ? ] Number Major Minor RaidDevice State active sync /dev/sdb active sync /dev/sdd faulty /dev/sdc1 mdadm --detail /dev/md0 [ ? ] Number Major Minor RaidDevice State active sync /dev/sdb active sync /dev/sdd faulty /dev/sdc1
Hot add / remove Hot add and remove of disk Remove /dev/sdc1 Add the spare disk /dev/sde1 3 4 Maintenance and monitoring mdadm /dev/md0 -r /dev/sdc1 mdadm /dev/md0 -a /dev/sde1
Monitoring your arrays Get mail alerts about your RAID array state: Maintenance and monitoring mdadm -F --scan -f --delay 30 --pid-file \ > /var/run/mdadm.pid -m mdadm -F --scan -f --delay 30 --pid-file \ > /var/run/mdadm.pid -m
Stop-and-think Maintenance and monitoring Do you have any questions ?
RAID levels Mdadm command RAID maintenance & monitoring Course summary Loop devices Software RAID
Congratulations You have successfully completed the SUPINFO course Software Raid
The end