How to Configure and Test Raid 10 On RedHat 7.6
- 00:27 lsblk
- 00:49 fdisk /dev/sdb
- 01:29 fdisk /dev/sdc
- 03:29 mdadm -C /dev/md0 -l 10 -n 4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
- 04:36 mkfs.ext4 /dev/md0
- 05:04 mount /dev/md0 data/
- 05:17 df -h
- 06:09 mdadm /dev/md0 -f /dev/sdb1
- 07:09 mdadm /dev/md0 -r /dev/sdb1
- 07:46 mdadm /dev/md0 --add /dev/sdf1
- 08:07 mdadm --detail /dev/md0
How to configure and test Raid 10 on RedHat 7.6
Introduction:
RAID 10, also known as RAID 1+0, is a RAID configuration that combines disk mirroring and disk striping to protect data that requires the least number of four disks and stripes data across mirrored pairs. This tutorial will explain Raid 10 Configuration and testing on Redhat 7.6.
Configuration Process:
First and foremost check the disk details
root@linuxhelp:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 3.7G 0 part /swap
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 976M 0 part /boot
└─sda6 8:6 0 15.3G 0 part /
sdb 8:16 0 20G 0 disk
sdc 8:32 0 20G 0 disk
sdd 8:48 0 2G 0 disk
sde 8:64 0 2G 0 disk
sdf 8:80 0 2G 0 disk
sr0 11:0 1 1.9G 0 rom
Now I will create partition of SDB, SDC, SDD, SDE,SDF disk by executing the following command
root@linuxhelp:~# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x4348c9fd.
Press n to create partition
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Press p to choose the partition type
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Enter the size of the partition
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-41943039, default 41943039): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
Press t to change the partition code
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Press w to write the partition
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
I will follow the same process to create partition to other drives
root@linuxhelp:~# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
.
.
.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@linuxhelp:~# fdisk /dev/sdd
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
.
.
.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@linuxhelp:~# fdisk /dev/sde
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
.
.
.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@linuxhelp:~# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
.
.
.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
After the partition is created then list the disk If the partition is created or not
root@linuxhelp:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 3.7G 0 part /swap
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 976M 0 part /boot
└─sda6 8:6 0 15.3G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 1G 0 part
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 1G 0 part
sdd 8:48 0 2G 0 disk
└─sdd1 8:49 0 1G 0 part
sde 8:64 0 2G 0 disk
└─sde1 8:65 0 1G 0 part
sdf 8:80 0 2G 0 disk
└─sdf1 8:81 0 1G 0 part
sr0 11:0 1 1.9G 0 rom
After the partition is created then Create RAID using those partitions
root@linuxhelp:~# mdadm -C /dev/md0 -l 10 -n 4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
After RAID created now format the raid to ext4 file system
root@linuxhelp:~# mkfs.ext4 /dev/md0
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 523264 4k blocks and 130816 inodes
Filesystem UUID: d24481bd-1966-4151-a056-094ac82115ab
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
Now check the details about RAID6
root@linuxhelp:~# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jan 22 7:50:08 2021
Raid Level : raid10
Array Size : 2093056 (2044.00 MiB 2143.29 MB)
Used Dev Size : 1046528 (1022.00 MiB 1071.64 MB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Thu Jan 22 07:53:09 2021
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Name : linuxhelp:0 (local to host linuxhelp)
UUID : 99e1980b:6f9f682f:c3cda362:1c608272
Events : 17
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
2 8 49 2 active sync /dev/sdd1
3 8 65 3 active sync /dev/sde1
Now create a directory for mount the raid by executing the following command
root@linuxhelp:~# mkdir data
After the directory is created now mount the raid to the directory
root@linuxhelp:~# mount /dev/md0 data/
Now list the disk if the raid is mounted or not
root@linuxhelp:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 391M 1.7M 390M 1% /run
/dev/sda6 16G 6.8G 7.5G 48% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda5 945M 108M 773M 13% /boot
/dev/sda1 3.7G 15M 3.4G 1% /swap
tmpfs 391M 16K 391M 1% /run/user/1000
/dev/md0 2.0G 6.0M 1.9G 1% /root/data
After the raid is mounted. Add some files to the data directory for test the raid 6
root@linuxhelp:~# cd data/
root@linuxhelp:~/data# touch linuxhelp.txt
Now edit the file by using vim editor
root@linuxhelp:~/data# vim linuxhelp.txt
Now list the directory
root@linuxhelp:~/data# ls -la
total 28
drwxr-xr-x 3 root root 4096 Jan 21 11:56 .
drwx------ 5 root root 4096 Jan 21 11:56 ..
-rw-r--r-- 1 root root 21 Jan 21 11:56 linuxhelp.txt
drwx------ 2 root root 16384 Jan 21 11:53 lost+found
Now I will fail the any one drives from the Raid 10
root@linuxhelp:~/data# mdadm /dev/md0 -f /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
mdadm: set /dev/sdd1 faulty in /dev/md0
After that check the details of raid 10 if the drives are failed are not
root@linuxhelp:~/data# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jan 21 11:50:08 2021
Raid Level : raid6
Array Size : 2093056 (2044.00 MiB 2143.29 MB)
Used Dev Size : 1046528 (1022.00 MiB 1071.64 MB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Thu Jan 21 12:11:28 2021
State : clean, degraded
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Name : linuxhelp:0 (local to host linuxhelp)
UUID : 99e1980b:6f9f682f:c3cda362:1c608272
Events : 21
Number Major Minor RaidDevice State
- 0 0 0 removed
1 8 33 1 active sync /dev/sdc1
- 0 0 2 removed
3 8 65 3 active sync /dev/sde1
0 8 17 - faulty /dev/sdb1
2 8 49 - active /dev/sdd1
After the drive is failed now remove those failed drives from the raid 6
root@linuxhelp:~/data# mdadm /dev/md0 -r /dev/sdb1 /dev/sdd1
mdadm: hot removed /dev/sdb1 from /dev/md0
mdadm: hot removed /dev/sdd1 from /dev/md0
Now list the disk by using the following command
root@linuxhelp:~/data# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 3.7G 0 part /swap
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 976M 0 part /boot
└─sda6 8:6 0 15.3G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 1G 0 part
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 1G 0 part
└─md0 9:0 0 2G 0 raid6 /root/data
sdd 8:48 0 2G 0 disk
└─sdd1 8:49 0 1G 0 part
sde 8:64 0 2G 0 disk
└─sde1 8:65 0 1G 0 part
└─md0 9:0 0 2G 0 raid6 /root/data
sdf 8:80 0 2G 0 disk
└─sdf1 8:81 0 1G 0 part
sr0 11:0 1 1.9G 0 rom
Now add one new drives to the raid 10 by executing the following command
root@linuxhelp:~/data# mdadm /dev/md0 --add /dev/sdf1
mdadm: added /dev/sdf1
Now check the details about raid if the drive is added or not
root@linuxhelp:~/data# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jan 21 11:50:08 2021
Raid Level : raid6
Array Size : 2093056 (2044.00 MiB 2143.29 MB)
Used Dev Size : 1046528 (1022.00 MiB 1071.64 MB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Thu Jan 21 12:14:11 2021
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 512K
Consistency Policy : resync
Name : linuxhelp:0 (local to host linuxhelp)
UUID : 99e1980b:6f9f682f:c3cda362:1c608272
Events : 43
Number Major Minor RaidDevice State
1 8 33 1 active sync /dev/sdc1
4 8 81 2 active sync /dev/sdf1
3 8 65 3 active sync /dev/sde1
Now check the raid directory if the data are stored or corrupted
root@linuxhelp:~/data# ls -la
total 28
drwxr-xr-x 3 root root 4096 Jan 21 11:56 .
drwx------ 5 root root 4096 Jan 21 11:56 ..
-rw-r--r-- 1 root root 21 Jan 21 11:56 linuxhelp.txt
drwx------ 2 root root 16384 Jan 21 11:53 lost+found
Now check the disk if the drives are mounted or not
root@linuxhelp:~/data# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 3.7G 0 part /swap
├─sda2 8:2 0 1K 0 part
├─sda5 8:5 0 976M 0 part /boot
└─sda6 8:6 0 15.3G 0 part /
sdb 8:16 0 20G 0 disk
└─sdb1 8:17 0 1G 0 part
sdc 8:32 0 20G 0 disk
└─sdc1 8:33 0 1G 0 part
└─md0 9:0 0 2G 0 raid6 /root/data
sdd 8:48 0 2G 0 disk
└─sdd1 8:49 0 1G 0 part
sde 8:64 0 2G 0 disk
└─sde1 8:65 0 1G 0 part
└─md0 9:0 0 2G 0 raid6 /root/data
sdf 8:80 0 2G 0 disk
└─sdf1 8:81 0 1G 0 part
└─md0 9:0 0 2G 0 raid6 /root/data
sr0 11:0 1 1.9G 0 rom
With this method, the Configuration and Test RAID 10 on Redhat 7.6 is comes to an end.
Comments ( 0 )
No comments available