# Configure the System RAID

  • mdadm package installed
  • Two Data Volumes attached to the machine for performing the RAID
Attached disk info
Partition Files of Devices
/dev/nvme1n1
/dev/nvme2n1
sfdisk /dev/nvme1n1 < nvme1n1.txt
[root@b1e95f64d31c ~]# lsblk /dev/nvme1n1
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme1n1 259:0 0 2G 0 disk
├─nvme1n1p1 259:4 0 200M 0 part
├─nvme1n1p2 259:5 0 200M 0 part
└─nvme1n1p3 259:6 0 200M 0 part
sfdisk /dev/nvme1n1 < nvme1n1.txt
[root@b1e95f64d31c ~]# parted /dev/nvme2n1 print
Model: NVMe Device (nvme)
Disk /dev/nvme2n1: 2147MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 200MB 199MB primary raid
2 201MB 400MB 198MB primary raid
3 401MB 600MB 199MB primary raid
4 601MB 2100MB 1499MB extended lba
5 602MB 800MB 198MB logical raid
6 801MB 1000MB 199MB logical raid
7 1001MB 1200MB 198MB logical raid
rpm -q mdadm
yum install -y mdadm
mdadm -C /dev/md0 -l raid5 -n 3 /dev/nvme1n1p1 /dev/nvme1n1p2 /dev/nvme1n1p3 -x 3 /dev/nvme2n1p1 /dev/nvme2n1p2 /dev/nvme2n1p3
[root@b1e95f64d31c ~]# ls /dev/md*
/dev/md0
[root@b1e95f64d31c ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Dec 31 05:32:24 2020
Raid Level : raid5
Array Size : 382976 (374.00 MiB 392.17 MB)
Used Dev Size : 191488 (187.00 MiB 196.08 MB)
Raid Devices : 3
Total Devices : 6
Persistence : Superblock is persistent

Update Time : Thu Dec 31 05:34:39 2020
State : clean
Active Devices : 3
Working Devices : 6
Failed Devices : 0
Spare Devices : 3

Layout : left-symmetric
Chunk Size : 512K

Consistency Policy : resync

Name : b1e95f64d31c.mylabserver.com:0 (local to host b1e95f64d31c.mylabserver.com)
UUID : edc168fe:082e62d2:7183995d:7bd4e9ed
Events : 18

Number Major Minor RaidDevice State
0 259 2 0 active sync /dev/nvme1n1p1
1 259 3 1 active sync /dev/nvme1n1p2
6 259 4 2 active sync /dev/nvme1n1p3

3 259 5 - spare /dev/nvme2n1p1
4 259 6 - spare /dev/nvme2n1p2
5 259 7 - spare /dev/nvme2n1p3
[root@b1e95f64d31c ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 nvme1n1p3[6] nvme2n1p3[5](S) nvme2n1p2[4](S) nvme2n1p1[3](S) nvme1n1p2[1] nvme1n1p1[0]
382976 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

unused devices: <none>
# mdadm -D -s -v > /etc/mdadm.conf
mkdir /mnt/data
mkdir /mnt/data/backup
mkfs -t ext4 /dev/md0
mount /dev/md0 /mnt/data
mkdir /mnt/data/backup
cp -rf /etc/* /mnt/data/backup
# blkid
/etc/fstab contents
# Umount /mnt/data
# mount -a
[root@b1e95f64d31c ~]# mdadm -f  /dev/md0 /dev/nvme1n1p1
mdadm: set /dev/nvme1n1p1 faulty in /dev/md0
    1     259        3        1      active sync   /dev/nvme1n1p2 👈
6 259 4 2 active sync /dev/nvme1n1p3

0 259 2 - faulty /dev/nvme1n1p1 👈
3 259 5 - spare /dev/nvme2n1p1
4 259 6 - spare /dev/nvme2n1p2
/dev/md0:
Version : 1.2
Creation Time : Thu Dec 31 05:32:24 2020
Raid Level : raid5
Array Size : 382976 (374.00 MiB 392.17 MB)
Used Dev Size : 191488 (187.00 MiB 196.08 MB)
Raid Devices : 3
Total Devices : 6
Persistence : Superblock is persistent

Update Time : Mon Jan 4 11:50:23 2021
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 3
Spare Devices : 1

Layout : left-symmetric
Chunk Size : 512K

Consistency Policy : resync

Rebuild Status : 20% complete

Name : b1e95f64d31c.mylabserver.com:0 (local to host b1e95f64d31c.mylabserver.com)
UUID : edc168fe:082e62d2:7183995d:7bd4e9ed
Events : 63

Number Major Minor RaidDevice State
5 259 7 0 active sync /dev/nvme2n1p3
3 259 5 1 active sync /dev/nvme2n1p1
4 259 6 2 spare rebuilding /dev/nvme2n1p2
[root@b1e95f64d31c ~]# mdadm -r /dev/md0 /dev/nvme1n1p1 /dev/nvme1n1p2 /dev/nvme1n1p3
mdadm: hot removed /dev/nvme1n1p1 from /dev/md0
mdadm: hot removed /dev/nvme1n1p2 from /dev/md0
mdadm: hot removed /dev/nvme1n1p3 from /dev/md0
[root@b1e95f64d31c ~]# mdadm -a /dev/md0 /dev/nvme2n1p5 /dev/nvme2n1p6 /dev/nvme2n1p7
mdadm: added /dev/nvme2n1p5
mdadm: added /dev/nvme2n1p6
mdadm: added /dev/nvme2n1p7
[root@b1e95f64d31c ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Dec 31 05:32:24 2020
Raid Level : raid5
Array Size : 382976 (374.00 MiB 392.17 MB)
Used Dev Size : 191488 (187.00 MiB 196.08 MB)
Raid Devices : 3
Total Devices : 6
Persistence : Superblock is persistent

Update Time : Mon Jan 4 12:00:34 2021
State : clean
Active Devices : 3
Working Devices : 6
Failed Devices : 0
Spare Devices : 3

Layout : left-symmetric
Chunk Size : 512K

Consistency Policy : resync

Name : b1e95f64d31c.mylabserver.com:0 (local to host b1e95f64d31c.mylabserver.com)
UUID : edc168fe:082e62d2:7183995d:7bd4e9ed
Events : 81

Number Major Minor RaidDevice State
5 259 7 0 active sync /dev/nvme2n1p3
3 259 5 1 active sync /dev/nvme2n1p1
4 259 6 2 active sync /dev/nvme2n1p2

6 259 9 - spare /dev/nvme2n1p5 👈
7 259 10 - spare /dev/nvme2n1p6 👈
8 259 11 - spare /dev/nvme2n1p7 👈
# mdadm -D -s -v >/etc/mdadm.conf

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store