How to configure RAID 1 on Rocky Linux 8.6
- 00:40 cat /etc/os-release
- 00:52 yum install mdadm
- 01:15 lsblk
- 01:24 fdisk /dev/sdb
- 02:18 fdisk /dev/sdc
- 03:15 mdadm -E /dev/sd[b-c]1
- 03:41 mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sd[b-c]1
- 04:49 mdadm -E /dev/sd[b-c]1
- 05:15 mdadm --detail /dev/md1
- 05:37 mkfs.ext4 /dev/md1
- 06:02 blkid
- 06:16 mkdir /mnt/raid1
- 06:37 vim /etc/fstab
- 07:30 mount -av
- 07:46 df -h
- 07:55 lsblk
To Configure RAID 1 On Rocky Linux 8.6
Introduction:
RAID 1 is composed of an exact copy (or mirror) of a set of data on two or more disks; a classic RAID 1 mirrored pair has two disks. When using a RAID 1 volume, information is written to a first drive and to a second (or "mirror") drive simultaneously. It is not necessary to remove any information from the remaining hard drive if one of the drives in the mirror volume fails.
Advantage:
RAID 1 has the advantage of providing improved read speeds and additional protection of the hard disks.
Disadvantage:
Uses only half of the storage capacity. More expensive (needs twice as many drivers). Requires powering down your computer to replace failed drive.
Installation Steps:
Step 1: Check the Oracle Linux version by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
Step 2: Install the mdadm package which is a RAID managing tool by using the below command
[root@linuxhelp ~]# yum install mdadm
Last metadata expiration check: 0:04:40 ago on Fri 09 Sep 2022 03:44:26 PM EDT.
Dependencies resolved.
=================================================================================================
Package Architecture Version Repository Size
=================================================================================================
Installing:
mdadm x86_64 4.2-2.el8 baseos 459 k
Transaction Summary
=================================================================================================
Install 1 Package
Total download size: 459 k
Installed size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
mdadm-4.2-2.el8.x86_64.rpm 1.4 MB/s | 459 kB 00:00
-------------------------------------------------------------------------------------------------
Total 427 kB/s | 459 kB 00:01
Rocky Linux 8 - BaseOS 1.4 MB/s | 1.6 kB 00:00
Importing GPG key 0x6D745A60:
Userid : "Release Engineering <infrastructure@rockylinux.org>"
Fingerprint: 7051 C470 A929 F454 CEBE 37B7 15AF 5DAC 6D74 5A60
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mdadm-4.2-2.el8.x86_64 1/1
Running scriptlet: mdadm-4.2-2.el8.x86_64 1/1
Verifying : mdadm-4.2-2.el8.x86_64 1/1
Installed:
mdadm-4.2-2.el8.x86_64
Complete!
Step 3: Check if the device is available to configure RAID by using the below command
[root@linuxhelp ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 35G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 34G 0 part
├─rl-root 253:0 0 31G 0 lvm /
└─rl-swap 253:1 0 3G 0 lvm [SWAP]
sdb 8:16 0 5G 0 disk
sdc 8:32 0 5G 0 disk
sr0 11:0 1 1024M 0 rom
Step 4: Create the partition for two disks by using the below command
[root@linuxhelp ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.32.1).
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 0xe7a8668b.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-10485759, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759):
Created a new partition 1 of type 'Linux' and of size 5 GiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT
10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep
1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Command (m for help): p
Disk /dev/sdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe7a8668b
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 10485759 10483712 5G fd Linux raid autodetect
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@linuxhelp ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.32.1).
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 0x249d77e5.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-10485759, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-10485759, default 10485759):
Created a new partition 1 of type 'Linux' and of size 5 GiB.
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden or c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi ea Rufus alignment
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD eb BeOS fs
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ee GPT
10 OPUS 55 EZ-Drive a7 NeXTSTEP ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f1 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f4 SpeedStor
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fb VMware VMFS
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fc VMware VMKCORE
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fd Linux raid auto
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L fe LANstep
1e Hidden W95 FAT1 80 Old Minix be Solaris boot ff BBT
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linux raid autodetect'.
Command (m for help): p
Disk /dev/sdc: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x249d77e5
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 10485759 10483712 5G fd Linux raid autodetect
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Step 5: Next check the block details for any previous configuration that has been made in the disk by using the below command
[root@linuxhelp ~]# mdadm -E /dev/sd[b-c]1
mdadm: No md superblock detected on /dev/sdb1.
mdadm: No md superblock detected on /dev/sdc1.
Step 6: Create the md device and select the RAID levels by using the below command
[root@linuxhelp ~]# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sd[b-c]1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array?
Continue creating array? (y/n) y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
Step 7: Verify the status of RAID level by using the below command
[root@linuxhelp ~]# mdadm -E /dev/sd[b-c]1
/dev/sdb1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : ea4a83e1:dcc2457f:cdc92d4e:be46b105
Name : linuxhelp:1 (local to host linuxhelp)
Creation Time : Fri Sep 9 16:08:34 2022
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 10473472 sectors (4.99 GiB 5.36 GB)
Array Size : 5236736 KiB (4.99 GiB 5.36 GB)
Data Offset : 10240 sectors
Super Offset : 8 sectors
Unused Space : before=10160 sectors, after=0 sectors
State : clean
Device UUID : dcbc7209:b91588a7:184581a2:868371f4
Update Time : Fri Sep 9 16:09:00 2022
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : 4f461825 - correct
Events : 17
Device Role : Active device 0
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : ea4a83e1:dcc2457f:cdc92d4e:be46b105
Name : linuxhelp:1 (local to host linuxhelp)
Creation Time : Fri Sep 9 16:08:34 2022
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 10473472 sectors (4.99 GiB 5.36 GB)
Array Size : 5236736 KiB (4.99 GiB 5.36 GB)
Data Offset : 10240 sectors
Super Offset : 8 sectors
Unused Space : before=10160 sectors, after=0 sectors
State : clean
Device UUID : 35d3f5fb:9c391eab:d431811d:27e16483
Update Time : Fri Sep 9 16:09:00 2022
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : 4f529cbf - correct
Events : 17
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
Step 8: Verify the md device status by using the below command
[root@linuxhelp ~]# mdadm --detail /dev/md1
/dev/md1:
Version : 1.2
Creation Time : Fri Sep 9 16:08:34 2022
Raid Level : raid1
Array Size : 5236736 (4.99 GiB 5.36 GB)
Used Dev Size : 5236736 (4.99 GiB 5.36 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Fri Sep 9 16:09:00 2022
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
Name : linuxhelp:1 (local to host linuxhelp)
UUID : ea4a83e1:dcc2457f:cdc92d4e:be46b105
Events : 17
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
Step 9: Create a filesystem for md device by using the below command
[root@linuxhelp ~]# mkfs.ext4 /dev/md1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 1309184 4k blocks and 327680 inodes
Filesystem UUID: 4ac3a2e7-818d-4959-bee8-35a7d835fd6c
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
Step 10: Now permanently mount the md device by running the blkid command and copy the UUID number. Now create a fstab file using vim editor and enter the copied UUID number in the file. Save and exit the file.
[root@linuxhelp ~]# blkid
/dev/sda1: UUID="f7f9a415-4773-4386-8f26-53c0f2e67b14" BLOCK_SIZE="512" TYPE="xfs" PARTUUID="733bc0ae-01"
/dev/sda2: UUID="w7eHuA-nez8-zN5B-dl4t-7Orx-suzD-Xvd65u" TYPE="LVM2_member" PARTUUID="733bc0ae-02"
/dev/sdb1: UUID="ea4a83e1-dcc2-457f-cdc9-2d4ebe46b105" UUID_SUB="dcbc7209-b915-88a7-1845-81a2868371f4" LABEL="linuxhelp:1" TYPE="linux_raid_member" PARTUUID="e7a8668b-01"
/dev/sdc1: UUID="ea4a83e1-dcc2-457f-cdc9-2d4ebe46b105" UUID_SUB="35d3f5fb-9c39-1eab-d431-811d27e16483" LABEL="linuxhelp:1" TYPE="linux_raid_member" PARTUUID="249d77e5-01"
/dev/md1: UUID="4ac3a2e7-818d-4959-bee8-35a7d835fd6c" BLOCK_SIZE="4096" TYPE="ext4"
[root@linuxhelp ~]# mkdir /mnt/raid1
[root@linuxhelp ~]# vim /etc/fstab
UUID=4ac3a2e7-818d-4959-bee8-35a7d835fd6c /mnt/raid1 ext4 defaults 0 0
Step 11: The device is mounted successfully and to verify the status of the device by using the below command
[root@linuxhelp ~]# mount -av
/ : ignored
/boot : already mounted
none : ignored
mount: /mnt/raid1 does not contain SELinux labels.
You just mounted an file system that supports labels which does not
contain labels, onto an SELinux box. It is likely that confined
applications will generate AVC messages and not be allowed access to
this file system. For more details see restorecon(8) and mount(8).
/mnt/raid1 : successfully mounted
[root@linuxhelp ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.4G 0 1.4G 0% /dev/shm
tmpfs 1.4G 9.7M 1.4G 1% /run
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/mapper/rl-root 32G 5.5G 26G 18% /
/dev/sda1 1014M 255M 760M 26% /boot
tmpfs 276M 32K 276M 1% /run/user/0
/dev/md1 4.9G 20M 4.6G 1% /mnt/raid1
[root@linuxhelp ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 35G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 34G 0 part
├─rl-root 253:0 0 31G 0 lvm /
└─rl-swap 253:1 0 3G 0 lvm [SWAP]
sdb 8:16 0 5G 0 disk
└─sdb1 8:17 0 5G 0 part
└─md1 9:1 0 5G 0 raid1 /mnt/raid1
sdc 8:32 0 5G 0 disk
└─sdc1 8:33 0 5G 0 part
└─md1 9:1 0 5G 0 raid1 /mnt/raid1
sr0 11:0 1 1024M 0 rom
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to configure RAID 1 on Rocky Linux 8.6 has come to an end.
Comments ( 0 )
No comments available