====== RAID logiciel ======
Comme pour le partitionnement, le RAID logiciel se réalise en bootant en mode rescue pour une machine hébergée ou sur une clé USB pour une machine locale.
Il faut disposer de partitions de mêmes tailles sur des disques différents.
J'utilise un RAID 1, c'est à dire une duplication des données sur 2 disques.
===== Installation de mdadm =====
root@secours:~# apt-get install mdadm
...
root@secours:~#
===== Création du RAID =====
root@secours:~# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
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? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.
root@secours:~#
===== Vérification du RAID =====
root@secours:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb1[1] sda1[0]
83818496 blocks super 1.2 [2/2] [UU]
[===============>.....] resync = 75.4% (63217792/83818496) finish=1.6min speed=206312K/sec
unused devices:
root@secours:~#
L'installation n'est pas terminé.
root@secours:~# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdb1[1] sda1[0]
83818496 blocks super 1.2 [2/2] [UU]
unused devices:
root@secours:~#
L'installation est terminé.
===== Fichier de configuration /etc/mdadm/mdadm.conf =====
==== Version original ====
# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers
# automatically tag new arrays as belonging to the local system
HOMEHOST
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
# This configuration was auto-generated on Wed, 23 Feb 2022 20:09:11 +0100 by mkconf
==== Ajout des informations sur le RAID dans la configuration ====
root@secours:~# mdadm --examine --scan --verbose >> /etc/mdadm/mdadm.conf
root@secours:~#
root@secours:~# mdadm --examine --scan --verbose
ARRAY /dev/md/1 level=raid1 metadata=1.2 num-devices=2 UUID=ab8cec1d:ce25ea60:f2b63961:da3d684e name=secours:1
devices=/dev/sdb1,/dev/sda1
root@secours:~#
==== Enregistrement de la configuration ====
root@secours:~# update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.10.0-11-amd64
update-initramfs: Generating /boot/initrd.img-5.10.0-10-amd64
root@secours:~#
===== Suite =====
* [[Volume physique et groupe de volumes LVM|Création d'un volume physique et d'un groupe de volumes LVM]]