Redundant Array of Independent Disks
- A glance at what RAID is. /RAID is not a backup
- Overview of
mdadm
command - Creating RAID 0 and RAID 5 Array
- Automounting RAID array at boot
- We will look at adding and removing disk from array
- Removing RAID Array
LEVEL | 0 | 1 | 5 | 6 |
---|---|---|---|---|
. | striping | mirroring | parity striping | double parity |
Min. disk required | 2 | 2 | 3 | 4 |
- RAID 5 supports a single disk failure.
- RAID 6 supports upto 2 disk failures.
PAGE 2
yum install mdadm
General structure of mdadm
command,
mdadm [mode] <raiddevice> [options] <component-devices>
if no mode is specified it will default to --manage
. Note that the RAID device comes before component devices.
PAGE 3
(I will be referring to the RAID array as /dev/md0. All commands are run as root user)
- Create level 0 RAID with 2 active devices and 1 spare
mdadm --create /dev/md0 --level=0 --raid-devices=2 \
/dev/sdb1 /dev/sdb2 --spare=1 /dev/sdb3
Note : we explicitly specify the number of disks that are going to be used in our array
- View information on RAID array
mdadm --detail /dev/md0
cat /proc/mdstat
- Mark a disk faulty
madam /dev/md0 --fail /dev/sdb1
- Remove disk from array ( should not be active)
mdadm /dev/md0 --remove /dev/sdb1
- Add spare to array
mdadm /dev/md0 --add /dev/sdb2
- Save configuration
mdadm --detail --scan >> /etc/mdadm.conf
- Add RAID array from configuration
mdadm --assemble --scan
- Remove a RAID array: make sure the drive is unmounted first.
mdam --stop /dev/md0
Then remove the entry from /etc/mdadm.conf
- Grow RAID ARRAY:
mdadm --add /dev/md0 /dev/sdb2
mdadm --grow /dev/md0 --raid-devices=4
PAGE 4
Vim shortcut we discussed :
: set nu
or: set number
to show line numberLINE + G
or: LINE
to jump to LINE$
to move to end of linegg
to move to the end of a fileG
to move to the start of a file