[go: up one dir, main page]

0% found this document useful (0 votes)
15 views18 pages

RAID-levels Using MADAM

This document provides step-by-step instructions for configuring various RAID arrays (RAID 0, RAID 1, RAID 5, and RAID 10) using the mdadm tool. Each section outlines prerequisites, commands for creating the RAID array, verifying the setup, assigning a file system, and persisting the mount in /etc/fstab. Additionally, it includes commands for managing disk failures and re-adding disks to the RAID array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views18 pages

RAID-levels Using MADAM

This document provides step-by-step instructions for configuring various RAID arrays (RAID 0, RAID 1, RAID 5, and RAID 10) using the mdadm tool. Each section outlines prerequisites, commands for creating the RAID array, verifying the setup, assigning a file system, and persisting the mount in /etc/fstab. Additionally, it includes commands for managing disk failures and re-adding disks to the RAID array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

RAID 0:

Configuring a RAID 0 (striped) array using mdadm:

● Prerequisites:
○ At least 2 unused disks or partitions, e.g. /dev/sdb and /dev/sdc.
○ Back up any important data—this process will erase the selected
devices.

Step 1: Add New disks and verify the disks


Command: lsblk

Step 2: Create the RAID 0 Array using Mdadm


Command:
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc
● --level=0: stripe across disks for speed
● --raid-devices=2: number of disks
● /dev/md0: name of new virtual RAID device

Step 3: Verify the RAID Is Created


Commands:
mdadm --detail /dev/md0
cat /proc/mdstat
● mdadm --detail shows configuration, component status, and health.
● cat /proc/mdstat shows live sync/build progress

Step 4: Assign File System & Mount


Command:
mkfs.xfs /dev/md0

Commands:
mkdir /md0
mount /dev/md0 /md0
df -h /md0

Step 5: Persist the mount in /etc/fstab


Commands:
vi /etc/fstab
cat /etc/fstab | grep -i /md0
mount | grep /md0
RAID 1:
Configuring a RAID 1 (mirrored) array using mdadm:

● Prerequisites:
○ At least 2 unused disks or partitions of identical size (e.g., /dev/sdd,
/dev/sde).
○ Back up important data—this process erases the selected devices.

Step 1: Add New disks and verify the disks


Command: lsblk

Step 2: Create the RAID 1 Array using Mdadm


Command:
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd /dev/sde
NOTE:
By default, mdadm uses metadata version 1.2, which writes RAID information
(called a superblock) at the beginning of the array—before any user data.

If you plan to put /boot (or anything boot-critical) on this RAID, use metadata
version 0.90, which places metadata at the end of the array—keeping the start
clean for your bootloader.

Command:
mdadm --create /dev/md1 --level=1 --raid-devices=2 --metadata=0.90 /dev/sdd
/dev/sde

● --level=1 = sets mirroring (RAID 1).


● --raid-devices=2 = uses 2 disks.
● /dev/md1 = name of the RAID device.

Step 3: Verify the RAID Is Created


Commands:
mdadm --detail /dev/md1
cat /proc/mdstat
Step 4: Assign File System & Mount
Command:
mkfs.xfs /dev/md1

Commands:
mkdir /md1
mount /dev/md1 /md1
df -h /md1

Step 5: Persist the mount in /etc/fstab


Commands:
vi /etc/fstab
cat /etc/fstab | grep -i /md1
mount | grep /md1
RAID 5:
Configuring a RAID 5 (striped with parity) array using mdadm:

● Prerequisites
○ Minimum 3 same-size unused disks/partitions, e.g. /dev/sdb,
/dev/sdc, /dev/sdd.

Step 1: Add New disks and verify the disks


Command: lsblk | grep -E 'sdb|sdc|sdd'

Step 2: Create the RAID 5 Array using Mdadm


Command:
mdadm --create /dev/md5 --level=5 --raid-devices=3 /dev/sdb /dev/sdc
/dev/sdd

● --level=5 : RAID 5 (striping + parity)


● --raid-devices=3 : using 3 disks
(mdadm spins up the array and starts parity sync)

Step 3: Verify the RAID Is Created


Commands:
mdadm --detail /dev/md5
cat /proc/mdstat
Step 4: Assign File System & Mount
Command:
mkfs.xfs /dev/md5

Commands:
mkdir /md5
mount /dev/md5 /md5
df -h /md5

Step 5: Persist the mount in /etc/fstab


Commands:
vi /etc/fstab
cat /etc/fstab | grep -i /md5
mount | grep /md5
RAID 10:
Configuring a RAID 10 (Striped Mirrors) array using mdadm:

● Prerequisites
○ Minimum 4 same-size unused disks/partitions, e.g. /dev/sdb,
/dev/sdc, /dev/sdd, /dev/sde

Step 1: Add New disks and verify the disks


Command: lsblk | grep -E 'sdb|sdc|sdd|sde'

Step 2: Create the RAID 10 Array using Mdadm


Command:
mdadm --create /dev/md10 --level=10 --raid-devices=4 /dev/sdb /dev/sdc
/dev/sdd /dev/sde
● --level=10: sets up RAID 10 (striped mirrors).
● --raid-devices=4: specifies four disks.
RAID 10 combines mirroring and striping for both performance and
redundancy

Step 3: Verify the RAID Is Created


Commands:
mdadm --detail /dev/md10
cat /proc/mdstat
Step 4: Assign File System & Mount
Command:
mkfs.xfs /dev/md10

Commands:
mkdir /md10
mount /dev/md10 /md10
df -h /md10
Step 5: Persist the mount in /etc/fstab
Commands:
vi /etc/fstab
cat /etc/fstab | grep -i /md10
mount | grep /md10

Step 6: Save Confiduration


Command:
mdadm --detail --scan --verbose >> /etc/mdadm.conf
cat /etc/mdadm.conf

Fail / Remove / Add Disk:


mdadm /dev/md10 --fail /dev/sdb
mdadm /dev/md10 --remove /dev/sdb
mdadm /dev/md10 --add /dev/sdb

You might also like