RAID5 Array configuration - and mount it to an Amazon EC2 instance as the additional storage (Raid 5 Configuration)
Create a RAID5 Array and
mount it to an Amazon EC2 instance as the additional storage
By: Udara Pathirage on 7th Jan 2021
- Create an EC2 instance using the AWS Console- using default settings.
a) Check the current disk details
i) $df –h
3. Create 3 volumes using the AWS Console; Magnetic is the cheapest to make the tests.
a) Select the Availability Zone where the App Instances has hosted. Otherwise, it will not be able to mount
b) For the RAID5, minimum of 3 hard disks required
c) Clone settings of Volumes
d) Give the name of ‘device’ as ‘sdb’, ‘sdc’, ‘sdd’ ,so on
i) First check whether there are hard disks available in the names that we are going to create in the next steps - $fdisk –l
e) RAID 5 Total capacity of RAID of having 1TB 3 HDD will give only 2TB due to keeping 1TB as a backup.
b) For the RAID5, minimum of 3 hard disks required
c) Clone settings of Volumes
d) Give the name of ‘device’ as ‘sdb’, ‘sdc’, ‘sdd’ ,so on
i) First check whether there are hard disks available in the names that we are going to create in the next steps - $fdisk –l
e) RAID 5 Total capacity of RAID of having 1TB 3 HDD will give only 2TB due to keeping 1TB as a backup.
Check how new hard disks have attached to the instance. Type $fdisk -l to view from the terminal.
4. Create the RAID Drive
a) Go into each partition and map it into the RAID Drive
i) $fdisk /dev/sdb
i) $fdisk /dev/sdb
(1) Add new partition clicking ‘p’.(2) Create a full disk partition(3) Click ‘t’.(4) Select ‘fd’ (Linux Raid auto)(5) Click ‘w’ to write the settings
ii) Repeat above process to the all hard disksiii) You can see the created partitions using: $fdisk –l
Type $fdisk -l to see the created partitions on each disks
5. Creation of RAID drives
i) $mdadm –E /dev/sd[a-d]
(1) All HDDs starting from “a” to “d”
ii)
create the RAID Drive name as “md0”
(1)
$mdadm --create /dev/md0 --level=5
--raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
(a)
–md0 is the raid volume name
(b)
--level=5 > RAID 5 configuration
(c)
--raid-devices=3 >> how many devices going
to add into this RAID
(d) /dev/sdb1 /dev/sdc1 /dev/sdd1 >> devices we created at last steps
(2) You will see a notice as “/dev/md0” started >> you have created the RAID array successfully.
How to verify the RAID is in active
(1)
$cat /proc/mdstat
(2)
$watch /proc/mdstat
(3)
$mdadm --detail /dev/md0
Next, the Above step has to be completed, 100%.
6. Create a filesystem on the Raid Device and mount it to the /opt
6.A How to mount permanently. No matter reboot. After the reboot, this drive will automatically be mapped
Terminal: $vi /etc/fstab
add a following entry as here
(1) /dev/md0 /opt ext4 defaults 0 0
My code block
[root@ip-172-31-20-67 opt]# history
2 df -h
3 lsblk
4 fdisk -l
13 fdisk /dev/sdb
14 fdisk /dev/sdc
15 fdisk /dev/sdd
16 clear
17 fdisk -l
18 clear
19 mdadm --help
20 mdadm -E /dev/sd[a-d]
21 clear
26 mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
27 cat /proc/mdstat
28 clear
30 sudo watch /proc/mdstat
33 mdadm --detail /dev/md0
41 cat /proc/mdstat
42 mkfs.ext4 /dev/md0
51 mount /dev/md0 /opt/
52 cd /opt/
53 ll
54 df -h
55 vi /etc/fstab
57 cd /opt/
58 ll
59 mkdir test1
60 mkdir test 2
61 ll
62 touch file1 file2 file3 file4
63 ll
64 lsblk
65 history
[root@ip-172-31-20-67 opt]#
2 df -h
3 lsblk
4 fdisk -l
13 fdisk /dev/sdb
14 fdisk /dev/sdc
15 fdisk /dev/sdd
16 clear
17 fdisk -l
18 clear
19 mdadm --help
20 mdadm -E /dev/sd[a-d]
21 clear
26 mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
27 cat /proc/mdstat
28 clear
30 sudo watch /proc/mdstat
33 mdadm --detail /dev/md0
41 cat /proc/mdstat
42 mkfs.ext4 /dev/md0
51 mount /dev/md0 /opt/
52 cd /opt/
53 ll
54 df -h
55 vi /etc/fstab
57 cd /opt/
58 ll
59 mkdir test1
60 mkdir test 2
61 ll
62 touch file1 file2 file3 file4
63 ll
64 lsblk
65 history
[root@ip-172-31-20-67 opt]#
Done, You can use this RAID5 device with ONE disk failure facility.
References:
Please give a comment on this article..
Comments
Post a Comment
Please share your thought here....