Como criar/montar Raid no Oracle Linux 8.x
Vamos aos comandos para criar um RAID 1(2 HDs espelhados).
Vamos listar as unidades de disco, no caso usarei os devices(unidades de disco) /dev/sdc e /dev/sdd.
[root@cloud ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 74.5G 0 disk ├─sda1 8:1 0 2M 0 part ├─sda2 8:2 0 60.5G 0 part / └─sda3 8:3 0 14G 0 part [SWAP] sdb 8:16 0 931.5G 0 disk sdc 8:32 0 465.8G 0 disk sdd 8:48 0 465.8G 0 disk
[root@cloud ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sd[cd]
-- create -- cria o device /dev/md0
--level=1 -- Criar o raid do tipo 1
--raid-devices -- quantidade de disco/unidades de disco
/dev/sd[cd] -- devices "c" e "d"
Verificando se o Device virtual foi criado:
[root@cloud ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 74.5G 0 disk ├─sda1 8:1 0 2M 0 part ├─sda2 8:2 0 60.5G 0 part / └─sda3 8:3 0 14G 0 part [SWAP] sdb 8:16 0 931.5G 0 disk sdc 8:32 0 465.8G 0 disk └─md0 9:0 0 465.7G 0 raid1 sdd 8:48 0 465.8G 0 disk └─md0 9:0 0 465.7G 0 raid1
[root@cloud ~]# mkfs.ext4 /dev/md0
root@cloud ~]# mkdir /mnt/raid500g [root@cloud ~]# mount /dev/md0 /mnt/raid500g/ [root@cloud ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 12G 0 12G 0% /dev tmpfs 12G 0 12G 0% /dev/shm tmpfs 12G 18M 12G 1% /run tmpfs 12G 0 12G 0% /sys/fs/cgroup /dev/sda2 61G 6.3G 55G 11% / tmpfs 2.4G 16K 2.4G 1% /run/user/42 tmpfs 2.4G 4.0K 2.4G 1% /run/user/1000 /dev/md0 458G 73M 434G 1% /mnt/raid500g
[root@cloud ~]# echo "/dev/md0 /mnt/raid500g ext4 defaults 0 0 " >> /etc/fstab
Para testar eu desmonto a unidade e executo o comando " mount -a ". Este comando executa a leitura do arquivo /etc/fstab, onde estão configuradas a unidades que devem ser montadas durante a inicialização do S.O.(Sistema Operacional).
[root@cloud ~]# umount /mnt/raid500g [root@cloud ~]# mount -a [root@cloud ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 12G 0 12G 0% /dev tmpfs 12G 0 12G 0% /dev/shm tmpfs 12G 18M 12G 1% /run tmpfs 12G 0 12G 0% /sys/fs/cgroup /dev/sda2 61G 6.3G 55G 11% / tmpfs 2.4G 16K 2.4G 1% /run/user/42 tmpfs 2.4G 4.0K 2.4G 1% /run/user/1000 /dev/md0 458G 73M 434G 1% /mnt/raid500g [root@cloud ~]#
Criar arquivo de configuração:
[root@cloud ~]# mdadm --examine --scan >> /etc/mdadm.conf
[root@cloud ~]# cat /etc/mdadm.conf
ARRAY /dev/md/0 metadata=1.2 UUID=a47541aa:b53fed36:20755ebc:d547bdb9 name=cloud.granducato:0
Verificar o status do RAID:
[root@cloud ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdd[1] sdc[0](F)
488254464 blocks super 1.2 [2/1] [_U]
bitmap: 4/4 pages [16KB], 65536KB chunk
unused devices: <none>
Informações mais detalhadas do seu RAID:
[root@cloud ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Thu Jun 2 23:59:55 2022
Raid Level : raid1
Array Size : 488254464 (465.64 GiB 499.97 GB)
Used Dev Size : 488254464 (465.64 GiB 499.97 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Intent Bitmap : Internal
Update Time : Fri Jun 3 00:26:23 2022
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 1
Spare Devices : 0
Consistency Policy : bitmap
Name : cloud.granducato:0 (local to host cloud.granducato)
UUID : a47541aa:b53fed36:20755ebc:d547bdb9
Events : 1596
Number Major Minor RaidDevice State
- 0 0 0 removed
1 8 48 1 active sync /dev/sdd
0 8 32 - faulty missing
Fontes:
- Oracle Linux 6 - Creating Software RAID Devices
#linux #mdadm #raid #raidlinux
Comentários