# [Debian] Installation avec RAID

## Introduction

Ce TP est réalisé dans le cadre d'un cours à l'ESGI, et a pour but de mettre en place un serveur Debian fonctionnel avec **2 disques de 20Go** où on retrouve la configuration suivante :

- Pas de raid pour la partition de démarrage.
- Raid0 pour le swap de 1G sur chaque disque.
- Raid1 en ext4 pour la partition racine.

L'installation sera réalisée dans mon cas sur une machine virtuelle sous **Proxmox** mais peut très bien fonctionner dans d'autres configurations.

## Installation

Je ne détaillerai pas la création de la VM ni le début de l'installation de Debian car elle est tout à fait traditionnelle.

Arrêtons-nous sur le partitionnement des disques et sélectionnons le disque **sda** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/sMTimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/sMTimage.png)

Il nous est demandé si on souhaite créer une nouvelle table des partitions, faites **Oui** :

![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/fWkimage.png)

On réitère pour le disque **sdb** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/Wf8image.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/Wf8image.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/A9bimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/A9bimage.png)

Il faut ensuite créer la partition de démarrage ainsi que les partitions pour accueillir les raids.

On commence par créer une partition **primaire** de **512MB** sur le disque **sda** qui sera formatée en **FAT32,** qui aura comme point de montage **/boot/efi** et qui accueillera l'indicateur d'amorçage :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/GUrimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/GUrimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/ztHimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/ztHimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/Njiimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/Njiimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/AVFimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/AVFimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/SNAimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/SNAimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/wekimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/wekimage.png)

On peut maintenant créer les partitions qui seront utilisés comme **volume physique pour RAID** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/RIsimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/RIsimage.png)

Je rappelle qu'on vient créer une partition de 1GB pour le SWAP et une partition de 20GB pour le système s**ur chaque disque**.

On obtient donc la configuration suivante :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/xBBimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/xBBimage.png)

<p class="callout info">On notera qu'il reste un peu d'espace sur le deuxième disque qui représente l'espace qui a été utilisé sur le premier disque par la partition de démarrage.</p>

On peut maintenant **Configurer le RAID avec gestion logicielle** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/rmsimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/rmsimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/R2dimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/R2dimage.png)

On commence par le **RAID0** de la SWAP :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/7r1image.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/7r1image.png)

On sélectionnes les deux partitions de 1Go :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/BDmimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/BDmimage.png)

On réitère l'opération pour le RAID du système:

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/PGUimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/PGUimage.png)

Cette fois on configure un **RAID1** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/Iioimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/Iioimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/mHlimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/mHlimage.png)

Dans notre configuration, nous n'aurons pas de disque de réserve (spare), laissez 0 :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/7Pfimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/7Pfimage.png)

On sélectionnes les deux partitions de 20Go :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/8xIimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/8xIimage.png)

Et on peut **Terminer** la configuration des périphériques RAID :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/ir5image.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/ir5image.png)

Désormais, on sélectionne le **Périphérique RAID0** pour configurer la SWAP :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/uRnimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/uRnimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/fHaimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/fHaimage.png)

Puis on sélectionne le **périphérique RAID1** pour configurer la racine du système :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/RU2image.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/RU2image.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/6ubimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/6ubimage.png)

On peut enfin **Terminer le partitionnement et appliquer les changements** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/7TFimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/7TFimage.png)

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/YYsimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/YYsimage.png)

Vous pouvez poursuivre l'installation du système de manière standard sauf pour l'installation de GRUB où vous allez devoir sélectionner le disque **/dev/sda** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/90iimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/90iimage.png)

## Vérification de la configuration

Une fois le système redémarré, on peut s'assurer de la configuration des partitions grâce à la commande **lsblk** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/0C1image.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/0C1image.png)

Puis on peut vérifier l'état du RAID0 grâce à la commande **mdadm --detail /dev/md0** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/4Rzimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/4Rzimage.png)

Et enfin, l'état du RAID1 grâce à la commande **mdadm --detail /dev/md1** :

[![image.png](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/scaled-1680-/fcZimage.png)](https://wiki.neopipe.fr/uploads/images/gallery/2023-11/fcZimage.png)