Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:centos:8:avance:l119 [2023/12/09 17:47] – created admin | elearning:workbooks:centos:8:avance:l119 [2024/10/01 10:29] (Version actuelle) – created admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
+ | |||
+ | Version : **2024.01** | ||
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======LCF302 | + | ======LCF611 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF302 | + | * **LCF611 |
* Contenu du Module | * Contenu du Module | ||
- | * Concepts RAID | + | * LAB #1 - Gestion des Clones |
- | * Disques en miroir | + | * 1.1 - Création d'une VM à partir d'un Clone |
- | * Bandes de données | + | * LAB #2 - Gestion des Snapshots |
- | * Types de RAID | + | * 2.1 - Création d'un Snapshot - VM Arrêté |
- | * RAID 0 - Concaténation | + | * 2.2 - Création d'un Snapshot - VM en Cours d' |
- | * RAID 0 - Striping | + | * 2.3 - Restauration |
- | * RAID 1 - Miroir | + | * 2.4 - Suppression |
- | * RAID 1+0 - Striping | + | * LAB #3 - Gestion des Sauvegardes |
- | * RAID 2 - Miroir avec Contrôle | + | * 3.1 - Création d'une Copie du Disque de la VM |
- | * RAID 3 et 4 - Striping avec Parité | + | * 3.2 - Création d'une Copie de la Configuration de la VM |
- | * RAID 5 - Striping avec Parité Distribuée | + | * 3.3 - Sauvegarder les Copies |
- | * Au délà | + | |
- | * RAID Logiciel sous RHEL/CentOS | + | =====LAB #1 - Gestion des Clones===== |
- | * Préparation | + | |
- | * Partitionnement | + | |
- | * Mise en Place du RAID 5 Logiciel | + | |
- | =====Concepts RAID===== | + | La création de clones offre une méthode rapide de création de VMs basées sur des configurations déjà existantes. |
- | Les solutions RAID ou //Redundant Array of Independent Disks// ou encore //Redundant Array of Inexpensive Disks// permettent la combinaison de plusieurs disques de façon à ce que ceux-ci soient vu comme un seul disque logique. | + | ====1.1 |
- | Les solutions RAID sont issues du travail fourni | + | Commencez |
- | * Addition des capacités, | + | < |
- | * Amélioration des performances, | + | [root@centos8 ~]# virsh list |
- | | + | Id |
+ | ------------------------- | ||
+ | | ||
+ | </ | ||
- | Deux concepts sont fondamentaux à la compréhension des solutions RAID. | + | <WRAP center round important> |
+ | **Important** : Notez que la VM est dans un état de **running** et que son **Id** est de **3**. | ||
+ | </ | ||
- | ====Disques | + | Afin de procéder à la création d'un clone, arrêtez la VM avec la commande **virsh shutdown**. Cette commande peut prendre |
- | La technique des disques en miroir consiste à dupliquer l' | + | < |
+ | [root@centos8 ~]# virsh shutdown 3 | ||
+ | Domain 3 is being shutdown | ||
+ | </ | ||
- | ====Bandes de données==== | + | Vérifiez ensuite que la VM est arrêtée : |
- | La technique des bandes de données, autrement appelée //data striping// consiste à couper les données à enregistrer en segments séquentiels et contigus pour les enregistrer sur plusieurs disques physiques. L' | + | < |
+ | [root@centos8 ~]# virsh list | ||
+ | | ||
+ | -------------------- | ||
- | =====Types de RAID===== | + | </ |
- | ====RAID 0 - Concaténation==== | + | Utilisez la commande **virsh-clone** pour créer une deuxième VM dénommée **testvm2** ayant une image au format qcow2 stockée dans le répertoire **/ |
- | Création de volume par récupération de l'espace libre sur un ou plusieurs disques. Le principe de la concaténation est la création d'un volume à bandes où chaque bande est une tranche. | + | < |
+ | [root@centos8 ~]# virt-clone --original testvm1 --name testvm2 -f / | ||
+ | Allocating | ||
- | {{: | + | Clone ' |
+ | </ | ||
- | ===Avantages=== | + | <WRAP center round important> |
+ | **Important** : Notez la rapidité de la création du clone par rapport à la lenteur de la création d'une VM à partir d'une image ISO. | ||
+ | </ | ||
- | * Récupération | + | La sortie |
- | ===Inconvénients=== | + | < |
+ | [root@centos8 ~]# virsh list | ||
+ | | ||
+ | -------------------- | ||
- | * Pas de protection des données, | + | </code> |
- | * Pas d' | + | |
- | ====RAID 0 - Striping==== | + | Pour voir la liste des VMs, peu importe leurs états, utilisez l' |
- | Création de volume sur plusieurs disques afin d' | + | < |
+ | [root@centos8 ~]# virsh list --all | ||
+ | | ||
+ | -------------------------- | ||
+ | | ||
+ | | ||
+ | </code> | ||
+ | |||
+ | Le **State** peut être une des valeurs suivantes : | ||
- | {{: | + | * **running** - la machine virtuelle est active, |
+ | * **blocked** ou **blocking** - la machine virtuelle est en attente d'E/S ou l' | ||
+ | * **paused** - la machine virtuelle est suspendue, | ||
+ | * **shutdown** - la machine virtuelle est en cours d' | ||
+ | * **shut off** - la machine virtuelle est éteinte et elle n' | ||
+ | * **crashed** - la machine virtuelle a crashée et est arrêtée. | ||
+ | |||
+ | =====LAB #2 - Gestion des Snapshots===== | ||
- | ===Avantages=== | + | La création de snapshots offre une méthode rapide de sauvegarde des VMs. |
- | * Augmentation des performances d'E/S par écriture en parallèle sur les disques. | + | Il existe deux types de snapshots : |
- | ===Inconvénients=== | + | * **Internal**, |
+ | * uniquement possibles avec les images qcow2, | ||
+ | * la VM est mise en pause pendant la création du snapshot, | ||
+ | * ne fonctionne pas avec des pools de stockage de type LVM. | ||
+ | * **External**, | ||
+ | * sont basés sur le concept COW (**C**opy **O**n **W**rite), | ||
+ | * l' | ||
+ | * une image de type overlay en mode lecture/ | ||
+ | * est compatible avec n’importe lequel des formats de l' | ||
- | * Pas de protection des données. | + | ====2.1 - Création d'un Snapshot - VM Arrêté==== |
- | ====RAID 1 - Miroir==== | + | Utilisez la commande **virsh snapshot-list** pour consulter la liste des snapshots déjà présents pour la VM **testvm1** : |
- | Création d'un volume où les disques sont en miroir. Quand les deux disques sont connectés à des contrôleurs de disques différents, | + | < |
+ | [root@centos8 ~]# virsh snapshot-list testvm1 | ||
+ | | ||
+ | ------------------------------- | ||
- | {{: | + | </ |
- | ===Avantages=== | + | La création d'un snapshot se fait grâce à l' |
- | * Protection des données contre une défaillance d'un disque. | + | * **--domain**, |
+ | * le domaine à l'origine du snapshot, | ||
+ | * **--name**, | ||
+ | * le nom attribué au snapshot. | ||
- | ===Inconvénients=== | + | < |
+ | [root@centos8 ~]# virsh snapshot-create-as --domain testvm1 --name " | ||
+ | Domain snapshot testvm1-snap-03092021 created | ||
+ | </ | ||
- | * Coûteux à cause de l' | + | Vérifiez que le snapshot a bien été pris en compte : |
- | ====RAID 1+0 - Striping en Miroir==== | + | < |
+ | [root@centos8 ~]# virsh snapshot-list testvm1 | ||
+ | | ||
+ | -------------------------------------------------------------- | ||
+ | | ||
+ | </ | ||
- | Le RAID 1+0 ou encore 0+1 est une technique qui réunit le RAID 0 et le RAID 1. On l'appelle aussi un RAID **exotique**: | + | <WRAP center round important> |
+ | **Important** : Notez que l'état est **shutoff**. | ||
+ | </ | ||
- | {{:linux: | + | Pour obtenir des informations concernant le snapshot, il convient d' |
- | ===Avantages=== | + | < |
+ | [root@centos8 ~]# virsh snapshot-info --domain testvm1 --current | ||
+ | Name: | ||
+ | Domain: | ||
+ | Current: | ||
+ | State: | ||
+ | Location: | ||
+ | Parent: | ||
+ | Children: | ||
+ | Descendants: | ||
+ | Metadata: | ||
+ | </ | ||
- | * Protection des données contre une défaillance | + | ====2.2 - Création |
- | * Augmentation des performances | + | |
- | ===Inconvénients=== | + | Il est aussi possible de prendre des snapshot d'une VM en cours d' |
- | | + | Démarrez donc la VM **testvm2** avec la commande **virsh start** : |
- | ====RAID 2 - Miroir avec Contrôle d' | + | < |
+ | [root@centos8 ~]# virsh start testvm2 | ||
+ | Domain testvm2 started | ||
- | Le RAID 2 est une technique de miroir avec contrôle de correction d' | + | </ |
- | ====RAID 3 et 4 - Striping avec Parité==== | + | Vérifiez ensuite l' |
- | Les RAID 3 et 4 sont des technologies avec bandes de parité distribuées sur un seul disque : | + | < |
+ | [root@centos8 ~]# virsh list --all | ||
+ | | ||
+ | -------------------------- | ||
+ | 4 | ||
+ | | ||
- | {{: | + | </ |
- | En RAID 3, la taille des segments n’est pas modifiable et est fixée à 512 octets (en RAID 3 : un segment = un secteur de disque dur = 512 octets). | + | Créez |
- | + | ||
- | En RAID 4, la taille des segments est variable et se modifie en temps réel. Cela implique que les informations de parité doivent être mise à jour à chaque écriture afin de vérifier si la taille des segments a été modifiée. | + | |
- | + | ||
- | ===Avantages=== | + | |
- | + | ||
- | * Protection des données contre une défaillance d'un disque. | + | |
- | + | ||
- | ===Inconvénients=== | + | |
- | + | ||
- | * Création d'un goulot d' | + | |
- | + | ||
- | ====RAID 5 - Striping avec Parité Distribuée==== | + | |
- | + | ||
- | Le RAID 5 est une technologie avec bandes de parité distribuées sur plusieurs disques : | + | |
- | + | ||
- | {{: | + | |
- | + | ||
- | ===Avantages=== | + | |
- | + | ||
- | * Protection des données contre une défaillance d'un disque, | + | |
- | * Evite le goulot d' | + | |
- | + | ||
- | ===Inconvénients=== | + | |
- | + | ||
- | * Lecture moins performante qu' | + | |
- | + | ||
- | ====Au délà de RAID 5==== | + | |
- | + | ||
- | Il existe aussi deux autres technologies RAID, toute deux issues de la technologie RAID 5 : | + | |
- | + | ||
- | * RAID 6 | + | |
- | * //Disk Striping with Double Distributed Parity// | + | |
- | * RAID TP | + | |
- | * //Disk Striping with Triple Distributed Parity// | + | |
- | + | ||
- | =====RAID Logiciel sous RHEL/ | + | |
- | + | ||
- | ====Préparation du disque==== | + | |
- | + | ||
- | ===Partitionnement=== | + | |
- | + | ||
- | Suite à votre LAB de la leçon | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | + | Domain snapshot testvm2-snap-03092021 created | |
- | Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors | + | |
- | Units = sectors of 1 * 512 = 512 bytes | + | |
- | Sector size (logical/ | + | |
- | I/O size (minimum/ | + | |
- | Disk label type: dos | + | |
- | Disk identifier: 0x000c5a90 | + | |
- | + | ||
- | | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
</ | </ | ||
- | ====Mise en Place du RAID 5 Logiciel==== | + | Consultez la liste des snapshots pour le domaine |
- | + | ||
- | Dans le cas de cet exemple les quatre partitions concernées par la mise en place d'un RAID 5 sont : | + | |
- | + | ||
- | < | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | La création d'une unité RAID avec la commande | + | |
< | < | ||
- | mdadm --create <unité RAID> | + | [root@centos8 ~]# virsh snapshot-list testvm2 |
+ | | ||
+ | -------------------------------------------------------------- | ||
+ | | ||
</ | </ | ||
- | Par exemple, saisissez | + | Pour obtenir des informations concernant le dernier snapshot effectué pour le domaine **testvm2**, utilisez |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | mdadm: Defaulting to version 1.2 metadata | + | Name: |
- | mdadm: array /dev/md1 started. | + | Domain: |
+ | Current: | ||
+ | State: | ||
+ | Location: | ||
+ | Parent: | ||
+ | Children: | ||
+ | Descendants: 0 | ||
+ | Metadata: yes | ||
</ | </ | ||
- | Les options dans la ligne de commande sont : | + | <WRAP center round important> |
+ | **Important** | ||
+ | </ | ||
- | ^ Option Courte ^ Option Longue ^ Description ^ | + | ====2.3 - Restauration d'un Snapshot==== |
- | | -l | - -level | Le niveau RAID - **linear, 0,1,2,4 ou 5** | | + | |
- | | -n | - -raid-devices=< | + | |
- | Les autres options de la commande **mdadm** peuvent être visualisées grâce à la commande suivante | + | Pour restaurer un snapshot |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Any parameter that does not start with ' | + | Domain testvm2 |
- | or, for --examine-bitmap, | + | |
- | The first such name is often the name of an md device. | + | |
- | names are often names of component devices. | + | |
- | Some common options are: | + | [root@centos8 ~]# virsh list --all |
- | | + | Id |
- | mode specific help message | + | -------------------------- |
- | --help-options | + | |
- | --version | + | |
- | --verbose | + | |
- | --quiet | + | |
- | --brief | + | |
- | --export | + | |
- | key=value format for easy import into environment | + | |
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | --grow -G | + | |
- | --incremental -I | + | |
- | --query | + | |
- | | + | |
- | --auto-detect | + | |
</ | </ | ||
- | Les //modes majeurs// de la commande **mdadm** peuvent être visualisés grâce à la commande suivante | + | Restaurez ensuite le snapshot |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | mdadm is used for building, managing, and monitoring | + | |
- | Linux md devices (aka RAID arrays) | + | |
- | Usage: mdadm --create device options... | + | |
- | Create a new array from unused devices. | + | |
- | | + | |
- | Assemble a previously created array. | + | |
- | | + | |
- | Create or assemble an array without metadata. | + | |
- | | + | |
- | make changes to an existing array. | + | |
- | mdadm --misc options... devices | + | |
- | report on or modify various md related devices. | + | |
- | mdadm --grow options device | + | |
- | resize/ | + | |
- | mdadm --incremental device | + | |
- | add/remove a device to/from an array as appropriate | + | |
- | mdadm --monitor options... | + | |
- | Monitor one or more array for significant changes. | + | |
- | mdadm device options... | + | |
- | Shorthand for --manage. | + | |
- | Any parameter that does not start with ' | + | |
- | or, for --examine-bitmap, | + | |
- | The first such name is often the name of an md device. | + | |
- | names are often names of component devices. | + | |
- | For detailed help on the above major modes use --help after the mode | + | [root@centos8 ~]# virsh list --all |
- | e.g. | + | Id |
- | mdadm --assemble | + | -------------------------- |
- | For general help on options use | + | |
- | | + | |
</ | </ | ||
- | Dernièrement, | + | <WRAP center round important> |
+ | **Important** : Notez que le **State** est **running** après la restauration du snapshot. | ||
+ | </WRAP> | ||
+ | |||
+ | Connectez-vous à la VM grâce à la commande **virsh console** et vérifiez que celle-ci ne présente pas d’anomalies | ||
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | Usage: mdadm --assemble device options... | + | Connected to domain testvm2 |
- | mdadm --assemble --scan options... | + | Escape character is ^] |
- | This usage assembles one or more raid arrays from pre-existing | + | CentOS Linux 8 |
- | components. | + | Kernel 4.18.0-305.12.1.el8_4.x86_64 on an x86_64 |
- | For each array, mdadm needs to know the md device, the identity of | + | |
- | the array, and a number of sub devices. These can be found in a number | + | |
- | of ways. | + | |
- | The md device is given on the command line, is found listed in the | + | testvm1 login: root |
- | config file, or can be deduced from the array identity. | + | Mot de passe : fenestros |
- | The array identity is determined either from the --uuid, --name, or | + | Dernière connexion : Fri Sep 3 16:45:59 sur ttyS0 |
- | --super-minor commandline arguments, from the config file, | + | [root@testvm1 ~]# |
- | or from the first component device on the command line. | + | ... |
- | + | [root@testvm1 ~]# [ALT GR]+[CTRL]+[)] | |
- | The different combinations of these are as follows: | + | [root@centos8 ~]# |
- | If the --scan option is not given, then only devices and identities | + | |
- | | + | |
- | The first device will be the array device, and the remainder will be | + | |
- | | + | |
- | If an explicit identity is given with --uuid or --super-minor, | + | |
- | only devices with a superblock which matches that identity is considered, | + | |
- | | + | |
- | + | ||
- | If the --scan option is given, and no devices are listed, then | + | |
- | every array listed in the config file is considered for assembly. | + | |
- | The identity of candidate devices are determined from the config file. | + | |
- | After these arrays are assembled, mdadm will look for other devices | + | |
- | that could form further arrays and tries to assemble them. This can | + | |
- | be disabled using the ' | + | |
- | + | ||
- | If the --scan option is given as well as one or more devices, then | + | |
- | Those devices are md devices that are to be assembled. | + | |
- | and components are determined from the config file. | + | |
- | + | ||
- | If mdadm can not find all of the components for an array, it will assemble | + | |
- | it but not activate it unless --run or --scan is given. | + | |
- | | + | |
- | | + | |
- | as recorded in the superblock. | + | |
- | the missing device is not a new problem, it will still be assembled. | + | |
- | is only newly missing devices that cause the array not to be started. | + | |
- | + | ||
- | Options that are valid with --assemble (-A) are: | + | |
- | | + | |
- | --uuid= | + | |
- | have this uuid are excluded | + | |
- | --super-minor= -m | + | |
- | choosing devices to use. | + | |
- | | + | |
- | --config= | + | |
- | --scan | + | |
- | --run | + | |
- | for a full array are present | + | |
- | --force | + | |
- | : out-of-date. This involves modifying the superblocks. | + | |
- | | + | |
- | | + | |
- | --readonly | + | |
</ | </ | ||
- | Constatez maintenant les informations concernant le RAID 5 créé : | + | ====2.4 - Suppression de Snapshots==== |
- | < | + | Les snapshots peuvent être supprimés grâce |
- | [root@centos7 ~]# cat / | + | |
- | Personalities : [raid6] [raid5] [raid4] | + | |
- | md1 : active raid5 sda11[3] sda8[1] sda5[0] | + | |
- | 1021952 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] | + | |
- | + | ||
- | unused devices: < | + | |
- | </ | + | |
- | + | ||
- | Grâce | + | |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | /dev/md1: 998.17MiB raid5 3 devices, 0 spares. Use mdadm --detail for more detail. | + | Domain snapshot testvm1-snap-03092021 deleted |
- | </ | + | |
- | L' | + | [root@centos8 ~]# virsh snapshot-delete |
+ | Domain snapshot testvm2-snap-03092021 deleted | ||
- | < | + | [root@centos8 |
- | [root@centos7 | + | Name Creation Time State |
- | /dev/md1: | + | ------------------------------- |
- | | + | |
- | | + | |
- | Raid Level : raid5 | + | |
- | Array Size : 1021952 (998.17 MiB 1046.48 MB) | + | |
- | Used Dev Size : 510976 (499.08 MiB 523.24 MB) | + | |
- | | + | |
- | Total Devices : 3 | + | |
- | Persistence : Superblock is persistent | + | |
- | Update | + | [root@centos8 ~]# virsh snapshot-list testvm2 |
- | | + | |
- | | + | ------------------------------- |
- | Working Devices : 3 | + | </ |
- | Failed Devices : 0 | + | |
- | Spare Devices : 0 | + | |
- | | + | =====LAB #3 - Gestion des Sauvegardes===== |
- | Chunk Size : 512K | + | |
- | Name : centos7.fenestros.loc: | + | Pour effectuer une sauvegarde d'une VM en utilisant les outils classiques, il convient simplement de copier le fichier d' |
- | UUID : fd8bac53: | + | |
- | | + | |
- | Number | + | ====3.1 - Création d'une Sauvegarde |
- | | + | |
- | | + | |
- | 3 8 | + | |
- | </ | + | |
- | + | ||
- | Notez la ligne **Persistence : Superblock is persistent**. En effet, cette implémentation de RAID inscrit les caractéristiques | + | |
- | + | ||
- | <WRAP center round todo> | + | |
- | Recherchez | + | |
- | </ | + | |
- | Cependant, il necéssaire de renseigner le fichier | + | Actuellement seule la VM **testvm2** est en cours d' |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | [root@centos7 ~]# mdadm --detail | + | |
- | [root@centos7 | + | ------------------------- |
- | DEVICES /dev/sda5 /dev/sda8 / | + | |
- | ARRAY /dev/md1 metadata=1.2 name=centos7.fenestros.loc: | + | </ |
+ | |||
+ | Créez donc un répertoire destiné à contenir les copies créées : | ||
+ | |||
+ | <code> | ||
+ | [root@centos8 | ||
</ | </ | ||
- | Chaque unité peut être examinée individuellement | + | Placez-vous dans le répertoire des images **/ |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | /dev/sda5: | + | [root@centos8 images]# ls -l |
- | Magic : a92b4efc | + | total 4029008 |
- | | + | -rw-------. 1 root root 5369757696 Sep |
- | | + | -rw-------. 1 qemu qemu 2261123072 Sep 4 02:25 testvm2.qcow2 |
- | Array UUID : fd8bac53: | + | |
- | Name : centos7.fenestros.loc: | + | |
- | Creation Time : Tue Aug 2 15:10:12 2016 | + | |
- | Raid Level : raid5 | + | |
- | Raid Devices : 3 | + | |
- | + | ||
- | Avail Dev Size : 1021952 (499.08 MiB 523.24 MB) | + | |
- | Array Size : 1021952 (998.17 MiB 1046.48 MB) | + | |
- | Data Offset : 2048 sectors | + | |
- | Super Offset : 8 sectors | + | |
- | | + | |
- | State : clean | + | |
- | Device UUID : 4569e15e: | + | |
- | + | ||
- | Update Time : Tue Aug 2 15:10:17 2016 | + | |
- | Bad Block Log : 512 entries available at offset 72 sectors | + | |
- | | + | |
- | | + | |
- | + | ||
- | | + | |
- | Chunk Size : 512K | + | |
- | + | ||
- | | + | |
- | Array State : AAA (' | + | |
</ | </ | ||
- | A ce stade il est intéressant de noter comment réagir lors d'une défaillance d'un disque. Dans notre cas nous allons indiquer au système que la partition /dev/sda5 est devenue défaillante | + | Copiez ensuite l'image vers le répertoire **/vm-backups** |
< | < | ||
- | [root@centos7 ~]# mdadm --manage | + | [root@centos8 images]# cp -p testvm1-os.qcow2 /vm-backups/ |
- | mdadm: set /dev/sda5 faulty in /dev/md1 | + | |
</ | </ | ||
- | L' | + | <WRAP center round important> |
+ | **Important** : Notez que cette copie est effectuée en arrière plan afin de libérer | ||
+ | </WRAP> | ||
- | < | + | ====3.2 - Création d'une Sauvegarde de la Configuration de la VM==== |
- | [root@centos7 ~]# mdadm --detail /dev/md1 | + | |
- | /dev/md1: | + | |
- | Version : 1.2 | + | |
- | Creation Time : Tue Aug 2 15:10:12 2016 | + | |
- | Raid Level : raid5 | + | |
- | Array Size : 1021952 (998.17 MiB 1046.48 MB) | + | |
- | Used Dev Size : 510976 (499.08 MiB 523.24 MB) | + | |
- | Raid Devices : 3 | + | |
- | Total Devices : 3 | + | |
- | Persistence : Superblock is persistent | + | |
- | Update Time : Tue Aug 2 15:14:59 2016 | + | La configuration de chaque VM est contenue dans un fichier au format XML dans le répertoire **/ |
- | State : clean, degraded | + | |
- | | + | |
- | Working Devices : 2 | + | |
- | | + | |
- | Spare Devices : 0 | + | |
- | | + | < |
- | Chunk Size : 512K | + | [root@centos8 images]# cd / |
+ | [root@centos8 qemu]# ls -lR | ||
+ | .: | ||
+ | total 16 | ||
+ | drwx------. 3 root root 42 Sep 2 10:22 networks | ||
+ | -rw-------. 1 root root 4936 Sep 3 10:07 testvm1.xml | ||
+ | -rw-------. 1 root root 4933 Sep 3 11:35 testvm2.xml | ||
- | | + | ./networks: |
- | UUID : fd8bac53: | + | total 4 |
- | | + | drwx------. 2 root root 25 Aug 10 17:00 autostart |
+ | -rw-------. 1 root root 575 Sep 2 10:22 default.xml | ||
- | Number | + | ./ |
- | | + | total 0 |
- | | + | lrwxrwxrwx. |
- | | + | |
- | + | ||
- | | + | |
</ | </ | ||
- | Il est maintenant nécessaire | + | Si vous consultez le contenu du fichier **testvm1.xml**, |
- | <code> | + | <file> |
- | [root@centos7 ~]# mdadm --manage --remove /dev/md1 /dev/sda5 | + | ... |
- | mdadm: hot removed /dev/sda5 from /dev/md1 | + | < |
- | </code> | + | < |
- | + | ... | |
- | A l' | + | </file> |
< | < | ||
- | [root@centos7 ~]# mdadm --detail /dev/md1 | + | [root@centos8 qemu]# cat testvm1.xml |
- | /dev/md1: | + | <!-- |
- | | + | WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE |
- | | + | OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: |
- | Raid Level : raid5 | + | |
- | Array Size : 1021952 (998.17 MiB 1046.48 MB) | + | or other application using the libvirt API. |
- | Used Dev Size : 510976 (499.08 MiB 523.24 MB) | + | --> |
- | Raid Devices : 3 | + | |
- | Total Devices : 2 | + | |
- | Persistence : Superblock is persistent | + | |
- | Update Time : Tue Aug 2 15:16:41 2016 | + | <domain type=' |
- | | + | < |
- | Active Devices | + | < |
- | Working Devices : 2 | + | < |
- | Failed Devices | + | < |
- | Spare Devices : 0 | + | < |
+ | </ | ||
+ | </ | ||
+ | <memory unit=' | ||
+ | < | ||
+ | <vcpu placement=' | ||
+ | < | ||
+ | <type arch=' | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <cpu mode=' | ||
+ | <clock offset=' | ||
+ | <timer name=' | ||
+ | <timer name=' | ||
+ | <timer name=' | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <disk type=' | ||
+ | <driver name=' | ||
+ | <source file='/ | ||
+ | <target dev=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | <disk type=' | ||
+ | <driver name=' | ||
+ | <target dev=' | ||
+ | < | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <model name=' | ||
+ | <target chassis=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | < | ||
+ | <mac address=' | ||
+ | <source bridge=' | ||
+ | <model type=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | <serial type=' | ||
+ | <target type=' | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | <console type=' | ||
+ | <target type=' | ||
+ | </ | ||
+ | <channel type=' | ||
+ | <target type=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | <input type=' | ||
+ | <input type=' | ||
+ | < | ||
+ | <address type=' | ||
+ | </ | ||
+ | <rng model=' | ||
+ | <backend model=' | ||
+ | <address type=' | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
- | | ||
- | Chunk Size : 512K | ||
- | |||
- | Name : centos7.fenestros.loc: | ||
- | UUID : fd8bac53: | ||
- | | ||
- | |||
- | Number | ||
- | | ||
- | | ||
- | | ||
</ | </ | ||
- | Constatez maintenant l' | + | Ce fichier doit donc être copié vers le répertoire **/ |
< | < | ||
- | [root@centos7 ~]# cat /proc/mdstat | + | [root@centos8 qemu]# cp -p testvm1.xml |
- | Personalities : [raid6] [raid5] [raid4] | + | |
- | md1 : active raid5 sda11[3] sda8[1] | + | |
- | 1021952 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU] | + | |
- | + | ||
- | unused devices: < | + | |
</ | </ | ||
- | <WRAP center round important> | + | Une fois le processus en arrière plan terminé, vous pouvez constater la présence des deux fichiers dans le répertoire |
- | Notez que le RAID a été démarré avec 2 unités au lieu de trois. | + | |
- | </ | + | |
- | + | ||
- | Pour ajouter un autre disque à notre RAID afin de remplacer /dev/sda5 il convient d' | + | |
< | < | ||
- | [root@centos7 ~]# mdadm --manage | + | [root@centos8 vm-backups]# ls -l |
- | mdadm: added /dev/sda10 | + | total 3992904 |
+ | -rw-------. 1 root root 5369757696 Sep 3 11:42 testvm1-os.qcow2-04092021 | ||
+ | -rw-------. 1 root root 4936 Sep 3 10:07 testvm1.xml-backup-04092021 | ||
</ | </ | ||
- | L' | + | Notez que la taille de l'image de testvm1 est de 5 Go malgré le fait qu'il n'y ait que 1,7 Go alloué |
< | < | ||
- | [root@centos7 | + | [root@centos8 |
- | /dev/md1: | + | Name: testvm1-os.qcow2 |
- | | + | Type: file |
- | | + | Capacity: 5.00 GiB |
- | Raid Level : raid5 | + | Allocation: 1.70 GiB |
- | Array Size : 1021952 (998.17 MiB 1046.48 MB) | + | </ |
- | Used Dev Size : 510976 (499.08 MiB 523.24 MB) | + | |
- | Raid Devices : 3 | + | |
- | Total Devices : 3 | + | |
- | Persistence : Superblock is persistent | + | |
- | Update Time : Tue Aug 2 15:19:06 2016 | + | ====3.3 - Sauvegarder les Copies des Fichiers==== |
- | State : clean | + | |
- | | + | |
- | Working Devices : 3 | + | |
- | | + | |
- | Spare Devices : 0 | + | |
- | | + | Ayant effectué les copies, il est maintenant possible de sauvegarder les fichiers à l'aide d'un outil classique tel **tar** |
- | Chunk Size : 512K | + | |
- | Name : centos7.fenestros.loc: | + | < |
- | UUID : fd8bac53: | + | [root@centos8 vm-backups]# |
- | Events : 40 | + | [root@centos8 vm-backups]# |
+ | [root@centos8 vm-backups]# | ||
+ | testvm1 | ||
- | Number | + | [root@centos8 vm-backups]# |
- | | + | testvm1/ |
- | 1 | + | testvm1/testvm1-os.qcow2-04092021 |
- | 3 | + | testvm1/testvm1.xml-backup-04092021 |
- | </code> | + | |
- | Naturellement, | + | [root@centos8 vm-backups]# ls -l |
- | + | total 846724 | |
- | < | + | drwxr-xr-x. 2 root root 74 Sep 4 03:19 testvm1 |
- | [root@centos7 ~]# echo ' | + | -rw-r--r--. 1 root root 867042697 Sep 4 03:24 testvm1-backup-04092021.tar.gz |
- | [root@centos7 ~]# mdadm --detail | + | |
- | [root@centos7 ~]# cat /etc/mdadm.conf | + | |
- | DEVICES /dev/sda10 /dev/sda8 / | + | |
- | ARRAY /dev/md1 metadata=1.2 name=centos7.fenestros.loc: | + | |
</ | </ | ||
----- | ----- | ||
- | < | + | Copyright © 2024 Hugh Norris |
- | <div align=" | + | |
- | Copyright © 2020 Hugh Norris. | + | |
- | </ | + |