Tuesday, February 16, 2021

How to Create NFS Server (RAID 5) in Huawei 2288H V5 with CentOS

On this tutorial, we're gonna create NFS Server in Huawei 2288H V5 (prod. 2020) as an example. You can follow this tutorial to create a NFS Server in hardware that don't have a RAID Controller. 


As you know, RAID level 5 uses striping, which means, the data is spread across number of disks used in the array, and also provides redundancy with the help of distributed parity. RAID 5 is the best cost effective solution for both performance and redundancy. Minimum number of disks required for raid 5 is 3 disk. One important part in RAID5 is that the reading rate is much better than writing. And this is due to the parity overhead. 



So, be aware! in RAID 5 Reading Speed > Writing Speed 


First, you need to install a CentOS 7/8 on your machine. Update to the latest packages available.
Check if your machine is have a RAID 5 or other RAID available with lsblk command

lsblk

[root@localhost ~]# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0 894.3G  0 disk  
|-sda1        8:1    0   600M  0 part  /boot/efi
|-sda2        8:2    0     1G  0 part  /boot
`-sda3        8:3    0 892.7G  0 part  
  |-cl-root 253:0    0    50G  0 lvm   /
  |-cl-swap 253:1    0     4G  0 lvm   [SWAP]
  `-cl-home 253:2    0 838.7G  0 lvm   /home
sdb           8:16   0 894.3G  0 disk  
`-md5         9:5    0   2.6T  0 raid5 /disk
sdc           8:32   0 894.3G  0 disk  
`-md5         9:5    0   2.6T  0 raid5 /disk
sdd           8:48   0 894.3G  0 disk  
`-md5         9:5    0   2.6T  0 raid5 /disk
sde           8:64   0   2.2T  0 disk  
`-md5         9:5    0   2.6T  0 raid5 /disk

as you may read on those example, we have 4 disk: sdb, sdc, sdd and sde. Minimum requirement for RAID5 Configuration is 3 disk.
1. Install mdadm package
dnf install -y mdadm
2. Check if any RAID configuration in disk with mdadm -E
mdadm -E /dev/sdb /dev/sdc /dev/sdd /dev/sde
3. Create mdadm config with mdadm --create command:
mdadm --create /dev/md5 --level=5 --raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
you may customize those command, especcially for --raid-devices parameter and /dev/sdX parameter.
4. verify the mdadm configuration:
mdadm -D /dev/md5
5. create partition on those RAID:
mkfs.ext4 /dev/md5
6. create a mounting point directory
mkdir /storage
7. get the UUID and place it on /etc/fstab
blkid /dev/md5
as an example: /dev/md5: UUID=" 3a27f241-d7c2-4e56-893e-93042ae62398" TYPE=" ext4" place UUID in /etc/fstab:
UUID=3a27f241-d7c2-4e56-893e-93042ae62398     /raid5   ext4     defaults 0 0
8. mount the disk:
mount -a
check with df -h

0 comments:

Post a Comment