Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh134:l105 [2024/09/26 13:25] – created adminelearning:workbooks:redhat:rh134:l105 [2024/10/24 09:58] (Version actuelle) admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF504 - Gestion des Disques, des Systèmes de Fichiers et du Swap======+======RH13406 - Gestion du Démarrage et de l'Arrêt du Système======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF504 - Gestion des Disques, des Systèmes de Fichiers et du Swap**+  * **RH13406 - Gestion du Démarrage et de l'Arrêt du Système**
     * Contenu du Module     * Contenu du Module
-    * Périphériques de stockage +    * Présentation 
-    * Partitions +    * BIOS, EFI et OpenFirmware 
-    Partitionnement +      Systèmes à base du BIOS 
-      * LAB #1 - Partitionnement de votre Disque avec fdisk +        * Charger de Démarrage 
-      * LAB #2 - Modifier les Drapeaux des Partitions avec fdisk +      * Systèmes à base de l'EFI 
-    * Logical Volume Manager (LVM) +      * Autres Systèmes 
-      * LAB #3 - Volumes Logiques Linéaires +    * Gestionnaire d'amorçage 
-        * Physical Volume (PV) +      * GRUB 2 
-        * Volume Group (VG) et Physical Extent (PE) +        * Le fichier /boot/grub/device.map 
-        * Logical Volumes (LV) +        * Le fichier /etc/default/grub 
-      LAB #4 - Étendre un Volume Logique à Chaud +        * Les fichiers du répertoire /etc/grub.d 
-      LAB #5 - Snapshots +        Configurer l'Authentification 
-      * LAB #6 - Suppression des Volumes +        Modifier la Configuration de GRUB 2 en Ligne de Commande 
-      LAB #7 Volumes Logiques en Miroir +      * Chargeurs de Démarrages Alternatifs 
-      LAB #8 Modifier les Attributs LVM +        Systemd-boot 
-      LAB #9 - Volumes Logiques en Bandes +        U-boot 
-      LAB #10 - Gérer les Métadonnées +        Le Projet Syslinux 
-    Systèmes de Fichiers Journalisés +          SYSLINUX 
-      Présentation +          EXTLINUX 
-      Ext3 +          ISOLINUX 
-        * Gestion d'Ext3 +          PXELINUX 
-        LAB #11 - Convertir un Système de Fichiers Ext3 en Ext2 +        * Isodhpfx 
-        LAB #12 - Convertir un Système de Fichiers Ext2 en Ext3 +    Initramfs 
-        LAB #13 - Placer le Journal sur un autre Partition +      Examiner l'image existante 
-        LAB #14 - Modifier la Fréquence de Vérification du Système de Fichiers Ext3 +      Le script init 
-      Ext4 +      * Consulter le contenu d'un fichier dans initramfs 
-        LAB #15 - Créer un Système de Fichiers Ext4 +    Processus de Démarrage du Noyau Linux 
-        * LAB #16 Ajouter une Étiquette au Système de Fichiers Ext4 +    Processus Init 
-        * LAB #17 Convertir un Système de Fichiers Ext3 en Ext4 +    Systemd 
-      * XFS +      * LAB #La Commande systemctl 
-        * LAB #18 Créer un Système de Fichiers XFS +      * LAB #Fichiers de Configuration 
-        * LAB #19 Ajouter une Étiquette au Système de Fichiers XFS +        * 2.1 Fichiers de Configuration par Défaut 
-      * Autres Systèmes de Fichiers +        * 2.2 Surchargement des Fichiers de Configuration par Défaut 
-        * ReiserFS +      * LAB #- La Commande systemd-analyze 
-        * JFS +      * LAB #Les Cibles Systemd 
-        * Btrfs +        * 4.1 - Contrôler les dépendances d'une Cible 
-      * Comparaison des Commandes par Système de Fichiers +        * 4.2 - La Cible par Défaut 
-    * LAB #20 Créer un Système de Fichiers ISO +    * Arrêt Système du Système 
-      * La Commande mkisofs +      * La Commande shutdown 
-    * Systèmes de Fichiers Chiffrés +      * La Commande reboot 
-      * LAB #21 Créer un Système de Fichiers Chiffré avec LUKS +      * La Commande halt 
-        * Présentation +      * La Commande poweroff
-        * Mise en Place +
-        * Ajouter une deuxième Passphrase +
-        * Supprimer une Passphrase +
-    * Raid Logiciel +
-      * LAB #22 Mise en Place du RAID 5 Logiciel +
-        * 22.1 - Préparer le disque +
-        * 22.2 - Créer une Unité RAID +
-        * 22.3 - Remplacer une Unité Défaillante +
-    * Le Swap +
-      * Taille du swap +
-      * Partitions de swap +
-      * La Commande swapon +
-      * La Commande swapoff +
-      * LAB #23 - Créer un Fichier de Swap+
  
-=====Périphériques de stockage=====+=====Présentation=====
  
-Les unités de stockage sous Linux sont référencées par un des fichiers se trouvant dans le répertoire **/dev** :+Le processus de démarrage de Linux peut être résumé en trois étapes majeurs :
  
-  * hd[a-d] +  * Le **firmware** ou **micrologiciel** démarre en effectuant un test rapide du matériel, appelé un **Power-On Self Test** ou **POST**, puis recherche le **Charger de Démarrage** (//Bootloader//) à exécuter à partir d'un support bootable
-    Les disques IDE et les lecteurs ATAPI +  * Le Charger de Démarrage est exécuté et il détermine quel noyau Linux à charger, 
-  sd[a-z] +  * Le noyau se charge en mémoire et commence à exécuter en arrière plan les programmes nécessaires au fonctionnement du système.
-    Les disques SCSI et SATA +
-  mmcblk[0-7] +
-    Les cartes SD/MMC +
-  scd[0-7] +
-    Les CDRoms SCSI +
-  xd[a-d] +
-    Les premiers disques sur IBM XT +
-  fd[0-7] +
-    Les lecteurs de disquettes +
-  st[0-7] +
-    Les lecteurs de bandes SCSI/SATA qui **supportent** le rembobinage +
-  nst[0-7] +
-    Les lecteurs de bandes SCSI/SATA qui ne supportent **pas** le rembobinage +
-  * ht[0-7] +
-    * Les lecteurs de bandes PATA qui **supportent** le rembobinage +
-  * nht[0-7] +
-    * Les lecteurs de bandes PATA qui ne supportent **pas** le rembobinage +
-  * rmt8, rmt16, tape-d, tape-reset +
-    * Les lecteurs QIC-80 +
-  * ram[0-15] +
-    * Les disques virtuels. Ils sont supprimés à l'extinction de la machine. Un de ces disques est utilisé par le système pour monter l'image d'un disque racine défini par le fichier **initrd** au démarrage de la machine +
-  * Périphériques **loop** +
-    * Il existe 16 unités loop qui sont utilisés pour accèder en mode bloc à un système de fichiers contenu dans un fichier, par exemple, une image **iso** +
-  * md[x] +
-    * Un volume **RAID** logiciel +
-  * vg[x] +
-    * Un groupe de volumes +
-  * lv[x] +
-    * Un volume logique+
  
-=====Partitions=====+<WRAP center round tip 60%> 
 +**A retenir** : Il est possible de consulter le défilement des messages lors du démarrage en appuyant sur la touche <key>Echap</key> ou simultanément sur les touches <key>Ctrl</key>+<key>Alt</key>+<key>F1</key>. En sachant que la liste des messages se défilent rapidement, il est possible de les consulter **après** le démarrage du système à l'aide de la commande **dmesg** qui lit les derniers messages contenu dans le **Kernel Ring Buffer**. Ces messages sont aussi copiés dans le fichier **/var/log/boot.log**. 
 +</WRAP>
  
-Un PC comportent en règle générale 2 **contrôleurs** de disque, chacun capable de gérer 2 disques, un **maître** et un **esclave**Les disques attachés à ces contrôleurs comportent des noms différents pour pouvoir les distinguer :+Cette description simpliste résume cependant un processus bien plus compliqué que ce cours va détailler.
  
-  * Contrôleur 0 +=====BIOS, EFI et OpenFirmware=====
-    * Maître +
-      * **hda** - disque IDE +
-      * **sda** - disque SATA ou SCSI +
-    * Esclave +
-      * **hdb** - disque IDE +
-      * **sdb** - disque SATA ou SCSI +
-  * Contrôleur 1 +
-    * Maître +
-      * **hdc** - disque IDE +
-      * **sdc** - disque SATA ou SCSI +
-    * Esclave +
-      * **hdd** - disque IDE +
-      * **sdd** - disque SATA ou SCSI+
  
-Un disque peut comporter trois types de partitions :+====Systèmes à base du BIOS====
  
-  * **Partitions primaires**, +Au démarrage d'un système à base d'un processeur x86 ou x86-64le premier programme exécuté a été traditionnellement le BIOSLe BIOS a pour fonction de :
-    * Maximum de **4**En effet, la Table des Partitions est grande de 64 octets. Il faut 16 octets pour codés une partition. +
-  * **Partitions Etendues**, +
-    * Généralement une seule partition étendue par disque. Elle contient des **Lecteurs Logiques** aussi appelés des partitions, +
-  * **Lecteurs Logiqiques**.+
  
-Les 4 partitions primaires sont numérotées de 1 à 4Par exemple :+  * Tester les composants et les circuits, 
 +  * Faire appel au BIOS de la carte graphique pour initialiser le système d'affichage, 
 +  * Détecter les périphériques de stockage, 
 +  * Lancer le **Charger de Démarrage** du système d'exploitation en utilisant le **bootstrap loader**.
  
-  * **hda1**, **hda2**, **hda3** et **hda4** pour le premier disque **IDE** sur le premier contrôleur de disque, +===Chargeur de Démarrage===
-  * **sda1**, **sda2**, **sda3** et **sda4** pour le premier disque **SCSI** ou **SATA** sur le premier contrôleur de disque. +
  
-{{free:disque.png|}}+La première partie du Chargeur de Démarrage est en règle générale placé dans le MBR du disque. Le format du MBR est le suivant :
  
-Une partition étendue prend la place d'une partition primaire et les lecteurs logiques qui s'y trouvent commencent à partir de **hda5** ou de **sda5**.+  * 446 octets pour le Charger de Démarrage, 
 +  * 64 octets pour la table de partitions, soit 16 octets par partition décrite, 
 +  2 octets ayant une valeur fixe en hexadécimale de **AA55**.
  
-Pour clarifier ceci, considérons un disque **SATA** contenant deux partitions primaires, une seule partition étendue et 3 lecteurs logiques. Dans ce cas, les deux premières partitions sont **sda1** et **sda2**, la partition étendue prend la place de la troisième partition primaire, la **sda3** et s'appelle ainsi tandis que la quatrième partition primaire est inexistante. +====Systèmes à base de l'EFI====
  
-Les lecteurs logiques commençant à **sda5**, nous obtenons la liste de partitions suivante : sda1, sda2, sda5, sda6, sda7. Notez que la sda3 ne peut pas être utilisée en tant que partition car elle est cachée par les lecteurs sda5, sda6 et sda7.+Depuis 2011, le BIOS est en train d'être remplacé par l'utilisation de l'**[[http://fr.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface|UEFI]]** (**U**nified **E**xtensible **F**irmware **I**nterface ou //Interface micrologicielle extensible unifiée//) issue du développement de l'EFI conçue par Intel pour les processeurs Itanium.
  
-{{free:disques1.png|}}+Sous EFI la première partie du gestionnaire de démarrage est un fichier ayant une extension .efi se trouvant dans un sous-répertoire au nom du système d'exploitation à lancer dans une partition appelée **EFI System Partition** ou **ESP**. Cette partition est normalement montée à **/boot/efi** sous Linux.
  
-Le nombre de partitions sur un disque est limité :+Pour que EFI fonctionne, le micrologiciel (**firmware**) d'EFI doit avoir connaissance de chaque système d'exploitation à démarrer.
  
-  * **IDE**, +<WRAP center round tip 60%> 
-    * Jusqu'à **63**, +**A retenir** : Sous Linux c'est l'application **efibootmgr** qui permet de créer et de supprimer des entrées ainsi que de modifier l'ordre de démarrage.
-  * **SCSI**, +
-    * Jusqu'à **15**, +
-  * **Disques utilisant l'API libata**, +
-    * Jusqu'à **15**. +
- +
-<WRAP center round important 60%> +
-**Important** : Ces limites peuvent être dépassées en utilisant la gestion **LVM** (//Logical Volume Management//).+
 </WRAP> </WRAP>
- 
-=====Partitionnement===== 
- 
-====LAB #1 - Partitionnement de votre Disque sous RHEL/CentOS 8 avec fdisk==== 
- 
-Pour procéder au partitionnement de votre disque ou de vos disques, RHEL/CentOS 8 possède l'outil dénommé **fdisk**. 
- 
-Lancez fdisk en fournissant en argument le fichier de référence de votre premier disque dur, par exemple : 
- 
-<code> 
-[root@centos8 ~]# fdisk /dev/sdb 
- 
-Welcome to fdisk (util-linux 2.32.1). 
-Changes will remain in memory only, until you decide to write them. 
-Be careful before using the write command. 
- 
-Device does not contain a recognized partition table. 
-Created a new DOS disklabel with disk identifier 0xb0dacb39. 
- 
-Command (m for help):  
-</code> 
- 
-Tapez ensuite la lettre **m** puis <key>Entrée</key> pour obtenir le menu : 
- 
-<code> 
-Command (m for help): m 
- 
-Help: 
- 
-  DOS (MBR) 
-     toggle a bootable flag 
-     edit nested BSD disklabel 
-     toggle the dos compatibility flag 
- 
-  Generic 
-     delete a partition 
-     list free unpartitioned space 
-     list known partition types 
-     add a new partition 
-     print the partition table 
-     change a partition type 
-     verify the partition table 
-     print information about a partition 
- 
-  Misc 
-     print this menu 
-     change display/entry units 
-     extra functionality (experts only) 
- 
-  Script 
-     load disk layout from sfdisk script file 
-     dump disk layout to sfdisk script file 
- 
-  Save & Exit 
-     write table to disk and exit 
-     quit without saving changes 
- 
-  Create a new label 
-     create a new empty GPT partition table 
-     create a new empty SGI (IRIX) partition table 
-     create a new empty DOS partition table 
-     create a new empty Sun partition table 
- 
- 
-Command (m for help): 
-</code> 
- 
-Pour créer une nouvelle partition, vous devez utiliser la commande **n**. 
- 
-Créez donc les partitions suivantes sur votre disque : 
- 
-^ Partition ^ Type ^ Taille de la Partition ^ 
-| /dev/sdb1 | Primaire |  100 Mo  | 
-| /dev/sdb2 | Primaire |  100 Mo  | 
-| /dev/sdb3 | Primaire |  100 Mo  | 
-| /dev/sdb4 | Extended | Du premier secteur disponible au dernier secteur du disque | 
-| /dev/sdb5 | Logique |  500 Mo  | 
-| /dev/sdb6 | Logique |  200 Mo  | 
-| /dev/sdb7 | Logique |  300 Mo  | 
-| /dev/sda8 | Logique |  500 Mo  | 
-| /dev/sdb9 | Logique |  400 Mo  | 
-| /dev/sdb10 | Logique |  500 Mo  | 
-| /dev/sdb11 | Logique |  500 Mo  | 
-| /dev/sdb12 | Logique |  200 Mo  | 
- 
-Créez d'abord les partitions primaires : 
- 
-<code> 
-Command (m for help): n 
-Partition type 
-     primary (0 primary, 0 extended, 4 free) 
-     extended (container for logical partitions) 
-Select (default p):  
- 
-Using default response p. 
-Partition number (1-4, default 1):  
-First sector (2048-8388607, default 2048):  
-Last sector, +sectors or +size{K,M,G,T,P} (2048-8388607, default 8388607): +100M 
- 
-Created a new partition 1 of type 'Linux' and of size 100 MiB. 
- 
-Command (m for help): n 
-Partition type 
-     primary (1 primary, 0 extended, 3 free) 
-     extended (container for logical partitions) 
-Select (default p):  
- 
-Using default response p. 
-Partition number (2-4, default 2):  
-First sector (206848-8388607, default 206848):  
-Last sector, +sectors or +size{K,M,G,T,P} (206848-8388607, default 8388607): +100M             
- 
-Created a new partition 2 of type 'Linux' and of size 100 MiB. 
- 
-Command (m for help): n 
-Partition type 
-     primary (2 primary, 0 extended, 2 free) 
-     extended (container for logical partitions) 
-Select (default p):  
- 
-Using default response p. 
-Partition number (3,4, default 3):  
-First sector (411648-8388607, default 411648):  
-Last sector, +sectors or +size{K,M,G,T,P} (411648-8388607, default 8388607): +100M 
- 
-Created a new partition 3 of type 'Linux' and of size 100 MiB. 
- 
-Command (m for help):  
-</code> 
- 
-Créez ensuite la partition étendue : 
- 
-<code> 
-Command (m for help): n 
-Partition type 
-     primary (3 primary, 0 extended, 1 free) 
-     extended (container for logical partitions) 
-Select (default e): e 
- 
-Selected partition 4 
-First sector (616448-8388607, default 616448):  
-Last sector, +sectors or +size{K,M,G,T,P} (616448-8388607, default 8388607):  
- 
-Created a new partition 4 of type 'Extended' and of size 3.7 GiB. 
- 
-Command (m for help):   
-</code> 
- 
-Créez maintenant les autres partitions l'une après l'autre : 
- 
-<code> 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 5 
-First sector (618496-8388607, default 618496):  
-Last sector, +sectors or +size{K,M,G,T,P} (618496-8388607, default 8388607): +500M 
- 
-Created a new partition 5 of type 'Linux' and of size 500 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 6 
-First sector (1644544-8388607, default 1644544):  
-Last sector, +sectors or +size{K,M,G,T,P} (1644544-8388607, default 8388607): +200M 
- 
-Created a new partition 6 of type 'Linux' and of size 200 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 7 
-First sector (2056192-8388607, default 2056192):  
-Last sector, +sectors or +size{K,M,G,T,P} (2056192-8388607, default 8388607): +300M 
- 
-Created a new partition 7 of type 'Linux' and of size 300 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 8 
-First sector (2672640-8388607, default 2672640):  
-Last sector, +sectors or +size{K,M,G,T,P} (2672640-8388607, default 8388607): +500M 
- 
-Created a new partition 8 of type 'Linux' and of size 500 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 9 
-First sector (3698688-8388607, default 3698688):  
-Last sector, +sectors or +size{K,M,G,T,P} (3698688-8388607, default 8388607): +400M 
- 
-Created a new partition 9 of type 'Linux' and of size 400 MiB. 
- 
- Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 10 
-First sector (4519936-8388607, default 4519936):  
-Last sector, +sectors or +size{K,M,G,T,P} (4519936-8388607, default 8388607): +500M 
- 
-Created a new partition 10 of type 'Linux' and of size 500 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 11 
-First sector (5545984-8388607, default 5545984):  
-Last sector, +sectors or +size{K,M,G,T,P} (5545984-8388607, default 8388607): +500M 
- 
-Created a new partition 11 of type 'Linux' and of size 500 MiB. 
- 
-Command (m for help): n 
-All primary partitions are in use. 
-Adding logical partition 12 
-First sector (6572032-8388607, default 6572032):  
-Last sector, +sectors or +size{K,M,G,T,P} (6572032-8388607, default 8388607): +200M 
- 
-Created a new partition 12 of type 'Linux' and of size 200 MiB. 
- 
-Command (m for help):  
-</code> 
- 
-Tapez ensuite la lettre **p** puis <key>Entrée</key> pour visualiser la nouvelle table des partitions. Vous obtiendrez un résultat similaire à celui-ci : 
- 
-<code> 
-Command (m for help): p 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors 
-Units: sectors of 1 * 512 = 512 bytes 
-Sector size (logical/physical): 512 bytes / 512 bytes 
-I/O size (minimum/optimal): 512 bytes / 512 bytes 
-Disklabel type: dos 
-Disk identifier: 0xb0dacb39 
- 
-Device     Boot   Start     End Sectors  Size Id Type 
-/dev/sdb1          2048  206847  204800  100M 83 Linux 
-/dev/sdb2        206848  411647  204800  100M 83 Linux 
-/dev/sdb3        411648  616447  204800  100M 83 Linux 
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended 
-/dev/sdb5        618496 1642495 1024000  500M 83 Linux 
-/dev/sdb6       1644544 2054143  409600  200M 83 Linux 
-/dev/sdb7       2056192 2670591  614400  300M 83 Linux 
-/dev/sdb8       2672640 3696639 1024000  500M 83 Linux 
-/dev/sdb9       3698688 4517887  819200  400M 83 Linux 
-/dev/sdb10      4519936 5543935 1024000  500M 83 Linux 
-/dev/sdb11      5545984 6569983 1024000  500M 83 Linux 
-/dev/sdb12      6572032 6981631  409600  200M 83 Linux 
- 
-Command (m for help):  
-</code> 
- 
-Ecrivez la table des partitions sur disque et exécutez la commande **partprobe** : 
- 
-<code> 
-Command (m for help): w 
-The partition table has been altered. 
-Calling ioctl() to re-read partition table. 
-Syncing disks. 
- 
-[root@centos8 ~]# partprobe 
-[root@centos8 ~]#  
-</code> 
- 
-Lancez fdisk puis tapez ensuite la lettre **p** puis <key>Entrée</key> pour visualiser la table des partitions actuelle : 
- 
-<code> 
-[root@centos8 ~]# fdisk /dev/sdb 
- 
-Welcome to fdisk (util-linux 2.32.1). 
-Changes will remain in memory only, until you decide to write them. 
-Be careful before using the write command. 
- 
- 
-Command (m for help): p 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors 
-Units: sectors of 1 * 512 = 512 bytes 
-Sector size (logical/physical): 512 bytes / 512 bytes 
-I/O size (minimum/optimal): 512 bytes / 512 bytes 
-Disklabel type: dos 
-Disk identifier: 0xb0dacb39 
- 
-Device     Boot   Start     End Sectors  Size Id Type 
-/dev/sdb1          2048  206847  204800  100M 83 Linux 
-/dev/sdb2        206848  411647  204800  100M 83 Linux 
-/dev/sdb3        411648  616447  204800  100M 83 Linux 
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended 
-/dev/sdb5        618496 1642495 1024000  500M 83 Linux 
-/dev/sdb6       1644544 2054143  409600  200M 83 Linux 
-/dev/sdb7       2056192 2670591  614400  300M 83 Linux 
-/dev/sdb8       2672640 3696639 1024000  500M 83 Linux 
-/dev/sdb9       3698688 4517887  819200  400M 83 Linux 
-/dev/sdb10      4519936 5543935 1024000  500M 83 Linux 
-/dev/sdb11      5545984 6569983 1024000  500M 83 Linux 
-/dev/sdb12      6572032 6981631  409600  200M 83 Linux 
- 
-Command (m for help):  
-</code> 
- 
-Pour supprimer une partition, utilisez la commande **d** puis <key>Entrée</key>. fdisk vous demandera le numéro de la partition à supprimer, par exemple : 
- 
-<code> 
-Command (m for help): d 
-Partition number (1-12, default 12): 12 
- 
-Partition 12 has been deleted. 
- 
-Command (m for help): p 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors 
-Units: sectors of 1 * 512 = 512 bytes 
-Sector size (logical/physical): 512 bytes / 512 bytes 
-I/O size (minimum/optimal): 512 bytes / 512 bytes 
-Disklabel type: dos 
-Disk identifier: 0xb0dacb39 
- 
-Device     Boot   Start     End Sectors  Size Id Type 
-/dev/sdb1          2048  206847  204800  100M 83 Linux 
-/dev/sdb2        206848  411647  204800  100M 83 Linux 
-/dev/sdb3        411648  616447  204800  100M 83 Linux 
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended 
-/dev/sdb5        618496 1642495 1024000  500M 83 Linux 
-/dev/sdb6       1644544 2054143  409600  200M 83 Linux 
-/dev/sdb7       2056192 2670591  614400  300M 83 Linux 
-/dev/sdb8       2672640 3696639 1024000  500M 83 Linux 
-/dev/sdb9       3698688 4517887  819200  400M 83 Linux 
-/dev/sdb10      4519936 5543935 1024000  500M 83 Linux 
-/dev/sdb11      5545984 6569983 1024000  500M 83 Linux 
- 
-Command (m for help):  
-</code> 
- 
-A ce stade, la partition n'a **pas** été réellement supprimée. En effet, vous avez la possibilité de sortir de fdisk en utilisant la commande **q**.  
- 
-Tapez donc q pour sortir de fdisk puis relancez fdisk. Vous obtiendrez un résultat similaire à celui-ci : 
- 
-<code> 
-Command (m for help): q 
- 
-[root@centos8 ~]# fdisk /dev/sdb 
- 
-Welcome to fdisk (util-linux 2.32.1). 
-Changes will remain in memory only, until you decide to write them. 
-Be careful before using the write command. 
- 
- 
-Command (m for help): p 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors 
-Units: sectors of 1 * 512 = 512 bytes 
-Sector size (logical/physical): 512 bytes / 512 bytes 
-I/O size (minimum/optimal): 512 bytes / 512 bytes 
-Disklabel type: dos 
-Disk identifier: 0xb0dacb39 
- 
-Device     Boot   Start     End Sectors  Size Id Type 
-/dev/sdb1          2048  206847  204800  100M 83 Linux 
-/dev/sdb2        206848  411647  204800  100M 83 Linux 
-/dev/sdb3        411648  616447  204800  100M 83 Linux 
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended 
-/dev/sdb5        618496 1642495 1024000  500M 83 Linux 
-/dev/sdb6       1644544 2054143  409600  200M 83 Linux 
-/dev/sdb7       2056192 2670591  614400  300M 83 Linux 
-/dev/sdb8       2672640 3696639 1024000  500M 83 Linux 
-/dev/sdb9       3698688 4517887  819200  400M 83 Linux 
-/dev/sdb10      4519936 5543935 1024000  500M 83 Linux 
-/dev/sdb11      5545984 6569983 1024000  500M 83 Linux 
-/dev/sdb12      6572032 6981631  409600  200M 83 Linux 
- 
-Command (m for help):   
-</code> 
- 
-====LAB #2 - Modifier les Drapeaux des Partitions avec fdisk==== 
- 
-Afin de mettre en place un RAID logiciel ou un volume logique, il est nécessaire de modifier les types de systèmes de fichiers sur les partitions créées. 
- 
-Modifiez donc les nouvelles partitions à l'aide de la commande **t** de **fdisk** selon le tableau ci-dessous : 
- 
-^ Taille de la Partition ^ Type de Système de Fichiers ^ 
-| 500 Mo | RAID (fd) | 
-| 200 Mo | Linux LVM (8e) | 
-| 300 Mo | Linux LVM (8e) | 
-| 500 Mo | RAID (fd) | 
-| 400 Mo | Linux LVM (8e) | 
-| 500 Mo | RAID (fd) | 
-| 500 Mo | RAID (fd) | 
-| 200 Mo | Inchangé | 
- 
-Vous obtiendrez un résultat similaire à celui-ci : 
- 
-<code> 
-Command (m for help): t 
-Partition number (1-12, default 12): 5 
-Hex code (type L to list all codes): fd 
- 
-Changed type of partition 'Linux' to 'Linux raid autodetect'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 6 
-Hex code (type L to list all codes): 8e 
- 
-Changed type of partition 'Linux' to 'Linux LVM'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 7 
-Hex code (type L to list all codes): 8e 
- 
-Changed type of partition 'Linux' to 'Linux LVM'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 8 
-Hex code (type L to list all codes): fd 
- 
-Changed type of partition 'Linux' to 'Linux raid autodetect'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 9 
-Hex code (type L to list all codes): 8e 
- 
-Changed type of partition 'Linux' to 'Linux LVM'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 10 
-Hex code (type L to list all codes): fd 
- 
-Changed type of partition 'Linux' to 'Linux raid autodetect'. 
- 
-Command (m for help): t 
-Partition number (1-12, default 12): 11 
-Hex code (type L to list all codes): fd 
- 
-Changed type of partition 'Linux' to 'Linux raid autodetect'. 
-</code> 
- 
-A l'issu des modifications, vous obtiendrez un résultat similaire à celui-ci : 
- 
-<code> 
-Command (m for help): p 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors 
-Units: sectors of 1 * 512 = 512 bytes 
-Sector size (logical/physical): 512 bytes / 512 bytes 
-I/O size (minimum/optimal): 512 bytes / 512 bytes 
-Disklabel type: dos 
-Disk identifier: 0xb0dacb39 
- 
-Device     Boot   Start     End Sectors  Size Id Type 
-/dev/sdb1          2048  206847  204800  100M 83 Linux 
-/dev/sdb2        206848  411647  204800  100M 83 Linux 
-/dev/sdb3        411648  616447  204800  100M 83 Linux 
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended 
-/dev/sdb5        618496 1642495 1024000  500M fd Linux raid autodetect 
-/dev/sdb6       1644544 2054143  409600  200M 8e Linux LVM 
-/dev/sdb7       2056192 2670591  614400  300M 8e Linux LVM 
-/dev/sdb8       2672640 3696639 1024000  500M fd Linux raid autodetect 
-/dev/sdb9       3698688 4517887  819200  400M 8e Linux LVM 
-/dev/sdb10      4519936 5543935 1024000  500M fd Linux raid autodetect 
-/dev/sdb11      5545984 6569983 1024000  500M fd Linux raid autodetect 
-/dev/sdb12      6572032 6981631  409600  200M 83 Linux 
- 
-Command (m for help):  
-</code> 
- 
-Pour écrire la nouvelle table des partitions sur disque, vous devez utilisez la commande **w** puis la commande **partprobe** : 
- 
-<code> 
-Command (m for help): w 
-The partition table has been altered! 
- 
-Calling ioctl() to re-read partition table. 
- 
-WARNING: Re-reading the partition table failed with error 16: Device or resource busy. 
-The kernel still uses the old table. The new table will be used at 
-the next reboot or after you run partprobe(8) or kpartx(8) 
-Syncing disks. 
-[root@centos8 ~]# partprobe 
-</code> 
- 
-====Options de la Commande fdisk==== 
- 
-Les options de cette commande sont : 
- 
-<code> 
-[root@centos8 ~]# fdisk --help 
- 
-Usage: 
- fdisk [options] <disk>      change partition table 
- fdisk [options] -l [<disk>] list partition table(s) 
- 
-Display or manipulate a disk partition table. 
- 
-Options: 
- -b, --sector-size <size>      physical and logical sector size 
- -B, --protect-boot            don't erase bootbits when creating a new label 
- -c, --compatibility[=<mode> mode is 'dos' or 'nondos' (default) 
- -L, --color[=<when>         colorize output (auto, always or never) 
-                                 colors are enabled by default 
- -l, --list                    display partitions and exit 
- -o, --output <list>           output columns 
- -t, --type <type>             recognize specified partition table type only 
- -u, --units[=<unit>         display units: 'cylinders' or 'sectors' (default) 
- -s, --getsz                   display device size in 512-byte sectors [DEPRECATED] 
-     --bytes                   print SIZE in bytes rather than in human readable format 
- -w, --wipe <mode>             wipe signatures (auto, always or never) 
- -W, --wipe-partitions <mode>  wipe signatures from new partitions (auto, always or never) 
- 
- -C, --cylinders <number>      specify the number of cylinders 
- -H, --heads <number>          specify the number of heads 
- -S, --sectors <number>        specify the number of sectors per track 
- 
- -h, --help                    display this help 
- -V, --version                 display version 
- 
-Available output columns: 
- gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID 
- dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S Start-C/H/S 
- bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize 
- sgi: Device Start End Sectors Cylinders Size Type Id Attrs 
- sun: Device Start End Sectors Cylinders Size Type Id Flags 
- 
-For more details see fdisk(8). 
-</code> 
- 
-=====Logical Volume Manager (LVM)===== 
- 
-====LAB #3 - Volumes Logiques Linéaires==== 
- 
-Afin de mettre en place le LVM, vous avez besoin du paquet **lvm2** et du paquet **device-mapper**.  
- 
-Nous allons travailler sous RHEL/CentOS 8 avec les partitions suivantes : 
- 
-<code> 
-/dev/sdb6       1644544 2054143  409600  200M 8e Linux LVM 
-/dev/sdb7       2056192 2670591  614400  300M 8e Linux LVM 
-/dev/sdb9       3698688 4517887  819200  400M 8e Linux LVM 
-</code> 
- 
-Pour initialiser le LVM saississez la commande suivante : 
- 
-<code> 
-[root@centos8 ~]# vgscan 
-  Found volume group "cl_centos8" using metadata type lvm2 
-</code> 
- 
-Les options de la commande **vgscan** sont : 
- 
-<code> 
-[root@centos8 ~]# vgscan --longhelp 
-  vgscan - Search for all volume groups 
- 
-  vgscan 
- [    --ignorelockingfailure ] 
- [    --mknodes ] 
- [    --notifydbus ] 
- [    --reportformat basic|json ] 
- [ COMMON_OPTIONS ] 
- 
-  Common options for lvm: 
- [ -d|--debug ] 
- [ -h|--help ] 
- [ -q|--quiet ] 
- [ -v|--verbose ] 
- [ -y|--yes ] 
- [ -t|--test ] 
- [    --commandprofile String ] 
- [    --config String ] 
- [    --driverloaded y|n ] 
- [    --nolocking ] 
- [    --lockopt String ] 
- [    --longhelp ] 
- [    --profile String ] 
- [    --version ] 
- 
-  Common variables for lvm: 
-        Variables in option or position args are capitalized, 
-        e.g. PV, VG, LV, Size, Number, String, Tag. 
- 
-        PV 
-        Physical Volume name, a device path under /dev. 
-        For commands managing physical extents, a PV positional arg 
-        generally accepts a suffix indicating a range (or multiple ranges) 
-        of PEs. When the first PE is omitted, it defaults to the start of 
-        the device, and when the last PE is omitted it defaults to the end. 
-        PV[:PE-PE]... is start and end range (inclusive), 
-        PV[:PE+PE]... is start and length range (counting from 0). 
- 
-        LV 
-        Logical Volume name. See lvm(8) for valid names. An LV positional 
-        arg generally includes the VG name and LV name, e.g. VG/LV. 
-        LV followed by _<type> indicates that an LV of the given type is 
-        required. (raid represents raid<N> type). 
-        The _new suffix indicates that the LV name is new. 
- 
-        Tag 
-        Tag name. See lvm(8) for information about tag names and using 
-        tags in place of a VG, LV or PV. 
- 
-        Select 
-        Select indicates that a required positional arg can be omitted 
-        if the --select option is used. No arg appears in this position. 
- 
-        Size[UNIT] 
-        Size is an input number that accepts an optional unit. 
-        Input units are always treated as base two values, regardless of 
-        capitalization, e.g. 'k' and 'K' both refer to 1024. 
-        The default input unit is specified by letter, followed by |UNIT. 
-        UNIT represents other possible input units: BbBsSkKmMgGtTpPeE. 
-        (This should not be confused with the output control --units, where 
-        capital letters mean multiple of 1000.) 
-</code> 
- 
-===Physical Volume (PV)=== 
- 
-Pour créer le **PV** il convient d'utiliser la commande **pvcreate** : 
- 
-<code> 
-[root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 
-  Physical volume "/dev/sdb6" successfully created. 
-  Physical volume "/dev/sdb7" successfully created. 
-  Physical volume "/dev/sdb9" successfully created. 
-</code> 
- 
-Les options de la commande **pvcreate** sont : 
- 
-<code> 
-[root@centos8 ~]# pvcreate --longhelp 
-  pvcreate - Initialize physical volume(s) for use by LVM 
- 
-  pvcreate PV ... 
- [ -f|--force ] 
- [ -M|--metadatatype lvm2 ] 
- [ -u|--uuid String ] 
- [ -Z|--zero y|n ] 
- [    --dataalignment Size[k|UNIT] ] 
- [    --dataalignmentoffset Size[k|UNIT] ] 
- [    --bootloaderareasize Size[m|UNIT] ] 
- [    --labelsector Number ] 
- [    --pvmetadatacopies 0|1|2 ] 
- [    --metadatasize Size[m|UNIT] ] 
- [    --metadataignore y|n ] 
- [    --norestorefile ] 
- [    --setphysicalvolumesize Size[m|UNIT] ] 
- [    --reportformat basic|json ] 
- [    --restorefile String ] 
- [ COMMON_OPTIONS ] 
- 
-  Common options for lvm: 
- [ -d|--debug ] 
- [ -h|--help ] 
- [ -q|--quiet ] 
- [ -v|--verbose ] 
- [ -y|--yes ] 
- [ -t|--test ] 
- [    --commandprofile String ] 
- [    --config String ] 
- [    --driverloaded y|n ] 
- [    --nolocking ] 
- [    --lockopt String ] 
- [    --longhelp ] 
- [    --profile String ] 
- [    --version ] 
- 
-  Common variables for lvm: 
-        Variables in option or position args are capitalized, 
-        e.g. PV, VG, LV, Size, Number, String, Tag. 
- 
-        PV 
-        Physical Volume name, a device path under /dev. 
-        For commands managing physical extents, a PV positional arg 
-        generally accepts a suffix indicating a range (or multiple ranges) 
-        of PEs. When the first PE is omitted, it defaults to the start of 
-        the device, and when the last PE is omitted it defaults to the end. 
-        PV[:PE-PE]... is start and end range (inclusive), 
-        PV[:PE+PE]... is start and length range (counting from 0). 
- 
-        LV 
-        Logical Volume name. See lvm(8) for valid names. An LV positional 
-        arg generally includes the VG name and LV name, e.g. VG/LV. 
-        LV followed by _<type> indicates that an LV of the given type is 
-        required. (raid represents raid<N> type). 
-        The _new suffix indicates that the LV name is new. 
- 
-        Tag 
-        Tag name. See lvm(8) for information about tag names and using 
-        tags in place of a VG, LV or PV. 
- 
-        Select 
-        Select indicates that a required positional arg can be omitted 
-        if the --select option is used. No arg appears in this position. 
- 
-        Size[UNIT] 
-        Size is an input number that accepts an optional unit. 
-        Input units are always treated as base two values, regardless of 
-        capitalization, e.g. 'k' and 'K' both refer to 1024. 
-        The default input unit is specified by letter, followed by |UNIT. 
-        UNIT represents other possible input units: BbBsSkKmMgGtTpPeE. 
-        (This should not be confused with the output control --units, where 
-        capital letters mean multiple of 1000.) 
-</code> 
- 
-Pour visualiser le PV il convient d'utiliser la commande **pvdisplay** : 
- 
-<code> 
-[root@centos8 ~]# pvdisplay /dev/sdb6 /dev/sdb7 /dev/sdb9 
-  "/dev/sdb6" is a new physical volume of "200.00 MiB" 
-  --- NEW Physical volume --- 
-  PV Name               /dev/sdb6 
-  VG Name                
-  PV Size               200.00 MiB 
-  Allocatable           NO 
-  PE Size                  
-  Total PE              0 
-  Free PE               0 
-  Allocated PE          0 
-  PV UUID               xsAjLA-sUEU-dexm-H7G1-Dsi4-q6qW-8Tqkay 
-    
-  "/dev/sdb7" is a new physical volume of "300.00 MiB" 
-  --- NEW Physical volume --- 
-  PV Name               /dev/sdb7 
-  VG Name                
-  PV Size               300.00 MiB 
-  Allocatable           NO 
-  PE Size                  
-  Total PE              0 
-  Free PE               0 
-  Allocated PE          0 
-  PV UUID               WpssK3-sThn-3nS0-80O3-NcW3-23e0-gxejn4 
-    
-  "/dev/sdb9" is a new physical volume of "400.00 MiB" 
-  --- NEW Physical volume --- 
-  PV Name               /dev/sdb9 
-  VG Name                
-  PV Size               400.00 MiB 
-  Allocatable           NO 
-  PE Size                  
-  Total PE              0 
-  Free PE               0 
-  Allocated PE          0 
-  PV UUID               rqaB99-3UdD-pJxE-Z1Eo-h9yv-tZ41-r4UJSY 
-</code> 
- 
-Les options de la commande **pvdisplay** sont : 
- 
-<code> 
-[root@centos8 ~]# pvdisplay --longhelp 
-  pvdisplay - Display various attributes of physical volume(s) 
- 
-  pvdisplay 
- [ -a|--all ] 
- [ -c|--colon ] 
- [ -C|--columns ] 
- [ -m|--maps ] 
- [ -o|--options String ] 
- [ -S|--select String ] 
- [ -s|--short ] 
- [ -O|--sort String ] 
- [    --aligned ] 
- [    --binary ] 
- [    --configreport log|vg|lv|pv|pvseg|seg ] 
- [    --foreign ] 
- [    --ignorelockingfailure ] 
- [    --logonly ] 
- [    --noheadings ] 
- [    --nosuffix ] 
- [    --readonly ] 
- [    --reportformat basic|json ] 
- [    --separator String ] 
- [    --shared ] 
- [    --unbuffered ] 
- [    --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] 
- [ COMMON_OPTIONS ] 
- [ PV|Tag ... ] 
- 
-  Common options for lvm: 
- [ -d|--debug ] 
- [ -h|--help ] 
- [ -q|--quiet ] 
- [ -v|--verbose ] 
- [ -y|--yes ] 
- [ -t|--test ] 
- [    --commandprofile String ] 
- [    --config String ] 
- [    --driverloaded y|n ] 
- [    --nolocking ] 
- [    --lockopt String ] 
- [    --longhelp ] 
- [    --profile String ] 
- [    --version ] 
- 
-  Common variables for lvm: 
-        Variables in option or position args are capitalized, 
-        e.g. PV, VG, LV, Size, Number, String, Tag. 
- 
-        PV 
-        Physical Volume name, a device path under /dev. 
-        For commands managing physical extents, a PV positional arg 
-        generally accepts a suffix indicating a range (or multiple ranges) 
-        of PEs. When the first PE is omitted, it defaults to the start of 
-        the device, and when the last PE is omitted it defaults to the end. 
-        PV[:PE-PE]... is start and end range (inclusive), 
-        PV[:PE+PE]... is start and length range (counting from 0). 
- 
-        LV 
-        Logical Volume name. See lvm(8) for valid names. An LV positional 
-        arg generally includes the VG name and LV name, e.g. VG/LV. 
-        LV followed by _<type> indicates that an LV of the given type is 
-        required. (raid represents raid<N> type). 
-        The _new suffix indicates that the LV name is new. 
- 
-        Tag 
-        Tag name. See lvm(8) for information about tag names and using 
-        tags in place of a VG, LV or PV. 
- 
-        Select 
-        Select indicates that a required positional arg can be omitted 
-        if the --select option is used. No arg appears in this position. 
- 
-        Size[UNIT] 
-        Size is an input number that accepts an optional unit. 
-        Input units are always treated as base two values, regardless of 
-        capitalization, e.g. 'k' and 'K' both refer to 1024. 
-        The default input unit is specified by letter, followed by |UNIT. 
-        UNIT represents other possible input units: BbBsSkKmMgGtTpPeE. 
-        (This should not be confused with the output control --units, where 
-        capital letters mean multiple of 1000.) 
-</code> 
- 
-===Volume Group (VG) et Physical Extent (PE)=== 
- 
-Pour créer un Volume Group dénommé **vg0**, il convient d'utiliser la commande **vgcreate** : 
- 
-<code> 
-[root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 
-  Volume group "vg0" successfully created 
-</code> 
- 
-Les options de la commande **vgcreate** sont : 
- 
-<code> 
-[root@centos8 ~]# vgcreate --help 
-  vgcreate - Create a volume group 
- 
-  vgcreate VG_new PV ... 
- [ -A|--autobackup y|n ] 
- [ -c|--clustered y|n ] 
- [ -l|--maxlogicalvolumes Number ] 
- [ -p|--maxphysicalvolumes Number ] 
- [ -M|--metadatatype lvm2 ] 
- [ -s|--physicalextentsize Size[m|UNIT] ] 
- [ -f|--force ] 
- [ -Z|--zero y|n ] 
- [    --addtag Tag ] 
- [    --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] 
- [    --metadataprofile String ] 
- [    --labelsector Number ] 
- [    --metadatasize Size[m|UNIT] ] 
- [    --pvmetadatacopies 0|1|2 ] 
- [    --vgmetadatacopies all|unmanaged|Number ] 
- [    --reportformat basic|json ] 
- [    --dataalignment Size[k|UNIT] ] 
- [    --dataalignmentoffset Size[k|UNIT] ] 
- [    --shared ] 
- [    --systemid String ] 
- [    --locktype sanlock|dlm|none ] 
- [ COMMON_OPTIONS ] 
- 
-  Common options for lvm: 
- [ -d|--debug ] 
- [ -h|--help ] 
- [ -q|--quiet ] 
- [ -v|--verbose ] 
- [ -y|--yes ] 
- [ -t|--test ] 
- [    --commandprofile String ] 
- [    --config String ] 
- [    --driverloaded y|n ] 
- [    --nolocking ] 
- [    --lockopt String ] 
- [    --longhelp ] 
- [    --profile String ] 
- [    --version ] 
- 
-  Use --longhelp to show all options and advanced commands. 
-</code> 
- 
-Pour afficher les informations concernant **vg0**, il convient d'utiliser la commande **vgdisplay** : 
- 
-<code> 
-[root@centos8 ~]# vgdisplay vg0 
-  --- Volume group --- 
-  VG Name               vg0 
-  System ID              
-  Format                lvm2 
-  Metadata Areas        3 
-  Metadata Sequence No  1 
-  VG Access             read/write 
-  VG Status             resizable 
-  MAX LV                0 
-  Cur LV                0 
-  Open LV               0 
-  Max PV                0 
-  Cur PV                3 
-  Act PV                3 
-  VG Size               880.00 MiB 
-  PE Size               8.00 MiB 
-  Total PE              110 
-  Alloc PE / Size       0 / 0    
-  Free  PE / Size       110 / 880.00 MiB 
-  VG UUID               6cO8IX-xhvn-5J4z-Em2t-7RAq-u3y8-1cVZln 
-</code> 
- 
-Les options de la commande **vgdisplay** sont : 
- 
-<code> 
-[root@centos8 ~]# vgdisplay --help 
-  vgdisplay - Display volume group information 
- 
-  vgdisplay 
- [ -A|--activevolumegroups ] 
- [ -c|--colon ] 
- [ -C|--columns ] 
- [ -o|--options String ] 
- [ -S|--select String ] 
- [ -s|--short ] 
- [ -O|--sort String ] 
- [    --aligned ] 
- [    --binary ] 
- [    --configreport log|vg|lv|pv|pvseg|seg ] 
- [    --foreign ] 
- [    --ignorelockingfailure ] 
- [    --logonly ] 
- [    --noheadings ] 
- [    --nosuffix ] 
- [    --readonly ] 
- [    --reportformat basic|json ] 
- [    --shared ] 
- [    --separator String ] 
- [    --unbuffered ] 
- [    --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] 
- [ COMMON_OPTIONS ] 
- [ VG|Tag ... ] 
- 
-  Common options for lvm: 
- [ -d|--debug ] 
- [ -h|--help ] 
- [ -q|--quiet ] 
- [ -v|--verbose ] 
- [ -y|--yes ] 
- [ -t|--test ] 
- [    --commandprofile String ] 
- [    --config String ] 
- [    --driverloaded y|n ] 
- [    --nolocking ] 
- [    --lockopt String ] 
- [    --longhelp ] 
- [    --profile String ] 
- [    --version ] 
- 
-  Use --longhelp to show all options and advanced commands. 
-</code> 
- 
-===Logical Volumes (LV)=== 
- 
-Pour créer un **Logical Volume** dénommé **lv0** dans le **Volume Group** **vg0**, il convient d'utiliser la commande **lvcreate** : 
- 
-<code> 
-[root@centos8 ~]# lvcreate -L 350 -n lv0 vg0 
-  Rounding up size to full physical extent 352.00 MiB 
-  Logical volume "lv0" created. 
-</code> 
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** -Notez que la taille du LV est un multiple du PE.+**Important** : L'UEFI gère les **SSD** (//Solid State Drives//) qui utilisent le standard **NVMe** (//Non-Volatile Memory Express//). Linux supporte les SSD depuis le noyau 3.3.
 </WRAP> </WRAP>
  
-Les options de la commande **lvcreate** sont :+====Autres Systèmes====
  
-<code> +Les systèmes utilisant des processeurs autre qu'un x86 ou x86-64 utilisent un logiciel tel **[[http://fr.wikipedia.org/wiki/Open_Firmware|OpenFirmware]]**.
-[root@centos8 ~]# lvcreate --help +
-  lvcreate - Create a logical volume+
  
-  Create a linear LV. +=====Gestionnaires de Démarrage=====
-  lvcreate -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [    --type linear ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a striped LV (infers --type striped). +====GRUB 2====
-  lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a raid1 or mirror LV (infers --type raid1|mirror). +GRUB 2 est une ré-écriture complète de GRUB LegacyIl apporte des améliorations, notamment GRUB 2 sait utiliser des partitions RAID et LVM.
-  lvcreate -m|--mirrors Number -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [    --mirrorlog core|disk ] +
- [    --minrecoveryrate Size[k|UNIT] ] +
- [    --maxrecoveryrate Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a raid LV (a specific raid level must be used, e.g. raid1). +Le lancement de GRUB 2 se fait en trois étapes :
-  lvcreate --type raid -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -m|--mirrors Number ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [    --minrecoveryrate Size[k|UNIT] ] +
- [    --maxrecoveryrate Size[k|UNIT] ] +
- [    --raidintegrity y|n ] +
- [    --raidintegritymode String ] +
- [    --raidintegrityblocksize Number ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a raid10 LV. +  * Etape 1 : Le **boot.img**, stocké dans les 512 premiers octets du secteur 0 avec la table des partitions, est lancé. Son seul but est de lancer l'étape 1.5, 
-  lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG +  * Etape 1.5 : Le **core.img**, d'une taille approximative de 25 Ko et stocké dans les secteurs 1 à 62, est lance. Son travail est de charger des pilotes qui supportent de multiples systèmes de fichiers puis de lancer l'étape 2 dans un des systèmes de fichiers, 
- [ -l|--extents Number[PERCENT] ] +  * Etape 2 : Contenu dans le répertoire **/boot/grub2/**, il lance le menu pour que l'utilisateur puisse choisir les système d'exploitation à lancer.
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [    --minrecoveryrate Size[k|UNIT] ] +
- [    --maxrecoveryrate Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a COW snapshot LV of an origin LV. +Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installé, il convient de saisir la commande suivante :
-  lvcreate -s|--snapshot -L|--size Size[m|UNIT] LV +
- [ -l|--extents Number[PERCENT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --type snapshot ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a thin pool. +  # grub2-install /dev/périphérique [Entrée]
-  lvcreate --type thin-pool -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --thinpool LV_new ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --errorwhenfull y|n ] +
- [ COMMON_OPTIONS ] +
- PV ... ]+
  
-  Create a cache pool. +où **périphérique** est le nom du périphérique ou l'étape de GRUB2 doit s'installer dans le MBR
-  lvcreate --type cache-pool -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -H|--cache ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --cachemetadataformat auto|1|2 ] +
- [ COMMON_OPTIONS ] +
- [ PV ..]+
  
-  Create a thin LV in a thin pool (infers --type thin). +**GRUB 2** lit ses entrées de menus à partir du fichier **/boot/grub2/grub.cfg**Pour visualiser ce fichieril convient de saisir la commande suivante :
-  lvcreate -V|--virtualsize Size[m|UNIT] --thinpool LV_thinpool VG +
- [ -T|--thin ] +
- [    --type thin ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --errorwhenfull y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Create a thin LV that is a snapshot of an existing thin LV  +
-  (infers --type thin). +
-  lvcreate -s|--snapshot LV_thin +
- [    --type thin ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --errorwhenfull y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Create a thin LV that is a snapshot of an external origin LV. +
-  lvcreate --type thin --thinpool LV_thinpool LV +
- [ -T|--thin ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --errorwhenfull y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Create a LV that returns VDO when used. +
-  lvcreate --type vdo -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -V|--virtualsize Size[m|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --vdo ] +
- [    --vdopool LV_new ] +
- [    --compression y|n ] +
- [    --deduplication y|n ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a thin LV, first creating a thin pool for it,  +
-  where the new thin pool is named by the --thinpool arg. +
-  lvcreate --type thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] --thinpool LV_new +
- [ -l|--extents Number[PERCENT] ] +
- [ -T|--thin ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --errorwhenfull y|n ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LV, then attach the specified cachepool  +
-  which converts the new LV to type cache. +
-  lvcreate --type cache -L|--size Size[m|UNIT] --cachepool LV_cachepool VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -H|--cache ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --cachemetadataformat auto|1|+
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LVthen attach the specified cachevol  +
-  which converts the new LV to type cache. +
-  lvcreate --type cache -L|--size Size[m|UNIT] --cachevol LV VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --cachemetadataformat auto|1|2 ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LV, then attach a cachevol created from  +
-  the specified cache device, which converts the  +
-  new LV to type cache. +
-  lvcreate --type cache -L|--size Size[m|UNIT] --cachedevice PV VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --cachemetadataformat auto|1|2 ] +
- [    --cachesize Size[m|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LV, then attach the specified cachevol  +
-  which converts the new LV to type writecache. +
-  lvcreate --type writecache -L|--size Size[m|UNIT] --cachevol LV VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --cachesettings String ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LV, then attach a cachevol created from  +
-  the specified cache device, which converts the  +
-  new LV to type writecache. +
-  lvcreate --type writecache -L|--size Size[m|UNIT] --cachedevice PV VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --cachesize Size[m|UNIT] ] +
- [    --cachesettings String ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Common options for command: +
- [ -a|--activate y|n|ay ] +
- [ -A|--autobackup y|n ] +
- [ -C|--contiguous y|n ] +
- [ -M|--persistent y|n ] +
- [ -j|--major Number ] +
- [ -k|--setactivationskip y|n ] +
- [ -K|--ignoreactivationskip ] +
- [ -n|--name String ] +
- [ -p|--permission rw|r ] +
- [ -r|--readahead auto|none|Number ] +
- [ -W|--wipesignatures y|n ] +
- [ -Z|--zero y|n ] +
- [    --addtag Tag ] +
- [    --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] +
- [    --ignoremonitoring ] +
- [    --metadataprofile String ] +
- [    --minor Number ] +
- [    --monitor y|n ] +
- [    --nosync ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- +
-  Common options for lvm: +
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ] +
- +
-  Use --longhelp to show all options and advanced commands. +
-</code> +
- +
-Créez maintenant un répertoire dans /mnt pour monter lv0 :+
  
 <code> <code>
-[root@centos8 ~]# mkdir /mnt/lvm +[root@redhat9 ~]# cat /boot/grub2/grub.cfg  
-</code>+
 +# DO NOT EDIT THIS FILE 
 +
 +# It is automatically generated by grub2-mkconfig using templates 
 +# from /etc/grub.d and settings from /etc/default/grub 
 +#
  
-Créez un système de fichiers en **ext3** sur /dev/vg0/lv0 :+### BEGIN /etc/grub.d/00_header ### 
 +set pager=1
  
-<code> +if -f ${config_directory}/grubenv ]; then 
-[root@centos8 ~]# mke2fs -/dev/vg0/lv0 +  load_env -f ${config_directory}/grubenv 
-mke2fs 1.45.6 (20-Mar-2020) +elif [ -s $prefix/grubenv ]; then 
-Creating filesystem with 360448 1k blocks and 90112 inodes +  load_env 
-Filesystem UUID: 87b6d526-d379-4e0c-8984-94811f1cee33 +fi 
-Superblock backups stored on blocks:  +if [ "${next_entry}" ] ; then 
- 8193, 24577, 40961, 57345, 73729, 204801, 221185+   set default="${next_entry}" 
 +   set next_entry= 
 +   save_env next_entry 
 +   set boot_once=true 
 +else 
 +   set default="${saved_entry}" 
 +fi
  
-Allocating group tables: done                             +if [ x"${feature_menuentry_id}" = xy ]; then 
-Writing inode tables: done                             +  menuentry_id_option="--id" 
-Creating journal (8192 blocks): done +else 
-Writing superblocks and filesystem accounting information: done +  menuentry_id_option="" 
-</code>+fi
  
-Montez votre lv0 :+export menuentry_id_option
  
-<code> +if "${prev_saved_entry}" ]; then 
-[root@centos8 ~]# mount -t ext3 /dev/vg0/lv0 /mnt/lvm +  set saved_entry="${prev_saved_entry}" 
-</code>+  save_env saved_entry 
 +  set prev_saved_entry= 
 +  save_env prev_saved_entry 
 +  set boot_once=true 
 +fi
  
-Vous allez maintenant copier le contenu de votre répertoire /home vers /mnt/lvm.+function savedefault { 
 +  if [ -z "${boot_once}" ]; then 
 +    saved_entry="${chosen}" 
 +    save_env saved_entry 
 +  fi 
 +}
  
-Saisissez donc la commande pour copier le contenu de /home :+function load_video { 
 +  if [ x$feature_all_video_module = xy ]; then 
 +    insmod all_video 
 +  else 
 +    insmod efi_gop 
 +    insmod efi_uga 
 +    insmod ieee1275_fb 
 +    insmod vbe 
 +    insmod vga 
 +    insmod video_bochs 
 +    insmod video_cirrus 
 +  fi 
 +}
  
-<code> +terminal_output console 
-[root@centos8 ~]# cp -a /home /mnt/lvm +if x$feature_timeout_style = xy ; then 
-</code>+  set timeout_style=menu 
 +  set timeout=5 
 +Fallback normal timeout code in case the timeout_style feature is 
 +# unavailable. 
 +else 
 +  set timeout=5 
 +fi 
 +### END /etc/grub.d/00_header ###
  
-Constatez ensuite le contenu de /mnt/lvm :+### BEGIN /etc/grub.d/00_tuned ### 
 +set tuned_params="" 
 +set tuned_initrd="" 
 +### END /etc/grub.d/00_tuned ###
  
-<code> +### BEGIN /etc/grub.d/01_users ### 
-[root@centos8 ~]ls -l /mnt/lvm +if [ -f ${prefix}/user.cfg ]; then 
-total 14 +  source ${prefix}/user.cfg 
-drwxr-xr-x5 root root  1024 Apr 20 14:35 home +  if [ -n "${GRUB2_PASSWORD}" ]; then 
-drwx------. 2 root root 12288 May 26 17:00 lost+found +    set superusers="root
-</code>+    export superusers 
 +    password_pbkdf2 root ${GRUB2_PASSWORD} 
 +  fi 
 +fi 
 +### END /etc/grub.d/01_users ###
  
-Une particularité du volume logique est la capacité de d'être aggrandi ou réduit sans pertes de donnéesCommencez par constater la taille totale du volume :+### BEGIN /etc/grub.d/08_fallback_counting ### 
 +insmod increment 
 +# Check if boot_counter exists and boot_success=0 to activate this behaviour. 
 +if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then 
 +  # if countdown has ended, choose to boot rollback deployment, 
 +  # i.e. default=1 on OSTree-based systems. 
 +  if  [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then 
 +    set default=1 
 +    set boot_counter=-1 
 +  # otherwise decrement boot_counter 
 +  else 
 +    decrement boot_counter 
 +  fi 
 +  save_env boot_counter 
 +fi 
 +### END /etc/grub.d/08_fallback_counting ###
  
-<code> +### BEGIN /etc/grub.d/10_linux ### 
-[root@centos8 ~]# df -h /mnt/lvm +insmod part_msdos 
-Filesystem           Size  Used Avail Use% Mounted on +insmod xfs 
-/dev/mapper/vg0-lv0  333M  17M  314M   1% /mnt/lvm +set root='hd0,msdos1' 
-</code>+if [ x$feature_platform_search_hint = xy ]; then 
 +  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  6f6c5bb9-30be-4734-bc23-03fed8541616 
 +else 
 +  search --no-floppy --fs-uuid --set=root 6f6c5bb9-30be-4734-bc23-03fed8541616 
 +fi 
 +insmod part_msdos 
 +insmod xfs 
 +set boot='hd0,msdos1' 
 +if [ x$feature_platform_search_hint = xy ]; then 
 +  search --no-floppy --fs-uuid --set=boot --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  6f6c5bb9-30be-4734-bc23-03fed8541616 
 +else 
 +  search --no-floppy --fs-uuid --set=boot 6f6c5bb9-30be-4734-bc23-03fed8541616 
 +fi
  
-Dans la cas de notre exemple, la taille est de **333 Mo** avec **17 Mo** occupé.+# This section was generated by a script. Do not modify the generated file - all changes 
 +# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files. 
 +
 +# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and 
 +# populates the boot menu. Please refer to the Boot Loader Specification documentation 
 +# for the files format: https://systemd.io/BOOT_LOADER_SPECIFICATION/.
  
-====LAB #4 Etendre un Volume Logique à Chaud====+# The kernelopts variable should be defined in the grubenv file. But to ensure that menu 
 +# entries populated from BootLoaderSpec files that use this variable work correctly even 
 +# without a grubenv file, define a fallback kernelopts variable if this has not been set. 
 +
 +# The kernelopts variable in the grubenv file can be modified using the grubby tool or by 
 +# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX 
 +# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both 
 +# the kernelopts variable in the grubenv file and the fallback kernelopts variable. 
 +if [ -z "${kernelopts}" ]; then 
 +  set kernelopts="root=/dev/mapper/rhel-root ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet " 
 +fi
  
-Pour agrandir un volume logique, le paquet **lvm2** contient les commandes **lvextend** et **resize2fs** :+insmod blscfg 
 +blscfg 
 +### END /etc/grub.d/10_linux ###
  
-<code> +### BEGIN /etc/grub.d/10_reset_boot_success ### 
-[root@centos8 ~]lvextend -L +100M /dev/vg0/lv0 +# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry 
-  Rounding size to boundary between physical extents: 104.00 MiB. +if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then 
-  Size of logical volume vg0/lv0 changed from 352.00 MiB (44 extents) to 456.00 MiB (57 extents). +  set menu_hide_ok=1 
-  Logical volume vg0/lv0 successfully resized. +else 
-</code>+  set menu_hide_ok=0  
 +fi 
 +# Reset boot_indeterminate after a successful boot 
 +if [ "${boot_success}" = "1" ] ; then 
 +  set boot_indeterminate=0 
 +# Avoid boot_indeterminate causing the menu to be hidden more than once 
 +elif [ "${boot_indeterminate}" = "1" ]; then 
 +  set boot_indeterminate=2 
 +fi 
 +# Reset boot_success for current boot  
 +set boot_success=0 
 +save_env boot_success boot_indeterminate 
 +### END /etc/grub.d/10_reset_boot_success ###
  
-<WRAP center round important 60%> +### BEGIN /etc/grub.d/12_menu_auto_hide ### 
-**Important** Notez que l'agrandissement du volume est un multiple du PE. +if [ x$feature_timeout_style = xy ] ; then 
-</WRAP>+  if [ "${menu_show_once}" ]; then 
 +    unset menu_show_once 
 +    save_env menu_show_once 
 +    set timeout_style=menu 
 +    set timeout=60 
 +  elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then 
 +    set orig_timeout_style=${timeout_style} 
 +    set orig_timeout=${timeout} 
 +    if [ "${fastboot}" = "1" ]; then 
 +      # timeout_style=menu + timeout=0 avoids the countdown code keypress check 
 +      set timeout_style=menu 
 +      set timeout=0 
 +    else 
 +      set timeout_style=hidden 
 +      set timeout=1 
 +    fi 
 +  fi 
 +fi 
 +### END /etc/grub.d/12_menu_auto_hide ###
  
-Les options de la commande **lvextend** sont :+### BEGIN /etc/grub.d/14_menu_show_once ### 
 +if [ x$feature_timeout_style = xy ]; then 
 +  if [ "${menu_show_once_timeout}" ]; then 
 +    set timeout_style=menu 
 +    set timeout="${menu_show_once_timeout}" 
 +    unset menu_show_once_timeout 
 +    save_env menu_show_once_timeout 
 +  fi 
 +fi 
 +### END /etc/grub.d/14_menu_show_once ###
  
-<code> +### BEGIN /etc/grub.d/20_linux_xen ### 
-[root@centos8 ~]lvextend --help +### END /etc/grub.d/20_linux_xen ###
-  lvextend - Add space to a logical volume+
  
-  Extend an LV by a specified size+### BEGIN /etc/grub.d/20_ppc_terminfo ### 
-  lvextend -L|--size [+]Size[m|UNIT] LV +### END /etc/grub.d/20_ppc_terminfo ###
- [ -l|--extents [+]Number[PERCENT] ] +
- [ -r|--resizefs ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [    --poolmetadatasize [+]Size[m|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ..]+
  
-  Extend an LV by specified PV extents+### BEGIN /etc/grub.d/30_os-prober ### 
-  lvextend LV PV ... +### END /etc/grub.d/30_os-prober ###
--r|--resizefs ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ COMMON_OPTIONS ]+
  
-  Extend a pool metadata SubLV by a specified size. +### BEGIN /etc/grub.d/30_uefi-firmware ### 
-  lvextend --poolmetadatasize [+]Size[m|UNIT] LV_thinpool +if "$grub_platform" = "efi" ]; then 
--i|--stripes Number +        menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' { 
- -I|--stripesize Size[k|UNIT] ] +                fwsetup 
- [ COMMON_OPTIONS ] +        } 
- [ PV ... ]+fi 
 +### END /etc/grub.d/30_uefi-firmware ###
  
-  Extend an LV according to a predefined policy+### BEGIN /etc/grub.d/35_fwupd ### 
-  lvextend --usepolicies LV_snapshot_thinpool +### END /etc/grub.d/35_fwupd ###
- [ -r|--resizefs ] +
- [ COMMON_OPTIONS ] +
- [ PV ..]+
  
-  Common options for command: +### BEGIN /etc/grub.d/40_custom ### 
- [ -A|--autobackup y|n ] +# This file provides an easy way to add custom menu entries.  Simply type the 
- [ -f|--force ] +# menu entries you want to add after this comment.  Be careful not to change 
- [ -m|--mirrors Number ] +# the 'exec tail' line above. 
- [ -n|--nofsck ] +### END /etc/grub.d/40_custom ###
- [    --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] +
- [    --nosync ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- [    --type linear|striped|snapshot|mirror|raid|thin|cache|vdo|thin-pool|cache-pool|vdo-pool ]+
  
-  Common options for lvm: +### BEGIN /etc/grub.d/41_custom ### 
- [ -d|--debug ] +if [ -f  ${config_directory}/custom.cfg ]; then 
- [ -h|--help +  source ${config_directory}/custom.cfg 
- [ -q|--quiet ] +elif [ -z "${config_directory}" --f  $prefix/custom.cfg ]; then 
- [ -v|--verbose +  source $prefix/custom.cfg 
- [ -y|--yes ] +fi 
- [ -t|--test ] +### END /etc/grub.d/41_custom ###
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ] +
- +
-  Use --longhelp to show all options and advanced commands.+
 </code> </code>
  
-Le volume ayant été agrandi, il est necessaire maintenant d'agrandir le filesystem qui s'y trouve :+Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **grub2-mkconfig**. La commande grub2-mkconfig prend en argument l'emplacement du fichier grub.cfg, par exemple :
  
-<code> +  * grub2-mkconfig -o /boot/grub2/grub.cfg, ou 
-[root@centos8 ~]# resize2fs /dev/vg0/lv0 +  * grub2-mkconfig -/boot/efi/EFI/redhat/grub.cfg
-resize2fs 1.45.6 (20-Mar-2020) +
-Filesystem at /dev/vg0/lv0 is mounted on /mnt/lvm; on-line resizing required +
-old_desc_blocks = 2, new_desc_blocks = 2 +
-The filesystem on /dev/vg0/lv0 is now 466944 (1k) blocks long. +
-</code>+
  
-Constatez maintenant la modification de la taille du volume :+Lors de l'exécution de la commande **grub2-mkconfig** plusieurs fichiers sont lus :
  
-<code> +===Le fichier /boot/grub2/device.map===
-[root@centos8 ~]# df -h /mnt/lvm +
-Filesystem           Size  Used Avail Use% Mounted on +
-/dev/mapper/vg0-lv0  434M   17M  395M   5% /mnt/lvm +
-</code> +
- +
-Vous noterez que la taille a augmentée mais que les données sont toujours présentes. +
- +
-====LAB #5 - Snapshots==== +
- +
-Un snapshot est un instantané d'un système de fichiers. Dans cet exemple, vous allez créer un snapshot de votre lv0 : +
- +
-Avant de commencer, créez un fichier de 10Mo dans le volume :+
  
 <code> <code>
-[root@centos8 ~]# dd if=/dev/zero of=/mnt/lvm/10M bs=1048576 count=10 +[root@redhat9 ~]# cat /boot/grub2/device.map 
-10+0 records in +# this device map was generated by anaconda 
-10+0 records out +(hd0     /dev/sda
-10485760 bytes (10 MB, 10 MiBcopied, 0.0281282 s, 373 MB/s+
 </code> </code>
  
-Créez maintenant un snapshot : +===Le fichier /etc/default/grub===
- +
-<code> +
-[root@centos8 ~]# lvcreate -s -L 18M -n testsnap /dev/vg0/lv0 +
-  Rounding up size to full physical extent 24.00 MiB +
-  Logical volume "testsnap" created. +
-</code>+
  
-Pour avoir une confirmation de la création du snapshot, utilisez la commande **lvs** :+Ce fichier contient la configuration par défaut des paramètres de GRUB 2 :
  
 <code> <code>
-[root@centos8 ~]# lvs +[root@redhat9 ~]# cat /etc/default/grub 
-  LV       VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert +GRUB_TIMEOUT=5 
-  root     cl_centos8 -wi-ao----  27.79g                                                     +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 
-  swap     cl_centos8 -wi-ao----   3.20g                                                     +GRUB_DEFAULT=saved 
-  lv0      vg0        owi-aos--- 456.00m                                                     +GRUB_DISABLE_SUBMENU=true 
-  testsnap vg0        swi-a-s---  24.00m      lv0    0.05  +GRUB_TERMINAL_OUTPUT="console" 
 +GRUB_CMDLINE_LINUX="crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet" 
 +GRUB_DISABLE_RECOVERY="true" 
 +GRUB_ENABLE_BLSCFG=true
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** Notez que le snapshot est créé dans le même VG que le LV d'origine.+**Important** Notez que toute modification de ce fichier nécessite l'exécution de la commande **grub2-mkconfig** pour que les modifications soient prises en compte.
 </WRAP> </WRAP>
  
-Les options de la commande **lvs** sont :+Dans ce fichier les directives sont :
  
-<code> +^  Directive  ^ Description ^ 
-[root@centos8 ~]# lvs --help +| GRUB_TIMEOUT | Durée de l'affichage du menu avant le démarrage en utilisant la valeur de GRUB_DEFAULT | 
-  lvs Display information about logical volumes+| GRUB_DISTRIBUTOR | Ligne de commande qui génère le texte de l'entrée | 
 +| GRUB_DEFAULT | Entrée du menu sélectionner par défaut | 
 +| GRUB_DISABLE_SUBMENU | Active ou désactive les sous-menus de GRUB2 | 
 +| GRUB_TERMINAL_OUTPUT | Spécifie le terminal par défaut | 
 +| GRUB_CMDLINE_LINUX | Paramètres passés au noyau peu importe le type de démarrage | 
 +| GRUB_DISABLE_RECOVERY | Active ou désactive la génération des entrées en mode **recovery** | 
 +| GRUB_BLSCFG | Active ou désactive l'utilisation de la nouvelle spécification du gestionnaire de démarrage pour configurer celui-ci |
  
-  lvs +===Les fichiers du répertoire /etc/grub.d===
- [ -H|--history ] +
- [ -a|--all ] +
- [ -o|--options String ] +
- [ -S|--select String ] +
- [ -O|--sort String ] +
- [    --segments ] +
- [    --aligned ] +
- [    --binary ] +
- [    --configreport log|vg|lv|pv|pvseg|seg ] +
- [    --foreign ] +
- [    --ignorelockingfailure ] +
- [    --logonly ] +
- [    --nameprefixes ] +
- [    --noheadings ] +
- [    --nosuffix ] +
- [    --readonly ] +
- [    --reportformat basic|json ] +
- [    --rows ] +
- [    --separator String ] +
- [    --shared ] +
- [    --unbuffered ] +
- [    --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] +
- [    --unquoted ] +
- [ COMMON_OPTIONS ] +
- [ VG|LV|Tag ... ] +
- +
-  Common options for lvm: +
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ] +
- +
-  Use --longhelp to show all options and advanced commands. +
-</code>+
  
-Créez maintenant un répertoire pour monter le snapshot :+Les fichiers de ce répertoire sont exécutés dans l'ordre alphanumérique et servent à construire les menus de GRUB 2 :
  
 <code> <code>
-[root@centos8 ~]# mkdir /mnt/testsnap+[root@redhat9 ~]# ls -l /etc/grub.d 
 +total 108 
 +-rwxr-xr-x. 1 root root  9346 Jun 27 12:12 00_header 
 +-rwxr-xr-x. 1 root root  1046 Feb 22  2024 00_tuned 
 +-rwxr-xr-x. 1 root root   236 Jun 27 12:12 01_users 
 +-rwxr-xr-x. 1 root root   835 Jun 27 12:12 08_fallback_counting 
 +-rwxr-xr-x. 1 root root 19665 Jun 27 12:12 10_linux 
 +-rwxr-xr-x. 1 root root   833 Jun 27 12:12 10_reset_boot_success 
 +-rwxr-xr-x. 1 root root   892 Jun 27 12:12 12_menu_auto_hide 
 +-rwxr-xr-x. 1 root root   410 Jun 27 12:12 14_menu_show_once 
 +-rwxr-xr-x. 1 root root 13613 Jun 27 12:12 20_linux_xen 
 +-rwxr-xr-x. 1 root root  2562 Jun 27 12:12 20_ppc_terminfo 
 +-rwxr-xr-x. 1 root root 10869 Jun 27 12:12 30_os-prober 
 +-rwxr-xr-x. 1 root root  1122 Jun 27 12:12 30_uefi-firmware 
 +-rwxr-xr-x. 1 root root   725 Feb 19  2024 35_fwupd 
 +-rwxr-xr-x. 1 root root   218 Jun 27 12:12 40_custom 
 +-rwxr-xr-x. 1 root root   219 Jun 27 12:12 41_custom 
 +-rw-r--r--. 1 root root   483 Jun 27 12:12 README
 </code> </code>
  
-Montez le snapshot :+  * **Le fichier /etc/grub.d/10_Linux**, 
 +    * Le fichier **10_Linux** contient des boucles pour rechercher des noyaux Linux, 
 +  * **Le fichier /etc/grub.d/30_os-prober**, 
 +    * Ce fichier recherche des éventuels systèmes d'exploitation autre que Linux, 
 +  * **Les fichiers /etc/grub.d/40_custom et /etc/grub.d/41_custom**, 
 +    * Ces deux fichiers sont fournis en tant que modèles à personnaliser.
  
-<code> +===Le Fichier /boot/grub2/grubenv===
-[root@centos8 ~]# mount /dev/vg0/testsnap /mnt/testsnap +
-</code>+
  
-Comparez le volume d'origine et le snapshot :+Le fichier **/boot/grub2/grubenv** contient l'entrée du menu sauvegardée, référencée par la directive **GRUB_DEFAULT** du fichier **/etc/default/grub** :
  
 <code> <code>
-[root@centos8 ~]# ls -l /mnt/lvm +[root@redhat9 ~]# cat /boot/grub2/grubenv 
-total 10296 +# GRUB Environment Block 
--rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M +# WARNING: Do not edit this file by tools other than grub-editenv!!! 
-drwxr-xr-x3 root root     1024 Jun 16 06:39 home +saved_entry=5a35a3eb625c45cea1d33535723e791f-5.14.0-427.37.1.el9_4.x86_64 
-drwx------2 root root    12288 Jun 24 04:20 lost+found +menu_auto_hide=1 
-[root@centos8 ~]# ls -l /mnt/testsnap/ +boot_success=1 
-total 10296 +boot_indeterminate=0 
--rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M +###################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################[root@redhat9 ~]#
-drwxr-xr-x. 3 root root     1024 Jun 16 06:39 home +
-drwx------. 2 root root    12288 Jun 24 04:20 lost+found+
 </code> </code>
  
-Supprimez maintenant le fichier **10M** de votre volume d'origine :+===Modifier la Configuration de GRUB 2 en Ligne de Commande===
  
-<code> +Lors du démarrage de GRUB 2, trois actions sont possibles à partir du menu :
-[root@centos8 ~]# rm /mnt/lvm/10M +
-rmremove regular file '/mnt/lvm/10M'?+
-</code>+
  
-Constatez le résultat de cette suppression :+  * Lancer un système d'exploitation en le sélectionnant avec les flèches puis en appuyant sur la touche <key>Entrée</key>, 
 +  * Lancer l'éditeur en appuyant sur la touche **e**, 
 +  * Lancer l’interface de la ligne de commande GRUB en appuyant sur la touche **c**.
  
-<code> +En mode édition notez l'utilisation des touches suivantes :
-[root@centos8 ~]# df -Ph /mnt/lvm +
-Filesystem           Size  Used Avail Use% Mounted on +
-/dev/mapper/vg0-lv0  434M   17M  395M   5% /mnt/lvm+
  
-[root@centos8 ~]# df -Ph /mnt/testsnap/ +  * **flèches** : se déplacer dans l'écran. L'édition se fait en utilisant simplement les touches du clavier, 
-Filesystem                Size  Used Avail Use% Mounted on +  * **Crtl-X** : démarrer avec la configuration modifiée, 
-/dev/mapper/vg0-testsnap  434M   27M  385M   7% /mnt/testsnap+  * **echap** : abandonner les modifications et retourner à l'interface menu de GRUB 2.
  
-[root@centos8 ~]# lvs +====Chargeurs de Démarrages Alternatifs====
-  LV       VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert +
-  root     cl_centos8 -wi-ao----  27.79g                                                     +
-  swap     cl_centos8 -wi-ao----   3.20g                                                     +
-  lv0      vg0        owi-aos--- 456.00m                                                     +
-  testsnap vg0        swi-aos---  24.00m      lv0    0.24      +
-</code>+
  
-<WRAP center round todo 60%> +===Systemd-boot===
-**A Faire** Restaurez le fichier 10M à partir du snapshot. +
-</WRAP>+
  
-====LAB #6 Suppression des Volumes====+Un Chargeur de Démarrage étroitement lié à Systemd ( voir plus bas ), celui-ci connaît actuellement un gain de popularité.
  
-La suppression d'un volume logique se fait grace à la commande **lvremove** :+===U-boot===
  
-<code> +Un Chargeur de Démarrage qui peut booter n'importe quelle image à partir de n'importe quel support.
-[root@centos8 ~]# umount /mnt/testsnap/ +
-[root@centos8 ~]# lvremove /dev/vg0/testsnap +
-Do you really want to remove active logical volume vg0/testsnap? [y/n]: y +
-  Logical volume "testsnap" successfully removed +
-[root@centos8 ~]# umount /mnt/lvm  +
-[root@centos8 ~]# lvremove /dev/vg0/lv0 +
-Do you really want to remove active logical volume vg0/lv0? [y/n]: y +
-  Logical volume "lv0" successfully removed +
-</code>+
  
-<WRAP center round important 60%> +===Le Projet Syslinux===
-**Important** - Notez que cette opération necéssite à ce que le volume logique soit démonté. +
-</WRAP>+
  
-Les options de la commande **lvremove** sont :+==SYSLINUX==
  
-<code> +Un Chargeur de Démarrage pour les systèmes qui utilisent le système de fichier FAT. Par exemple le systèmes sur clefs USB.
-[root@centos8 ~]# lvremove --help +
-  lvremove - Remove logical volume(s) from the system+
  
-  lvremove VG|LV|Tag|Select ... +==EXTLINUX==
- [ -A|--autobackup y|n ] +
- [ -f|--force ] +
- [ -S|--select String ] +
- [    --nohistory ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- [ COMMON_OPTIONS ]+
  
-  Common options for lvm: +Un Chargeur de Démarrage de petite taille qui sait booter des systèmes de fichier, EXT2, EXT3, EXT4 et BRTFS.
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ]+
  
-  Use --longhelp to show all options and advanced commands +==ISOLINUX==
-</code>+
  
-Le Volume Group peut aussi être supprimé :+Un Chargeur de Démarrage pour booter des LiveCD et LiveDVD. Dans le cas d'ISOLINUX, deux fichiers sont necéssaires :
  
-<code> +  * **isolinux.bin** qui contient l'image du Chargeur de Démarrage et 
-[root@centos8 ~]# vgremove vg0 +  * **isolinux.cfg** qui contient les paramètres de configuration.
-  Volume group "vg0" successfully removed +
-</code>+
  
-Les options de la commande **vgremove** sont :+==PXELINUX== 
 +  
 +Un Chargeur de Démarrage pour booter à partir d'un serveur réseau. Ce système utilise le standard **PXE** (//Pre-boot Execution Environment//) qui utilise :
  
-<code> +    * **DHCP** pour attribuer une adresse IP à la machine et 
-[root@centos8 ~]# vgremove --help +    * **BOOTP** pour charger l'image du Chargeur de Démarrage à partir du serveur en utilisant le protocol **TFTP** (//Trivial File Transfer Protocol//). L'image à télécharger doit s'appeler **/tftpboot/pxelinux.0** et chaque machine doit avoir un fichier de configuration dans le répertoire **/tftpboot/pxelinux.cfg/**
-  vgremove - Remove volume group(s)+
  
-  vgremove VG|Tag|Select ... +===Isodhpfx===
- [ -f|--force ] +
- [ -S|--select String ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- [ COMMON_OPTIONS ]+
  
-  Common options for lvm: +Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, qui peut être chargé sur un disque **ou** une clef USB. Le fichier isodhpfx.bin est créé avec le programme **xorriso**.
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ]+
  
-  Use --longhelp to show all options and advanced commands. +====Initramfs====
-</code>+
  
-Ainsi que le volume physique :+Le fichier Initramfs //%%INITial Ram File System%%// est une archive au format cpio :
  
 <code> <code>
-[root@centos8 ~]# pvremove /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@redhat9 ~]# cp /boot/initramfs-`uname -r`.img /tmp/custom
-  Labels on physical volume "/dev/sdb6" successfully wiped. +
-  Labels on physical volume "/dev/sdb7" successfully wiped. +
-  Labels on physical volume "/dev/sdb9" successfully wiped. +
-</code> +
- +
-Les options de la commande **pvremove** sont : +
- +
-<code> +
-[root@centos8 ~]# pvremove --help +
-  pvremove - Remove LVM label(s) from physical volume(s) +
- +
-  pvremove PV ... +
- [ -f|--force ] +
- [    --reportformat basic|json ] +
- [ COMMON_OPTIONS ]+
  
-  Common options for lvm: +[root@redhat9 ~]# cd /tmp
- -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ]+
  
-  Use --longhelp to show all options and advanced commands.+[root@redhat9 tmp]# ls custom 
 +custom
 </code> </code>
  
-====LAB #7 - Volumes Logiques en Miroir====+===Examiner l'image existante===
  
-Re-créez maintenant votre Volume Group :+Pour examiner une image initramfs archivée, il convient d'utiliser la commande **lsinitrd** :
  
 <code> <code>
-[root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@redhat9 tmp]# lsinitrd custom | more 
-  Physical volume "/dev/sdb6" successfully created+Image: custom: 54M 
-  Physical volume "/dev/sdb7" successfully created. +======================================================================== 
-  Physical volume "/dev/sdb9" successfully created.+Early CPIO image 
 +======================================================================== 
 +drwxr-xr-x   3 root     root            0 Jan  4  2024 
 +-rw-r--r--   1 root     root            2 Jan  4  2024 early_cpio 
 +drwxr-xr-x   3 root     root            0 Jan  4  2024 kernel 
 +drwxr-xr-x   3 root     root            0 Jan  4  2024 kernel/x86 
 +drwxr-xr-x   2 root     root            0 Jan  4  2024 kernel/x86/microcode 
 +-rw-r--r--   1 root     root        28672 Jan  4  2024 kernel/x86/microcode/GenuineIntel.bin 
 +======================================================================== 
 +Version: dracut-057-53.git20240104.el9
  
-[root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 +Arguments:  -f -v
-  Volume group "vg0" successfully created +
-</code>+
  
-Créez maintenant un Logical Volume en miroir grâce à l'option **-m** de la commande **lvcreate**, suivi du nombre de miroirs +dracut modules
- +bash 
-<code> +systemd 
-[root@centos8 ~]# lvcreate -1 -L 100M -n lv1 vg0 +systemd-initrd 
-  Rounding up size to full physical extent 104.00 MiB +systemd-sysusers 
-  Logical volume "lv1" created.+nss-softokn 
 +dbus-broker 
 +dbus 
 +i18n 
 +network-manager 
 +network 
 +ifcfg 
 +drm 
 +plymouth 
 +prefixdevname 
 +dm 
 +kernel-modules 
 +kernel-modules-extra 
 +kernel-network-modules 
 +lvm 
 +qemu 
 +qemu-net 
 +resume 
 +rootfs-block 
 +terminfo 
 +udev-rules 
 +virtiofs 
 +dracut-systemd 
 +usrmount 
 +base 
 +fs-lib 
 +microcode_ctl-fw_dir_override 
 +shutdown 
 +======================================================================== 
 +drwxr-xr-x  12 root     root            0 Jan  4  2024 . 
 +crw-r--r-  root     root       5,   1 Jan  4  2024 dev/console 
 +crw-r--r--   1 root     root       1,  11 Jan  4  2024 dev/kmsg 
 +crw-r--r--   1 root     root       1,   3 Jan  4  2024 dev/null 
 +crw-r--r--   1 root     root       1,   8 Jan  4  2024 dev/random 
 +crw-r--r--   1 root     root       1,   9 Jan  4  2024 dev/urandom 
 +--More--
 </code> </code>
  
-Constatez maintenant la présence du miroir : +===Le script init===
- +
-<code> +
-[root@centos8 ~]# lvdisplay -m /dev/vg0/lv1 +
-  --- Logical volume --- +
-  LV Path                /dev/vg0/lv1 +
-  LV Name                lv1 +
-  VG Name                vg0 +
-  LV UUID                lJQQWs-n05T-pxzi-Zq2R-UzRI-kYZf-hsNPYQ +
-  LV Write Access        read/write +
-  LV Creation host, time centos8.ittraining.loc, 2021-06-02 07:37:28 -0400 +
-  LV Status              available +
-  # open                 0 +
-  LV Size                104.00 MiB +
-  Current LE             13 +
-  Mirrored volumes       2 +
-  Segments               1 +
-  Allocation             inherit +
-  Read ahead sectors     auto +
-  - currently set to     8192 +
-  Block device           253:+
-    +
-  --- Segments --- +
-  Logical extents 0 to 12: +
-    Type raid1 +
-    Monitoring monitored +
-    Raid Data LV 0 +
-      Logical volume lv1_rimage_0 +
-      Logical extents 0 to 12 +
-    Raid Data LV 1 +
-      Logical volume lv1_rimage_1 +
-      Logical extents 0 to 12 +
-    Raid Metadata LV 0 lv1_rmeta_0 +
-    Raid Metadata LV 1 lv1_rmeta_1 +
-</code>+
  
-Le miroir s'étend sur plusieurs volumes physiques :+Red Hat 9 utilise le système de démarrage **systemd**. Pour cette raison le script init est un lien symbolique vers **/usr/lib/systemd/systemd** :
  
 <code> <code>
-[root@centos8 ~]# pvdisplay -m /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@redhat9 tmp]# lsinitrd custom | grep usr/lib/systemd/systemd | grep init 
-  --- Physical volume --- +lrwxrwxrwx   1 root     root           23 Jan  4  2024 init -> usr/lib/systemd/systemd
-  PV Name               /dev/sdb6 +
-  VG Name               vg0 +
-  PV Size               200.00 MiB / not usable 8.00 MiB +
-  Allocatable           yes  +
-  PE Size               8.00 MiB +
-  Total PE              24 +
-  Free PE               10 +
-  Allocated PE          14 +
-  PV UUID               lxuKRI-l3Dd-jhsv-OWtw-au2c-0ti0-XGnt1E +
-    +
-  --- Physical Segments --- +
-  Physical extent 0 to 0: +
-    Logical volume /dev/vg0/lv1_rmeta_0 +
-    Logical extents 0 to 0 +
-  Physical extent to 13: +
-    Logical volume /dev/vg0/lv1_rimage_0 +
-    Logical extents 0 to 12 +
-  Physical extent 14 to 23+
-    FREE +
-    +
-  --- Physical volume --- +
-  PV Name               /dev/sdb7 +
-  VG Name               vg0 +
-  PV Size               300.00 MiB / not usable 4.00 MiB +
-  Allocatable           yes  +
-  PE Size               8.00 MiB +
-  Total PE              37 +
-  Free PE               23 +
-  Allocated PE          14 +
-  PV UUID               QDmfcX-Pv8o-hapq-TJOI-RaPH-qecT-VUMY4v +
-    +
-  --- Physical Segments --- +
-  Physical extent 0 to 0: +
-    Logical volume /dev/vg0/lv1_rmeta_1 +
-    Logical extents 0 to 0 +
-  Physical extent 1 to 13: +
-    Logical volume /dev/vg0/lv1_rimage_1 +
-    Logical extents 0 to 12 +
-  Physical extent 14 to 36: +
-    FREE +
-    +
-  --- Physical volume --- +
-  PV Name               /dev/sdb9 +
-  VG Name               vg0 +
-  PV Size               400.00 MiB / not usable 8.00 MiB +
-  Allocatable           yes  +
-  PE Size               8.00 MiB +
-  Total PE              49 +
-  Free PE               49 +
-  Allocated PE          0 +
-  PV UUID               ZTQV1b-Ha76-BQtB-zJEU-kfyK-ausJ-CxnRwg +
-    +
-  --- Physical Segments --- +
-  Physical extent 0 to 48: +
-    FREE+
 </code> </code>
  
-La suppression du miroir se fait en utilisant la commande **lvconvert** en indiquant quel volume physique doit être vidé de son contenu :+===Consulter le contenu d'un fichier dans initramfs===
  
-<code> +Pour consulter le contenu d'un fichier inclus dans l'initramfs, il convient d'utiliser la commande **lsinitrd** de la manière suivante :
-[root@centos8 ~]# lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7 +
-Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y +
-  Logical volume vg0/lv1 successfully converted. +
-</code> +
- +
-De même, il est possible de créer un miroir pour un volume logique existant :+
  
 <code> <code>
-[root@centos8 ~]# lvconvert -m 1 /dev/vg0/lv1 +[root@redhat9 tmp]# lsinitrd /boot/initramfs-$(uname -r).img  /etc/ld.so.conf 
-Are you sure you want to convert linear LV vg0/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y +include ld.so.conf.d/*.conf
-  Logical volume vg0/lv1 successfully converted.+
 </code> </code>
  
-Supprimez de nouveau votre miroir :+====Processus de Démarrage du Noyau Linux====
  
-<code> +Le processus de démarrage du Noyau Linux peut être divisé en 6 étapes :
-[root@centos8 ~]# lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7 +
-Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]+
-  Logical volume vg0/lv1 successfully converted. +
-</code>+
  
-Les options de la commande **lvconvert** sont :+^ Etape ^ Description ^ 
 +| Chargement, configuration et exécution du chargeur du noyau | Le fichier **bootsect.s** est chargé en mémoire par le BIOS. Une fois configuré celui-ci charge le reste du noyau en mémoire | 
 +| Configuration des paramètres et bascule vers le mode 32 bits | Le fichier **boot.s** met en place un **[[http://fr.wikipedia.org/wiki/Interrupt_Descriptor_Table|IDT]]** (//Interrupt Descriptor Table//) temporaire et **[[http://fr.wikipedia.org/wiki/Global_Descriptor_Table|GDT]]** (//Global Descriptor Table//) temporaire et gère le basculement vers le mode 32 bits | 
 +| Décompression du Noyau | Le fichier **head.s** décompresse le noyau | 
 +| Initialisation du noyau et de la mémoire | Le fichier **head.s** crée un GDT et IDT définitif | 
 +| Configuration du noyau | Le fichier **main.c** met en place les contraintes de mémoire et configure la mémoire virtuelle | 
 +| Création du processus Init | Le fichier **main.c** crée le processus init |
  
-<code> +La fonction **init_post()** essaie ensuite d'exécuter un des processus suivant dans l'ordre :
-[root@centos8 ~]# lvconvert --help +
-  lvconvert - Change logical volume layout+
  
-  Convert LV to linear. +  * /sbin/init ==> /usr/sbin/init ==> /usr/lib/systemd/systemd 
-  lvconvert --type linear LV +  * /etc/init 
- [ COMMON_OPTIONS ] +  * /bin/init 
- [ PV ... ]+  * /bin/sh ==> /bin/bash ==> /usr/bin/bash
  
-  Convert LV to striped. +Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché.
-  lvconvert --type striped LV +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ -i|--interval Number ] +
- [    --stripes Number ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Convert LV to type mirror (also see type raid1), +=====Systemd=====
-  lvconvert --type mirror LV +
- [ -m|--mirrors [+|-]Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ -i|--interval Number ] +
- [    --stripes Number ] +
- [    --mirrorlog core|disk ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Convert LV to raid or change raid layout  +Les systèmes de démarrage antérieurs à Systemd**SysVinit** et **Upstart**, étaient des systèmes de démarrage **séquentiels**
-  (a specific raid level must be usede.g. raid1). +
-  lvconvert --type raid LV +
- [ -m|--mirrors [+|-]Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ -i|--interval Number ] +
- [    --stripes Number ] +
- [ COMMON_OPTIONS ] +
- [ PV ..]+
  
-  Convert LV to raid1 or mirroror change number of mirror images. +**Systemd** essaiepar contre, de démarrer autant de services en parallèle que possibleCeci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœursSi un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tamponQui plus est, les services qui ne sont pas nécessaires au démarrage de la machine, tel cups, ne sont démarrés ultérieurement que si nécessaire. Lors de démarrage, les partitions sont montées en parallèle. Dernièrement, **Systemd** remplace les scripts de démarrage traditionnels avec des binaires compilés, beaucoup plus rapides que leur prédécesseurs.
-  lvconvert -m|--mirrors [+|-]Number LV +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ -i|--interval Number ] +
- [    --mirrorlog core|disk ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Convert raid LV to change number of stripe images. +Au lieu de parler de scripts de démarrage et de niveaux d'exécution, **Systemd** utilise la terminologie **Unités** (//Units//) et **Cibles** (//Targets//)Une Unité peut être :
-  lvconvert --stripes Number LV_raid +
- [ -i|--interval Number ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Convert raid LV to change the stripe size+  * **.automount** - active la fonctionalité d'automount
-  lvconvert -I|--stripesize Size[k|UNIT] LV_raid +  * **.device** expose une périphérique dans systemd. 
- -i|--interval Number ] +  * **.mount** contrôle quand et comment les systèmes de fichiers sont montés. 
- -R|--regionsize Size[m|UNIT] ] +  * **.path** active un service quand il y a un accès à un fichier ou répertoire sous surveillance par le système. 
- [ COMMON_OPTIONS ]+  * **.service** démarre, arrête, redémarre ou recharge un service. 
 +  * **.scope** gère des services. 
 +  * **.slice** regroupe des Unités dans une arborescence afin de limiter des ressources en utilisant des CGroups. 
 +  * **.snapshot** un état sauvegardé du gestionnaire Systemd. 
 +  * **.socket** permet aux Unités d'utiliser des sockets pour la communication inter-processus. 
 +  * **.swap** - encapsule une périphérique ou un fichier swap. 
 +  * **.timer** - déclenche l'activation d'autres Unités en utilisant des minuteurs de Systemd. 
 +  * **.target** - regroupe des Unités multiples afin qu'elles puissent être démarrées en même temps. Par exemple **network.target** regroupe toutes les Unités nécessaires pour démarrer toutes les interfaces réseaux en même temps.
  
-  Split images from a raid1 or mirror LV and use them to create a new LV. +Une Cible est en quelque sorte une **grande étape** dans le démarrage du système :
-  lvconvert --splitmirrors Number -n|--name LV_new LV_cache_mirror_raid1 +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Split images from a raid1 LV and track changes to origin for later merge+  * **halt.target** - arrête le système
-  lvconvert --splitmirrors Number --trackchanges LV_cache_raid1 +  * **poweroff.target** arrête le système et coupe le courant. 
- [ COMMON_OPTIONS ] +  * **shutdown.target** arrête le système. 
- [ PV ... ]+  * **rescue.target** démarre le système en mode single-user (seul root peut s'y connecter). Tous les systèmes de fichiers sont montés mais le réseau n'est pas démarré. 
 +  * **emergency.target** - démarre le système en mode single-user (seul root peut s'y connecter). Uniquement le système de fichiers racine est monté en mode lecture seule. Le réseau n'est pas démarré. 
 +  * **multi-user.target** - démarre le système en mode multi-utilisateur avec tous les systèmes de fichiers montés et le service network démarré. 
 +  * **graphical.target** - démarre le système en multi-user.target puis démarre l'interface graphique. 
 +  * **hibernate.target** - sauvegarde l'état courant sur disque et arrête le système. Quand le système est démarré, l'état est restauré. 
 +  * **reboot.target** - redémarre le système.
  
-  Merge LV images that were split from a raid1 LV. +**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécution. Pour rendre la transition plus facile, il existe des **Cibles** qui "simulent" les niveaux d'exécution de **SysVinit** :
-  lvconvert --mergemirrors VG|LV_linear_raid|Tag ... +
- [ COMMON_OPTIONS ] +
- +
-  Convert LV to a thin LV, using the original LV as an external origin. +
-  lvconvert --type thin --thinpool LV LV_linear_striped_thin_cache_raid +
- [ -T|--thin ] +
- [ -r|--readahead auto|none|Number ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -Z|--zero y|n ] +
- [    --originname LV_new ] +
- [    --poolmetadata LV ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --metadataprofile String ] +
- [ COMMON_OPTIONS ] +
- +
-  Attach a cache pool to an LV, converts the LV to type cache. +
-  lvconvert --type cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid +
- [ -H|--cache ] +
- [ -Z|--zero y|n ] +
- [ -r|--readahead auto|none|Number ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --cachemetadataformat auto|1|2 ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --poolmetadata LV ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --metadataprofile String ] +
- [ COMMON_OPTIONS ] +
- +
-  Attach a writecache to an LV, converts the LV to type writecache. +
-  lvconvert --type writecache --cachevol LV LV_linear_striped_raid +
- [    --cachesettings String ] +
- [ COMMON_OPTIONS ] +
- +
-  Attach a cache to an LV, converts the LV to type cache. +
-  lvconvert --type cache --cachevol LV LV_linear_striped_thinpool_raid +
- [ -H|--cache ] +
- [ -Z|--zero y|n ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --cachemetadataformat auto|1|2 ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [ COMMON_OPTIONS ] +
- +
-  Add a writecache to an LV, using a specified cache device. +
-  lvconvert --type writecache --cachedevice PV LV_linear_striped_raid +
- [    --cachesize Size[m|UNIT] ] +
- [    --cachesettings String ] +
- [ COMMON_OPTIONS ] +
- +
-  Add a cache to an LV, using a specified cache device. +
-  lvconvert --type cache --cachedevice PV LV_linear_striped_thinpool_raid +
- [    --cachesize Size[m|UNIT] ] +
- [    --cachesettings String ] +
- [ COMMON_OPTIONS ] +
- +
-  Convert LV to type thin-pool. +
-  lvconvert --type thin-pool LV_linear_striped_cache_raid +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ -r|--readahead auto|none|Number ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -Z|--zero y|n ] +
- [    --stripes Number ] +
- [    --discards passdown|nopassdown|ignore ] +
- [    --poolmetadata LV ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --metadataprofile String ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Convert LV to type cache-pool. +
-  lvconvert --type cache-pool LV_linear_striped_raid +
- [ -Z|--zero y|n ] +
- [ -r|--readahead auto|none|Number ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [    --cachemetadataformat auto|1|2 ] +
- [    --cachemode writethrough|writeback|passthrough ] +
- [    --cachepolicy String ] +
- [    --cachesettings String ] +
- [    --poolmetadata LV ] +
- [    --poolmetadatasize Size[m|UNIT] ] +
- [    --poolmetadataspare y|n ] +
- [    --metadataprofile String ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Convert LV to type vdopool. +
-  lvconvert --type vdo-pool LV_linear_striped_cache_raid +
- [ -n|--name LV_new ] +
- [ -V|--virtualsize Size[m|UNIT] ] +
- [    --compression y|n ] +
- [    --deduplication y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Detach a cache from an LV. +
-  lvconvert --splitcache LV_thinpool_cache_cachepool_vdopool_writecache +
- [ COMMON_OPTIONS ] +
- +
-  Merge thin LV into its origin LV. +
-  lvconvert --mergethin LV_thin ... +
- [ COMMON_OPTIONS ] +
- +
-  Merge COW snapshot LV into its origin. +
-  lvconvert --mergesnapshot LV_snapshot ... +
- [ -i|--interval Number ] +
- [ COMMON_OPTIONS ] +
- +
-  Combine a former COW snapshot (second arg) with a former  +
-  origin LV (first arg) to reverse a splitsnapshot command. +
-  lvconvert --type snapshot LV LV_linear_striped +
- [ -s|--snapshot ] +
- [ -c|--chunksize Size[k|UNIT] ] +
- [ -Z|--zero y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Replace failed PVs in a raid or mirror LV.  +
-  Repair a thin pool.  +
-  Repair a cache pool. +
-  lvconvert --repair LV_thinpool_cache_cachepool_mirror_raid +
- [ -i|--interval Number ] +
- [    --usepolicies ] +
- [    --poolmetadataspare y|n ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Replace specific PV(s) in a raid LV with another PV. +
-  lvconvert --replace PV LV_raid +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Poll LV to continue conversion. +
-  lvconvert --startpoll LV_mirror_raid +
- [ COMMON_OPTIONS ] +
- +
-  Add or remove data integrity checksums to raid images. +
-  lvconvert --raidintegrity y|n LV_raid +
- [    --raidintegritymode String ] +
- [    --raidintegrityblocksize Number ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Common options for command: +
- [ -b|--background ] +
- [ -f|--force ] +
- [    --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] +
- [    --noudevsync ] +
- +
-  Common options for lvm: +
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ] +
- +
-  Use --longhelp to show all options and advanced commands. +
-</code> +
- +
-====LAB #8 - Modifier les Attributs LVM==== +
- +
-En cas de présence d'un miroir, la commande **lvs** indique la présence du miroir dans la colonne **Attr** avec la lettre **m** :+
  
 <code> <code>
-[root@centos8 ~]# lvs +[root@redhat9 tmp]# ls -l /usr/lib/systemd/system/runlevel* 
-  LV   VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert +lrwxrwxrwx. 1 root root 15 Jul 18 13:00 /usr/lib/systemd/system/runlevel0.target -> poweroff.target 
-  root cl_centos8 -wi-ao----  27.79g                                                     +lrwxrwxrwx. 1 root root 13 Jul 18 13:00 /usr/lib/systemd/system/runlevel1.target -> rescue.target 
-  swap cl_centos8 -wi-ao----   3.20g                                                     +lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel2.target -> multi-user.target 
-  lv1  vg0        -wi-a----- 104.00m                                                                                                  +lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel3.target -> multi-user.target 
-</code>+lrwxrwxrwx. 1 root root 17 Jul 18 13:00 /usr/lib/systemd/system/runlevel4.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/lib/systemd/system/runlevel5.target -> graphical.target 
 +lrwxrwxrwx. 1 root root 13 Jul 18 13:00 /usr/lib/systemd/system/runlevel6.target -reboot.target
  
-<WRAP center round important 60%> +/usr/lib/systemd/system/runlevel1.target.wants: 
-Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs+total 0
-</WRAP>+
  
-La commande equivalente pour les Volume Groups est **vgs** :+/usr/lib/systemd/system/runlevel2.target.wants: 
 +total 0
  
-<code> +/usr/lib/systemd/system/runlevel3.target.wants: 
-[root@centos8 ~]# vgs +total 0
-  VG         #PV #LV #SN Attr   VSize   VFree   +
-  cl_centos8       0 wz--n- <31.00g      0  +
-  vg0          3     wz--n- 880.00m 776.00m +
-</code>+
  
-<WRAP center round important 60%> +/usr/lib/systemd/system/runlevel4.target.wants: 
-Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs+total 0
-</WRAP>+
  
-La commande equivalente pour les Physical Volumes est **pvs** : +/usr/lib/systemd/system/runlevel5.target.wants: 
- +total 0
-<code> +
-[root@centos8 ~]# pvs +
-  PV         VG         Fmt  Attr PSize   PFree   +
-  /dev/sda2  cl_centos8 lvm2 a--  <31.00g      0  +
-  /dev/sdb6  vg0        lvm2 a--  192.00m  88.00m +
-  /dev/sdb7  vg0        lvm2 a--  296.00m 296.00m +
-  /dev/sdb9  vg0        lvm2 a--  392.00m 392.00m    +
 </code> </code>
  
-<WRAP center round important 60%> +====LAB #1 La Commande systemctl====
-Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs. +
-</WRAP> +
- +
-Les commandes **lvchange**, **vgchange** et **pvchange** permettent de modifier les attributs des Logical Volumes, Volume Groups et Physical Volumes respectivement.+
  
-Par exemple, pour rendre inutilisable un Logical Volume, il convient d'enlever l'attribut **a** :+Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :
  
 <code> <code>
-[root@centos8 ~]# lvchange -a n /dev/vg0/lv1+[root@redhat9 tmp]# systemctl list-units 
 +  UNIT                                                                                                     LOAD   ACTIVE SUB       DESCRIPTION                                                                   
 +  proc-sys-fs-binfmt_misc.automount                                                                        loaded active waiting   Arbitrary Executable File Formats File System Automount Point                 
 +  sys-devices-pci0000:00-0000:00:01.1-ata2-host2-target2:0:0-2:0:0:0-block-sr0.device                      loaded active plugged   QEMU_DVD-ROM 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda.device      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb1.device                 loaded active plugged   QEMU_HARDDISK 1 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb10.device                loaded active plugged   QEMU_HARDDISK redhat.ittraining.loc 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb11.device                loaded active plugged   QEMU_HARDDISK my_ext4 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb12.device                loaded active plugged   QEMU_HARDDISK 12 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb2.device                 loaded active plugged   QEMU_HARDDISK 2 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb3.device                 loaded active plugged   QEMU_HARDDISK 3 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb4.device                 loaded active plugged   QEMU_HARDDISK 4 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb5.device                 loaded active plugged   QEMU_HARDDISK redhat.ittraining.loc 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb6.device                 loaded active plugged   QEMU_HARDDISK 6 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb7.device                 loaded active plugged   QEMU_HARDDISK 7 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb8.device                 loaded active plugged   QEMU_HARDDISK redhat.ittraining.loc 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb9.device                 loaded active plugged   QEMU_HARDDISK 9 
 +  sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb.device                      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:07.0-ata4-host4-target4:0:0-4:0:0:0-block-sdc.device                      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:07.0-ata5-host5-target5:0:0-5:0:0:0-block-sdd.device                      loaded active plugged   QEMU_HARDDISK 
 +  sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device                                             loaded active plugged   Virtio network device 
 +  sys-devices-platform-serial8250-tty-ttyS0.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS0 
 +  sys-devices-platform-serial8250-tty-ttyS1.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS1 
 +  sys-devices-platform-serial8250-tty-ttyS2.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS2 
 +  sys-devices-platform-serial8250-tty-ttyS3.device                                                         loaded active plugged   /sys/devices/platform/serial8250/tty/ttyS3 
 +  sys-devices-virtual-block-dm\x2d0.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-0 
 +  sys-devices-virtual-block-dm\x2d1.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-1 
 +  sys-devices-virtual-block-dm\x2d2.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-2 
 +  sys-devices-virtual-block-dm\x2d3.device                                                                 loaded active plugged   /sys/devices/virtual/block/dm-3 
 +  sys-devices-virtual-block-md1.device                                                                     loaded active plugged   /sys/devices/virtual/block/md1 
 +  sys-devices-virtual-misc-rfkill.device                                                                   loaded active plugged   /sys/devices/virtual/misc/rfkill 
 +  sys-module-configfs.device                                                                               loaded active plugged   /sys/module/configfs 
 +  sys-module-fuse.device                                                                                   loaded active plugged   /sys/module/fuse 
 +  sys-subsystem-net-devices-ens18.device                                                                   loaded active plugged   Virtio network device                                                         
 +  -.mount                                                                                                  loaded active mounted   Root Mount 
 +  boot.mount                                                                                               loaded active mounted   /boot 
 +  dev-hugepages.mount                                                                                      loaded active mounted   Huge Pages File System 
 +  dev-mqueue.mount                                                                                         loaded active mounted   POSIX Message Queue File System 
 +  run-credentials-systemd\x2dsysctl.service.mount                                                          loaded active mounted   /run/credentials/systemd-sysctl.service 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount                                               loaded active mounted   /run/credentials/systemd-tmpfiles-setup.service 
 +  run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount                                        loaded active mounted   /run/credentials/systemd-tmpfiles-setup-dev.service 
 +  run-user-1000.mount                                                                                      loaded active mounted   /run/user/1000 
 +  run-user-42.mount                                                                                        loaded active mounted   /run/user/42 
 +  sys-fs-fuse-connections.mount                                                                            loaded active mounted   FUSE Control File System 
 +  sys-kernel-config.mount                                                                                  loaded active mounted   Kernel Configuration File System 
 +  sys-kernel-debug.mount                                                                                   loaded active mounted   Kernel Debug File System 
 +  sys-kernel-tracing.mount                                                                                 loaded active mounted   Kernel Trace File System                                                      
 +  cups.path                                                                                                loaded active running   CUPS Scheduler 
 +  systemd-ask-password-wall.path                                                                           loaded active running   Forward Password Requests to Wall Directory Watch                             
 +  init.scope                                                                                               loaded active running   System and Service Manager 
 +  session-4.scope                                                                                          loaded active running   Session 4 of User trainee 
 +  session-c1.scope                                                                                         loaded active running   Session c1 of User gdm                                                        
 +  accounts-daemon.service                                                                                  loaded active running   Accounts Service 
 +  atd.service                                                                                              loaded active running   Deferred execution scheduler 
 +lines 1-55
 </code> </code>
  
-Pour faire l'inverse il convient de saisir la commande suivante :+Pour consulter la liste des Unités inactifs, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# lvchange -a y /dev/vg0/lv1+[root@redhat9 tmp]# systemctl list-units --all | grep inactive | more 
 +● boot.automount                                                                                                 not-found inactive dead      boot.automount 
 +  dev-mapper-sdb12.device                                                                                        loaded    inactive dead      /dev/mapper/sdb12 
 +● home.mount                                                                                                     not-found inactive dead      home.mount 
 +  mnt-sdb12.mount                                                                                                loaded    inactive dead      /mnt/sdb12 
 +  proc-sys-fs-binfmt_misc.mount                                                                                  loaded    inactive dead      Arbitrary Executable File Formats File System 
 +● sysroot.mount                                                                                                  not-found inactive dead      sysroot.mount 
 +  tmp.mount                                                                                                      loaded    inactive dead      Temporary Directory /tmp 
 +● var.mount                                                                                                      not-found inactive dead      var.mount 
 +  systemd-ask-password-console.path                                                                              loaded    inactive dead      Dispatch Password Requests to Console Directory Watch 
 +  systemd-ask-password-plymouth.path                                                                             loaded    inactive dead      Forward Password Requests to Plymouth Directory Watch 
 +  alsa-restore.service                                                                                           loaded    inactive dead      Save/Restore Sound Card State 
 +  alsa-state.service                                                                                             loaded    inactive dead      Manage Sound Card State (restore and store) 
 +● auto-cpufreq.service                                                                                           not-found inactive dead      auto-cpufreq.service 
 +● autofs.service                                                                                                 not-found inactive dead      autofs.service 
 +  blk-availability.service                                                                                       loaded    inactive dead      Availability of block devices 
 +  cpupower.service                                                                                               loaded    inactive dead      Configure CPU power related settings 
 +  dm-event.service                                                                                               loaded    inactive dead      Device-mapper event daemon 
 +  dnf-makecache.service                                                                                          loaded    inactive dead      dnf makecache 
 +  dracut-cmdline.service                                                                                         loaded    inactive dead      dracut cmdline hook 
 +  dracut-initqueue.service                                                                                       loaded    inactive dead      dracut initqueue hook 
 +  dracut-mount.service                                                                                           loaded    inactive dead      dracut mount hook 
 +  dracut-pre-mount.service                                                                                       loaded    inactive dead      dracut pre-mount hook 
 +  dracut-pre-pivot.service                                                                                       loaded    inactive dead      dracut pre-pivot and cleanup hook 
 +  dracut-pre-trigger.service                                                                                     loaded    inactive dead      dracut pre-trigger hook 
 +  dracut-pre-udev.service                                                                                        loaded    inactive dead      dracut pre-udev hook 
 +  dracut-shutdown-onfailure.service                                                                              loaded    inactive dead      Service executing upon dracut-shutdown failure to perform cleanup 
 +● ebtables.service                                                                                               not-found inactive dead      ebtables.service 
 +  emergency.service                                                                                              loaded    inactive dead      Emergency Shell 
 +● fcoe.service                                                                                                   not-found inactive dead      fcoe.service 
 +  getty@tty1.service                                                                                             loaded    inactive dead      Getty on tty1 
 +● httpd-init.service                                                                                             not-found inactive dead      httpd-init.service 
 +  initrd-cleanup.service                                                                                         loaded    inactive dead      Cleaning Up and Shutting Down Daemons 
 +  initrd-parse-etc.service                                                                                       loaded    inactive dead      Mountpoints Configured in the Real Root 
 +  initrd-switch-root.service                                                                                     loaded    inactive dead      Switch Root 
 +  initrd-udevadm-cleanup-db.service                                                                              loaded    inactive dead      Cleanup udev Database 
 +  insights-client-boot.service                                                                                   loaded    inactive dead      Run Insights Client at boot 
 +● ip6tables.service                                                                                              not-found inactive dead      ip6tables.service 
 +● ipset.service                                                                                                  not-found inactive dead      ipset.service 
 +● iptables.service                                                                                               not-found inactive dead      iptables.service 
 +  iscsi-init.service                                                                                             loaded    inactive dead      One time configuration for iscsi.service 
 +  iscsi-onboot.service                                                                                           loaded    inactive dead      Special handling of early boot iSCSI sessions 
 +  iscsi-shutdown.service                                                                                         loaded    inactive dead      Logout off all iSCSI sessions on shutdown 
 +  iscsi-starter.service                                                                                          loaded    inactive dead      iscsi-starter.service 
 +  iscsid.service                                                                                                 loaded    inactive dead      Open-iSCSI 
 +  iscsiuio.service                                                                                               loaded    inactive dead      iSCSI UserSpace I/O driver 
 +  ldconfig.service                                                                                               loaded    inactive dead      Rebuild Dynamic Linker Cache 
 +  logrotate.service                                                                                              loaded    inactive dead      Rotate log files 
 +  low-memory-monitor.service                                                                                     loaded    inactive dead      Low Memory Monitor 
 +● lvm2-activation-early.service                                                                                  not-found inactive dead      lvm2-activation-early.service 
 +  lvm2-lvmpolld.service                                                                                          loaded    inactive dead      LVM2 poll daemon 
 +  mdadm-last-resort@md1.service                                                                                  loaded    inactive dead      Activate md array md1 even though degraded 
 +  microcode.service                                                                                              loaded    inactive dead      Load CPU microcode update 
 +  mlocate-updatedb.service                                                                                       loaded    inactive dead      Update a database for mlocate 
 +  modprobe@configfs.service                                                                                      loaded    inactive dead      Load Kernel Module configfs 
 +  modprobe@drm.service                                                                                           loaded    inactive dead      Load Kernel Module drm 
 +--More--
 </code> </code>
  
-Les options de la commande **lvchange** sont :+Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité des points blancs à l'écran. Ces points impliquent que le service, la cible ou l'unité spécifié n'a pas été trouvé sur le système. Par exemple :
  
 <code> <code>
-[root@centos8 ~]# lvchange --help +[root@redhat9 tmp]# systemctl status ip6tables 
-  lvchange - Change the attributes of logical volume(s) +Unit ip6tables.service could not be found.
- +
-  Change a general LV attribute +
-  For options listed in parentheses, any one is  +
-  required, after which the others are optional. +
-  lvchange +
- ( -C|--contiguous y|n, +
-   -p|--permission rw|r, +
-   -r|--readahead auto|none|Number, +
-   -k|--setactivationskip y|n, +
-   -Z|--zero y|n, +
-   -M|--persistent n, +
-      --addtag Tag, +
-      --deltag Tag, +
-      --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit, +
-      --compression y|n, +
-      --deduplication y|n, +
-      --detachprofile, +
-      --metadataprofile String, +
-      --profile String, +
-      --errorwhenfull y|n, +
-      --discards passdown|nopassdown|ignore, +
-      --cachemode writethrough|writeback|passthrough, +
-      --cachepolicy String, +
-      --cachesettings String, +
-      --minrecoveryrate Size[k|UNIT], +
-      --maxrecoveryrate Size[k|UNIT], +
-      --writebehind Number, +
-      --writemostly PV[:t|n|y] ) +
- VG|LV|Tag|Select ... +
- [ -a|--activate y|n|ay ] +
- [    --poll y|n ] +
- [    --monitor y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Resyncronize a mirror or raid LV.  +
-  Use to reset 'R' attribute on a not initially synchronized LV. +
-  lvchange --resync VG|LV_mirror_raid|Tag|Select ... +
- [ -a|--activate y|n|ay ] +
- [ COMMON_OPTIONS ] +
- +
-  Resynchronize or check a raid LV. +
-  lvchange --syncaction check|repair VG|LV_raid|Tag|Select ... +
- [ COMMON_OPTIONS ] +
- +
-  Reconstruct data on specific PVs of a raid LV. +
-  lvchange --rebuild PV VG|LV_raid|Tag|Select ... +
- [ COMMON_OPTIONS ] +
- +
-  Activate or deactivate an LV. +
-  lvchange -a|--activate y|n|ay VG|LV|Tag|Select ... +
- [ -P|--partial ] +
- [ -K|--ignoreactivationskip ] +
- [    --activationmode partial|degraded|complete ] +
- [    --poll y|n ] +
- [    --monitor y|n ] +
- [    --ignorelockingfailure ] +
- [    --sysinit ] +
- [    --readonly ] +
- [ COMMON_OPTIONS ] +
- +
-  Reactivate an LV using the latest metadata. +
-  lvchange --refresh VG|LV|Tag|Select ... +
- [ -P|--partial ] +
- [    --activationmode partial|degraded|complete ] +
- [    --poll y|n ] +
- [    --monitor y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Start or stop monitoring an LV from dmeventd. +
-  lvchange --monitor y|n VG|LV|Tag|Select ... +
- [ COMMON_OPTIONS ] +
- +
-  Start or stop processing an LV conversion. +
-  lvchange --poll y|n VG|LV|Tag|Select ... +
- [    --monitor y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Make the minor device number persistent for an LV. +
-  lvchange -M|--persistent y --minor Number LV +
- [ -j|--major Number ] +
- [ -a|--activate y|n|ay ] +
- [    --poll y|n ] +
- [    --monitor y|n ] +
- [ COMMON_OPTIONS ] +
- +
-  Common options for command: +
- [ -A|--autobackup y|n ] +
- [ -f|--force ] +
- [ -S|--select String ] +
- [    --ignoremonitoring ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- +
-  Common options for lvm: +
- [ -d|--debug ] +
- [ -h|--help ] +
- [ -q|--quiet ] +
- [ -v|--verbose ] +
- [ -y|--yes ] +
- [ -t|--test ] +
- [    --commandprofile String ] +
- [    --config String ] +
- [    --driverloaded y|n ] +
- [    --nolocking ] +
- [    --lockopt String ] +
- [    --longhelp ] +
- [    --profile String ] +
- [    --version ] +
- +
-  Use --longhelp to show all options and advanced commands.+
 </code> </code>
  
-====LAB #9 - Volumes Logiques en Bandes==== +Pour consulter la liste des Unités ainsi que leurs statutsutilisez la commande suivante :
- +
-Un volume logique en bandes est créé pour augmenter, comme dans le cas du RAID, les performances des entrées et sorties. Pour créer ce volume, la commande **lvcreate** prend deux option supplémentaires : +
- +
-  * **-i** - indique le nombre de volumes de bandes, +
-  * **-I** - indique la taille en Ko de chaque bande. +
- +
-Saisissez donc la commande suivante :+
  
 <code> <code>
-[root@centos8 ~]# lvcreate -i2 -I64 -n lv2 -L 100M vg0 /dev/sdb7 /dev/sdb9 +[root@redhat9 tmp]# systemctl list-unit-files | more 
-  Rounding up size to full physical extent 104.00 MiB +UNIT FILE                                  STATE           PRESET 
-  Rounding size 104.00 MiB (13 extents) up to stripe boundary size 112.00 MiB(14 extents)+proc-sys-fs-binfmt_misc.automount          static          - 
-  Logical volume "lv2" created.+-.mount                                    generated       - 
 +boot.mount                                 generated       - 
 +dev-hugepages.mount                        static          - 
 +dev-mqueue.mount                           static          - 
 +mnt-sdb12.mount                            generated       - 
 +proc-sys-fs-binfmt_misc.mount              disabled        disabled 
 +run-vmblock\x2dfuse.mount                  disabled        disabled 
 +sys-fs-fuse-connections.mount              static          - 
 +sys-kernel-config.mount                    static          - 
 +sys-kernel-debug.mount                     static          - 
 +sys-kernel-tracing.mount                   static          - 
 +tmp.mount                                  disabled        disabled 
 +cups.path                                  enabled         enabled 
 +insights-client-results.path               disabled        disabled 
 +ostree-finalize-staged.path                disabled        disabled 
 +systemd-ask-password-console.path          static          - 
 +systemd-ask-password-plymouth.path         static          - 
 +systemd-ask-password-wall.path             static          - 
 +session-4.scope                            transient       - 
 +session-c1.scope                           transient       - 
 +accounts-daemon.service                    enabled         enabled 
 +alsa-restore.service                       static          - 
 +alsa-state.service                         static          - 
 +arp-ethers.service                         disabled        disabled 
 +atd.service                                enabled         enabled 
 +auditd.service                             enabled         enabled 
 +autovt@.service                            alias           - 
 +avahi-daemon.service                       enabled         enabled 
 +bar.service                                enabled         disabled 
 +blk-availability.service                   disabled        disabled 
 +bluetooth.service                          enabled         enabled 
 +bolt.service                               static          - 
 +brltty.service                             disabled        disabled 
 +canberra-system-bootup.service             disabled        disabled 
 +canberra-system-shutdown-reboot.service    disabled        disabled 
 +canberra-system-shutdown.service           disabled        disabled 
 +chrony-wait.service                        disabled        disabled 
 +chronyd-restricted.service                 disabled        disabled 
 +chronyd.service                            disabled        enabled 
 +cni-dhcp.service                           disabled        disabled 
 +cockpit-motd.service                       static          - 
 +cockpit-wsinstance-http.service            static          - 
 +cockpit-wsinstance-https-factory@.service  static          - 
 +cockpit-wsinstance-https@.service          static          - 
 +cockpit.service                            static          - 
 +colord.service                             static          - 
 +configure-printer@.service                 static          - 
 +console-getty.service                      disabled        disabled 
 +container-getty@.service                   static          - 
 +cpupower.service                           disabled        disabled 
 +crond.service                              enabled         enabled 
 +cups-browsed.service                       disabled        disabled 
 +cups.service                               enabled         enabled 
 +--More--
 </code> </code>
  
-Constatez la présence de vos bandes sur /dev/sda7 et sur /dev/sda9 :+Pour visualiser les Unités d'un type spécifique, il convient d'utiliser l'option **-t** :
  
 <code> <code>
-[root@centos8 ~]# lvdisplay -m /dev/vg0/lv2 +[root@redhat9 tmp]# systemctl list-unit-files -t mount 
-  --- Logical volume --- +UNIT FILE                     STATE     PRESET   
-  LV Path                /dev/vg0/lv2 +-.mount                       generated        
-  LV Name                lv2 +boot.mount                    generated        
-  VG Name                vg0 +dev-hugepages.mount           static           
-  LV UUID                MmXbPt-ZF8u-rnIv-3YU9-m64J-RCz2-6NzAuG +dev-mqueue.mount              static           
-  LV Write Access        read/write +mnt-sdb12.mount               generated        
-  LV Creation host, time centos8.ittraining.loc, 2021-06-02 07:47:38 -0400 +proc-sys-fs-binfmt_misc.mount disabled  disabled 
-  LV Status              available +run-vmblock\x2dfuse.mount     disabled  disabled 
-  # open                 0 +sys-fs-fuse-connections.mount static           
-  LV Size                112.00 MiB +sys-kernel-config.mount       static    -        
-  Current LE             14 +sys-kernel-debug.mount        static    -        
-  Segments               1 +sys-kernel-tracing.mount      static    -        
-  Allocation             inherit +tmp.mount                     disabled  disabled
-  Read ahead sectors     auto +
-  currently set to     8192 +
-  Block device           253:1 +
-    +
-  --- Segments --- +
-  Logical extents 0 to 13: +
-    Type striped +
-    Stripes 2 +
-    Stripe size 64.00 KiB +
-    Stripe 0: +
-      Physical volume /dev/sdb7 +
-      Physical extents 0 to 6 +
-    Stripe 1: +
-      Physical volume /dev/sdb9 +
-      Physical extents 0 to 6+
  
 +12 unit files listed.
 </code> </code>
  
-Utilisez maintenant la commande **lvs** pour visualiser les volumes physiques utilisés par le volume logique :+Dans la colonne STATE on voit les mots **static** et **generated**. 
  
-<code> +  * STATE = static 
-[root@centos8 ~]# lvs -o +devices +    * Ceci implique que l'Unité ne peut ni être démarrée, ni être arrêtée par l'administrateurLe démarrage et l'arrêt d'une telle Unité est effectué par le systèmeEn règle généraleles Unités dont le STATE est static sont des dépendances d'autres Unité
-  LV   VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices                   +
-  root cl_centos8 -wi-ao----  27.79g                                                     /dev/sda2(820)            +
-  swap cl_centos8 -wi-ao----   3.20g                                                     /dev/sda2(0)              +
-  lv1  vg0        -wi-a----- 104.00m                                                     /dev/sdb6(1)              +
-  lv2  vg0        -wi-a----- 112.00m                                                     /dev/sdb7(0),/dev/sdb9(0) +
-</code>+
  
-====LAB #10 - Gérer les Métadonnées==== +  * STATE generated 
- +    * Ceci implique que le fichier a été généré automatiquement en utilisant les informations dans le fichier **/etc/fstab** lors du démarrage du système. Dans le cas d'un point de montage, l'exécutable respopnsable de la génération du fichier est **/lib/systemd/system-generators/systemd-fstab-generator** :
-Les métadonnées pour chaque Volume Group sont stockés dans un fichier texte au nom du Volume Group dans le répertoire **/etc/lvm/backup** :+
  
 <code> <code>
-[root@centos8 ~]# cat /etc/lvm/backup/vg0 +[root@redhat9 tmp]# ls -l /lib/systemd/system-generators/systemd-fstab-generator 
-# Generated by LVM2 version 2.03.09(2)-RHEL8 (2020-05-28): Wed Jun  2 07:47:38 2021 +-rwxr-xr-x1 root root 57696 Jul 18 13:01 /lib/systemd/system-generators/systemd-fstab-generator
- +
-contents = "Text Format Volume Group" +
-version = 1 +
- +
-description = "Created *after* executing 'lvcreate -i2 -I64 -n lv2 -L 100M vg0 /dev/sdb7 /dev/sdb9'" +
- +
-creation_host = "centos8.ittraining.loc" # Linux centos8.ittraining.loc 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Apr 8 19:01:30 UTC 2021 x86_64 +
-creation_time = 1622634458 # Wed Jun  2 07:47:38 2021 +
- +
-vg0 { +
- id = "TDXUip-c3yg-J83l-Z30x-zcsJ-Rbvl-gjFvfd" +
- seqno = 11 +
- format = "lvm2" # informational +
- status = ["RESIZEABLE", "READ", "WRITE"+
- flags = [] +
- extent_size = 16384 # 8 Megabytes +
- max_lv = 0 +
- max_pv = 0 +
- metadata_copies = 0 +
- +
- physical_volumes { +
- +
- pv0 { +
- id = "lxuKRI-l3Dd-jhsv-OWtw-au2c-0ti0-XGnt1E" +
- device = "/dev/sdb6" # Hint only +
- +
- status = ["ALLOCATABLE"+
- flags = [] +
- dev_size = 409600 # 200 Megabytes +
- pe_start = 2048 +
- pe_count = 24 # 192 Megabytes +
-+
- +
- pv1 { +
- id = "QDmfcX-Pv8o-hapq-TJOI-RaPH-qecT-VUMY4v" +
- device = "/dev/sdb7" # Hint only +
- +
- status = ["ALLOCATABLE"+
- flags = [] +
- dev_size = 614400 # 300 Megabytes +
- pe_start = 2048 +
- pe_count = 37 # 296 Megabytes +
-+
- +
- pv2 { +
- id = "ZTQV1b-Ha76-BQtB-zJEU-kfyK-ausJ-CxnRwg" +
- device = "/dev/sdb9" # Hint only +
- +
- status = ["ALLOCATABLE"+
- flags = [] +
- dev_size = 819200 # 400 Megabytes +
- pe_start = 2048 +
- pe_count = 49 # 392 Megabytes +
-+
-+
- +
- logical_volumes { +
- +
- lv1 { +
- id = "lJQQWs-n05T-pxzi-Zq2R-UzRI-kYZf-hsNPYQ" +
- status = ["READ", "WRITE", "VISIBLE"+
- flags = [] +
- creation_time = 1622633848 # 2021-06-02 07:37:28 -0400 +
- creation_host = "centos8.ittraining.loc" +
- segment_count = 1 +
- +
- segment1 { +
- start_extent = 0 +
- extent_count = 13 # 104 Megabytes +
- +
- type = "striped" +
- stripe_count = 1 # linear +
- +
- stripes = [ +
- "pv0",+
-+
-+
-+
- +
- lv2 { +
- id = "MmXbPt-ZF8u-rnIv-3YU9-m64J-RCz2-6NzAuG" +
- status = ["READ", "WRITE", "VISIBLE"+
- flags = [] +
- creation_time = 1622634458 # 2021-06-02 07:47:38 -0400 +
- creation_host = "centos8.ittraining.loc" +
- segment_count = 1 +
- +
- segment1 { +
- start_extent = 0 +
- extent_count = 14 # 112 Megabytes +
- +
- type = "striped" +
- stripe_count = 2 +
- stripe_size = 128 # 64 Kilobytes +
- +
- stripes = [ +
- "pv1", 0, +
- "pv2",+
-+
-+
-+
-+
- +
-}+
 </code> </code>
  
-Des archives sont créées lors de chaque modification d'un groupe de volumes et elles sont placés dans le répertoire **/etc/lvm/archives** :+Il existe aussi d'autres exécutables responsables de la génération d'autres fichiers :
  
 <code> <code>
-[root@centos8 ~]# ls /etc/lvm/archive+[root@redhat9 tmp]# ls -l /lib/systemd/system-generators 
-vg0_00000-427117660.vg   vg0_00002-2064899457.vg  vg0_00004-5061041.vg    vg0_00006-1956284179.vg  vg0_00008-708301076.vg   vg0_00010-1200598227.vg  vg0_00012-854342401.vg +total 396 
-vg0_00001-1993147316.vg  vg0_00003-1757437978.vg  vg0_00005-116946854.vg  vg0_00007-1006758937.vg  vg0_00009-1054420117.vg  vg0_00011-973084311.vg+-rwxr-xr-x1 root root   541 Jul 24 06:08 kdump-dep-generator.sh 
 +-rwxr-xr-x1 root root 15832 May 17 18:27 ostree-system-generator 
 +lrwxrwxrwx1 root root    31 Aug  8 10:54 podman-system-generator -> ../../../libexec/podman/quadlet 
 +-rwxr-xr-x1 root root  1005 Feb 19  2024 selinux-autorelabel-generator.sh 
 +-rwxr-xr-x1 root root 15624 Jul 18 13:01 systemd-bless-boot-generator 
 +-rwxr-xr-x1 root root 40920 Jul 18 13:01 systemd-cryptsetup-generator 
 +-rwxr-xr-x1 root root 24312 Jul 18 13:01 systemd-debug-generator 
 +-rwxr-xr-x1 root root 57696 Jul 18 13:01 systemd-fstab-generator 
 +-rwxr-xr-x1 root root 24096 Jul 18 13:01 systemd-getty-generator 
 +-rwxr-xr-x1 root root 36496 Jul 18 13:01 systemd-gpt-auto-generator 
 +-rwxr-xr-x. 1 root root 16096 Jul 18 13:01 systemd-hibernate-resume-generator 
 +-rwxr-xr-x. 1 root root 24240 Jul 18 13:01 systemd-integritysetup-generator 
 +-rwxr-xr-x. 1 root root 15632 Jul 18 13:01 systemd-rc-local-generator 
 +-rwxr-xr-x. 1 root root 24296 Jul 18 13:01 systemd-run-generator 
 +-rwxr-xr-x. 1 root root 15824 Jul 18 13:01 systemd-system-update-generator 
 +-rwxr-xr-x. 1 root root 36424 Jul 18 13:01 systemd-sysv-generator 
 +-rwxr-xr-x. 1 root root 36872 Jul 18 13:01 systemd-veritysetup-generator
 </code> </code>
  
-La commande **vgcfgbackup** est utilisée pour sauvegarder les métadonnées manuellement dans le fichier **/etc/lvm/backup/nom_du_volume_group** : +Les options de la commande **systemctl** sont :
- +
-La commande **vgcfgrestore** permet de restaurer une sauvegarde. Sans l'option **-f** pour spécifier la sauvegarde à restaurer, cette commande renvoie la liste des sauvegardes disponibles :+
  
 <code> <code>
-[root@centos8 ~]# vgcfgbackup vg0 +[root@redhat9 tmp]# systemctl --help 
-  Volume group "vg0" successfully backed up. +systemctl [OPTIONS...] COMMAND ...
-</code>+
  
-Il est aussi possible de modifier l'emplacement de la sauvegarde avec l'option **-f** de la commande :+Query or send control commands to the system manager.
  
-<code> +Unit Commands: 
-[root@centos8 ~]# vgcfgbackup -/tmp/vg0_backup vg0 +  list-units [PATTERN...            List units currently in memory 
-  Volume group "vg0" successfully backed up.+  list-automounts [PATTERN...]        List automount units currently in memory, 
 +                                      ordered by path 
 +  list-sockets [PATTERN...]           List socket units currently in memory, 
 +                                      ordered by address 
 +  list-timers [PATTERN...]            List timer units currently in memory, 
 +                                      ordered by next elapse 
 +  is-active PATTERN...                Check whether units are active 
 +  is-failed PATTERN...                Check whether units are failed 
 +  status [PATTERN...|PID...]          Show runtime status of one or more units 
 +  show [PATTERN...|JOB...]            Show properties of one or more 
 +                                      units/jobs or the manager 
 +  cat PATTERN...                      Show files and drop-ins of specified units 
 +  help PATTERN...|PID...              Show manual for one or more units 
 +  list-dependencies [UNIT...]         Recursively show units which are required 
 +                                      or wanted by the units or by which those 
 +                                      units are required or wanted 
 +  start UNIT...                       Start (activate) one or more units 
 +  stop UNIT...                        Stop (deactivate) one or more units 
 +  reload UNIT...                      Reload one or more units 
 +  restart UNIT...                     Start or restart one or more units 
 +  try-restart UNIT...                 Restart one or more units if active 
 +  reload-or-restart UNIT...           Reload one or more units if possible, 
 +                                      otherwise start or restart 
 +  try-reload-or-restart UNIT...       If active, reload one or more units, 
 +                                      if supported, otherwise restart 
 +  isolate UNIT                        Start one unit and stop all others 
 +  kill UNIT...                        Send signal to processes of a unit 
 +  clean UNIT...                       Clean runtime, cache, state, logs or 
 +                                      configuration of unit 
 +  freeze PATTERN...                   Freeze execution of unit processes 
 +  thaw PATTERN...                     Resume execution of a frozen unit 
 +  set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit 
 +  bind UNIT PATH [PATH]               Bind-mount a path from the host into a 
 +                                      unit's namespace 
 +  mount-image UNIT PATH [PATH [OPTS]] Mount an image from the host into a 
 +                                      unit's namespace 
 +  service-log-level SERVICE [LEVEL]   Get/set logging threshold for service 
 +  service-log-target SERVICE [TARGET] Get/set logging target for service 
 +  reset-failed [PATTERN...]           Reset failed state for all, one, or more 
 +                                      units 
 +Unit File Commands: 
 +  list-unit-files [PATTERN...]        List installed unit files 
 +  enable [UNIT...|PATH...]            Enable one or more unit files 
 +  disable UNIT...                     Disable one or more unit files 
 +  reenable UNIT...                    Reenable one or more unit files 
 +  preset UNIT...                      Enable/disable one or more unit files 
 +                                      based on preset configuration 
 +  preset-all                          Enable/disable all unit files based on 
 +                                      preset configuration 
 +lines 1-55
 </code> </code>
  
-Par contre, toute sauvegarde en dehors des répertoires par défaut n'est pas visible dans la sortie de la commande **vgcfgrestore --list** :+====LAB #2 - Fichiers de Configuration====
  
-<code> +===2.Fichiers de Configuration par Défaut===
-[root@centos8 ~]# vgcfgrestore --list vg0 +
-    +
-  File: /etc/lvm/archive/vg0_00000-427117660.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9' +
-  Backup Time: Wed May 26 10:43:14 2021+
  
-    +Les fichiers de configuration des Cibles et fichiers de configuration des Unités installés par des paquets se trouvent dans le répertoire **/usr/lib/systemd/system** :
-  File: /etc/lvm/archive/vg0_00001-1993147316.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvcreate -L 350 -n lv0 vg0' +
-  Backup Time: Wed May 26 16:56:31 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00002-2064899457.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvextend -L +100M /dev/vg0/lv0' +
-  Backup Time: Wed May 26 22:12:15 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00003-1757437978.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvcreate -s -L 13M -n testsnap /dev/vg0/lv0' +
-  Backup Time: Wed May 26 22:19:25 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00004-5061041.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvremove /dev/vg0/testsnap' +
-  Backup Time: Wed May 26 22:38:37 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00005-116946854.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvremove /dev/vg0/lv0' +
-  Backup Time: Wed May 26 22:42:18 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00006-1956284179.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'vgremove vg0' +
-  Backup Time: Wed May 26 22:43:49 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00007-1006758937.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9' +
-  Backup Time: Wed Jun  2 07:37:07 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00008-708301076.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvcreate -m 1 -L 100M -n lv1 vg0' +
-  Backup Time: Wed Jun  2 07:37:28 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00009-1054420117.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7' +
-  Backup Time: Wed Jun  2 07:41:04 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00010-1200598227.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvconvert -m 1 /dev/vg0/lv1' +
-  Backup Time: Wed Jun  2 07:41:53 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00011-973084311.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7' +
-  Backup Time: Wed Jun  2 07:42:23 2021 +
- +
-    +
-  File: /etc/lvm/archive/vg0_00012-854342401.vg +
-  VG name:    vg0 +
-  Description: Created *before* executing 'lvcreate -i2 -I64 -n lv2 -L 100M vg0 /dev/sdb7 /dev/sdb9' +
-  Backup Time: Wed Jun  2 07:47:38 2021 +
- +
-    +
-  File: /etc/lvm/backup/vg0 +
-  VG name:    vg0 +
-  Description: Created *after* executing 'vgcfgbackup vg0' +
-  Backup Time: Wed Jun  2 07:50:57 2021 +
-</code> +
- +
-=====Systèmes de Fichiers Journalisés===== +
- +
-====Présentation==== +
- +
-Un journal est la partie d'un système de fichiers journalisé qui trace les opérations d'écriture tant qu'elles ne sont pas terminées et cela en vue de garantir l'intégrité des données en cas d'arrêt brutal. +
- +
-L'intérêt est de pouvoir plus facilement et plus rapidement récupérer les données en cas d'arrêt brutal du système d'exploitation (coupure d'alimentation, plantage du système, etc.), alors que les partitions n'ont pas été correctement synchronisées et démontées. +
- +
-Sans un tel fichier journal, un outil de récupération de données après un arrêt brutal doit parcourir l'intégralité du système de fichier pour vérifier sa cohérence. Lorsque la taille du système de fichiers est importante, cela peut durer très longtemps pour un résultat moins efficace car entraînant des pertes de données. +
- +
-Linux peut utiliser un des systèmes de fichiers journalisés suivants : +
- +
-^ Système de fichier ^ Taille maximum - fichier ^ Taille maximum - système de fichier ^ +
-| **[[http://en.wikipedia.org/wiki/Ext3|Ext3]]** | 2 [[http://fr.wikipedia.org/wiki/Octet|To]] | 32 [[http://fr.wikipedia.org/wiki/Octet|To]] | +
-| **[[http://fr.wikipedia.org/wiki/Ext4|Ext4]]** | 16 [[http://fr.wikipedia.org/wiki/Octet|To]] | 1 [[http://fr.wikipedia.org/wiki/Exbibyte|EiB]] | +
-| **[[http://en.wikipedia.org/wiki/XFS|XFS]]** | 8 [[http://fr.wikipedia.org/wiki/Exbibyte|EiB]] | 16 [[http://fr.wikipedia.org/wiki/Exbibyte|EiB]] | +
-| **[[http://en.wikipedia.org/wiki/ReiserFS|ReiserFS v3]]** | 8 [[http://fr.wikipedia.org/wiki/Octet|To]] | 16 [[http://fr.wikipedia.org/wiki/Octet|To]] | +
-| **[[http://en.wikipedia.org/wiki/JFS_(file_system)|JFS]]** | 4 [[http://fr.wikipedia.org/wiki/Octet|Po]] | 32 [[http://fr.wikipedia.org/wiki/Octet|Po]] | +
-| **[[https://fr.wikipedia.org/wiki/Btrfs|Btrfs]]** | 16 [[http://fr.wikipedia.org/wiki/Exbibyte|EiB]] | 16 [[http://fr.wikipedia.org/wiki/Exbibyte|EiB]] | +
- +
-<WRAP center round todo 60%> +
-**A faire** : Pour comparer ces six systèmes de fichier, veuillez consulter **[[http://en.wikipedia.org/wiki/Comparison_of_file_systems|cette page]]** +
-</WRAP> +
- +
-====Ext3==== +
- +
-Ext3 est une évolution de Ext2 et a pour principale différence d'utiliser un fichier journal. Il peut : +
- +
-  * être utilisé à partir d'une partition Ext2, sans avoir à sauvegarder et à restaurer des données, +
-  * utiliser tous les utilitaires de maintenance pour les systèmes de fichiers ext2, comme fsck, +
-  * utiliser le logiciel dump, ce qui n'est pas le cas avec %%ReiserFS%%. +
- +
-Pour plus d'information concernant Ext3, consultez **[[http://en.wikipedia.org/wiki/Ext3|cette page]]** +
- +
-===Gestion d'Ext3=== +
- +
-Notez maintenant le numéro de la dernière partition que vous avez précédemment créée :+
  
 <code> <code>
-[root@centos8 ~]# fdisk -+[root@redhat9 tmp]# pkg-config systemd --variable=systemdsystemunitdir 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors +/usr/lib/systemd/system
-Units: sectors of 1 * 512 = 512 bytes +
-Sector size (logical/physical): 512 bytes / 512 bytes +
-I/O size (minimum/optimal): 512 bytes / 512 bytes +
-Disklabel type: dos +
-Disk identifier: 0xb0dacb39 +
- +
-Device     Boot   Start     End Sectors  Size Id Type +
-/dev/sdb1          2048  206847  204800  100M 83 Linux +
-/dev/sdb2        206848  411647  204800  100M 83 Linux +
-/dev/sdb3        411648  616447  204800  100M 83 Linux +
-/dev/sdb4        616448 8388607 7772160  3.7G  5 Extended +
-/dev/sdb5        618496 1642495 1024000  500M fd Linux raid autodetect +
-/dev/sdb6       1644544 2054143  409600  200M 8e Linux LVM +
-/dev/sdb7       2056192 2670591  614400  300M 8e Linux LVM +
-/dev/sdb8       2672640 3696639 1024000  500M fd Linux raid autodetect +
-/dev/sdb9       3698688 4517887  819200  400M 8e Linux LVM +
-/dev/sdb10      4519936 5543935 1024000  500M fd Linux raid autodetect +
-/dev/sdb11      5545984 6569983 1024000  500M fd Linux raid autodetect +
-/dev/sdb12      6572032 6981631  409600  200M 83 Linux +
- +
- +
-Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors +
-Units: sectors of 1 * 512 = 512 bytes +
-Sector size (logical/physical): 512 bytes / 512 bytes +
-I/O size (minimum/optimal): 512 bytes / 512 bytes +
-Disklabel type: dos +
-Disk identifier: 0x70b17285 +
- +
-Device     Boot   Start      End  Sectors  Size Id Type +
-/dev/sda1  *       2048   616447   614400  300M 83 Linux +
-/dev/sda2        616448  4712447  4096000    2G 82 Linux swap / Solaris +
-/dev/sda3       4712448 35432447 30720000 14.7G 83 Linux +
- +
- +
- +
- +
-Disk /dev/mapper/vg0-lv1: 104 MiB, 109051904 bytes, 212992 sectors +
-Units: sectors of 1 * 512 = 512 bytes +
-Sector size (logical/physical): 512 bytes / 512 bytes +
-I/O size (minimum/optimal): 512 bytes / 512 bytes +
- +
- +
-Disk /dev/mapper/vg0-lv2: 112 MiB, 117440512 bytes, 229376 sectors +
-Units: sectors of 1 * 512 512 bytes +
-Sector size (logical/physical): 512 bytes / 512 bytes +
-I/O size (minimum/optimal): 65536 bytes 131072 bytes+
 </code> </code>
- 
-Créez un filesystem Ext3 sur /dev/sdb12 en utilisant la commande **mke2fs -j** : 
  
 <code> <code>
-[root@centos8 ~]# mke2fs -/dev/sdb12 +[root@redhat9 tmp]# ls -/usr/lib/systemd/system | more 
-mke2fs 1.45.6 (20-Mar-2020) +total 1640 
-Creating filesystem with 204800 1k blocks and 51200 inodes +-rw-r--r--. root root  729 Feb 24  2022 accounts-daemon.service 
-Filesystem UUIDa2515f45-a32a-4e87-b7e6-170448f3f803 +-rw-r--r--1 root root  480 Jan 16  2024 alsa-restore.service 
-Superblock backups stored on blocks:  +-rw-r--r--. 1 root root  465 Jan 16  2024 alsa-state.service 
- 8193, 24577, 40961, 57345, 73729 +-rw-r--r--. 1 root root  275 Aug 10  2021 arp-ethers.service 
- +-rw-r--r--. 1 root root  274 Apr  4  2022 atd.service 
-Allocating group tablesdone                             +-rw-r--r--. 1 root root 1771 Nov  8  2023 auditd.service 
-Writing inode tablesdone                             +lrwxrwxrwx. 1 root root   14 Jul 18 13:00 autovt@.service -> getty@.service 
-Creating journal (4096 blocks)done +-rw-r--r--. 1 root root 1044 Nov  8  2023 avahi-daemon.service 
-Writing superblocks and filesystem accounting informationdone +-rw-r--r--. 1 root root  870 Nov  8  2023 avahi-daemon.socket 
 +-rw-r--r--. 1 root root  224 Oct 23 14:00 bar.service 
 +-rw-r--r--. 1 root root  964 Jul 18 13:00 basic.target 
 +drwxr-xr-x. 2 root root    Jul 18 13:00 basic.target.wants 
 +-r--r--r--. 1 root root  384 Feb  3  2024 blk-availability.service 
 +-rw-r--r--. 1 root root  449 Oct 31  2022 blockdev@.target 
 +-rw-r--r--. 1 root root  707 Jun 14  2022 bluetooth.service 
 +-rw-r--r--. 1 root root  435 Oct 31  2022 bluetooth.target 
 +-rw-r--r--. 1 root root  642 Jan 16  2023 bolt.service 
 +-rw-r--r--. 1 root root  463 Oct 31  2022 boot-complete.target 
 +-rw-r--r--. 1 root root  217 Aug  9  2021 brltty.service 
 +-rw-r--r--. 1 root root  491 Jul 13  2023 canberra-system-bootup.service 
 +-rw-r--r--. 1 root root  509 Jul 13  2023 canberra-system-shutdown-reboot.service 
 +-rw-r--r--. 1 root root  466 Jul 13  2023 canberra-system-shutdown.service 
 +-rw-r--r--. 1 root root 1811 Jan 23  2024 chronyd-restricted.service 
 +-rw-r--r--. 1 root root 1468 Jan 23  2024 chronyd.service 
 +-rw-r--r--. 1 root root 1082 Jan 23  2024 chrony-wait.service 
 +-rw-r--r--. 1 root root  277 Jul 23 09:37 cni-dhcp.service 
 +-rw-r--r--. 1 root root  302 Dec  4  2023 cni-dhcp.socket 
 +-rw-r--r--. 1 root root  222 Apr  2  2024 cockpit-motd.service 
 +-rw-r--r--. 1 root root  720 Apr  2  2024 cockpit.service 
 +-rw-r--r--. 1 root root  349 Apr  2  2024 cockpit.socket 
 +-rw-r--r--. 1 root root  221 Apr  2  2024 cockpit-wsinstance-http.service 
 +-rw-r--r--. 1 root root  165 Apr  2  2024 cockpit-wsinstance-https-factory@.service 
 +-rw-r--r--. 1 root root  244 Apr  2  2024 cockpit-wsinstance-https-factory.socket 
 +-rw-r--r--. 1 root root  215 Apr  2  2024 cockpit-wsinstance-http.socket 
 +-rw-r--r--. 1 root root  264 Apr  2  2024 cockpit-wsinstance-https@.service 
 +-rw-r--r--. 1 root root  478 Apr  2  2024 cockpit-wsinstance-https@.socket 
 +-rw-r--r--. 1 root root  295 Aug  9  2021 colord.service 
 +-rw-r--r--. 1 root root  154 Aug 11  2021 configure-printer@.service 
 +-rw-r--r--. 1 root root 1102 Jul 18 13:00 console-getty.service 
 +-rw-r--r--. 1 root root 1254 Jul 18 13:00 container-getty@.service 
 +-rw-r--r--. 1 root root  294 Sep 13 18:49 cpupower.service 
 +-rw-r--r--. 1 root root  371 Nov 30  2023 crond.service 
 +-rw-r--r--. 1 root root  473 Oct 31  2022 cryptsetup-pre.target 
 +-rw-r--r--. 1 root root  420 Oct 31  2022 cryptsetup.target 
 +lrwxrwxrwx. 1 root root   13 Jul 18 13:00 ctrl-alt-del.target -> reboot.target 
 +-rw-r--r--. 1 root root  234 Jan  7  2021 cups-browsed.service 
 +-rw-r--r--. 1 root root  142 Jun 19 11:00 cups.path 
 +-rw-r--r--. 1 root root  298 Jun 19 11:00 cups.service 
 +drwxr-xr-x. 2 root root   25 Sep 25 12:03 cups.service.d 
 +-rw-r--r--. 1 root root  148 Jun 19 11:00 cups.socket 
 +-rw-r--r--. 1 root root  529 Aug 23  2022 dbus-broker.service 
 +-rw-r--r--. 1 root root  560 Jun 12  2023 dbus-daemon.service 
 +lrwxrwxrwx. 1 root root   25 Jul 18 13:00 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service 
 +lrwxrwxrwx. 1 root root   23 Jul 18 13:00 dbus-org.freedesktop.locale1.service -> systemd-localed.service 
 +--More--
 </code> </code>
  
-Les options de la commande **mke2fs** sont :+Certains fichiers de configuration sont créés à la volée dans le répertoire **/run/systemd/system** lors du runtime puis ils sont détruits quand le système n'en a plus besoin :
  
 <code> <code>
-[root@centos8 ~]# mke2fs --help +[root@redhat9 tmp]# ls -l /run/systemd/system/ 
-mke2fs: invalid option -- '-' +total 0
-Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size] +
- [-i bytes-per-inode] [-I inode-size] [-J journal-options] +
- [-G flex-group-size] [-N number-of-inodes] [-d root-directory] +
- [-m reserved-blocks-percentage] [-o creator-os] +
- [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] +
- [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]] +
- [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] +
- [-jnqvDFSV] device [blocks-count]+
 </code> </code>
  
-<WRAP center round important 60%> +Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/usr/lib/systemd/user** :
-**Important** : Lors de la mise en place d'un filesystem ext2/ext3/ext4, le système réserve 5% de l'espace disque pour root. Sur des disques de grande taille il est parfois préférable de récupérer une partie de cet espace en utilisant la commande **tune2fs -m n /dev/sdXY** ou **n** est le nouveau pourcentage à réserver. +
-</WRAP> +
- +
-===LAB #11 - Convertir un Système de Fichiers Ext3 en Ext2=== +
- +
-Pour vérifier si un système de fichiers Ext2 est journalisé, utilisez la commande **dumpe2fs** :+
  
 <code> <code>
-[root@centos8 ~]# dumpe2fs -h /dev/sdb12 +[root@redhat9 tmp]# pkg-config systemd --variable=systemduserunitdir 
-dumpe2fs 1.45.6 (20-Mar-2020) +/usr/lib/systemd/user
-Filesystem volume name:   <none> +
-Last mounted on:          <not available> +
-Filesystem UUID:          a2515f45-a32a-4e87-b7e6-170448f3f803 +
-Filesystem magic number:  0xEF53 +
-Filesystem revision #:    1 (dynamic) +
-Filesystem features:      has_journal ext_attr resize_inode dir_index filetype sparse_super large_file +
-Filesystem flags:         signed_directory_hash  +
-Default mount options:    user_xattr acl +
-Filesystem state:         clean +
-Errors behavior:          Continue +
-Filesystem OS type:       Linux +
-Inode count:              51200 +
-Block count:              204800 +
-Reserved block count:     10240 +
-Free blocks:              192674 +
-Free inodes:              51189 +
-First block:              1 +
-Block size:               1024 +
-Fragment size:            1024 +
-Reserved GDT blocks:      256 +
-Blocks per group:         8192 +
-Fragments per group:      8192 +
-Inodes per group:         2048 +
-Inode blocks per group:   256 +
-Filesystem created:       Wed Jun  2 07:55:24 2021 +
-Last mount time:          n/+
-Last write time:          Wed Jun  2 07:55:24 2021 +
-Mount count:              0 +
-Maximum mount count:      -1 +
-Last checked:             Wed Jun  2 07:55:24 2021 +
-Check interval:           0 (<none>+
-Reserved blocks uid:      0 (user root) +
-Reserved blocks gid:      0 (group root) +
-First inode:              11 +
-Inode size:           128 +
-Journal inode:            8 +
-Default directory hash:   half_md4 +
-Directory Hash Seed:      faee0b81-0538-4c06-8d86-468bc0c760ac +
-Journal backup:           inode blocks +
-Journal features:         (none) +
-Journal size:             4096k +
-Journal length:           4096 +
-Journal sequence:         0x00000001 +
-Journal start:            0+
 </code> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Le drapeau **Filesystem features:      has_journal ...** démontre que Ext3 est utilisé sur cette partition.+**Important** : De cette façon les fichiers dans **/usr/lib/systemd/user** surchargent les fichiers dans le répertoire **/run/systemd/system** qui surchargent les fichiers dans le répertoire **/usr/lib/systemd/system**.
 </WRAP> </WRAP>
  
-Les options de cette commande sont :+Prenons le cas du service **sshd** qui est configuré par le fichier **/usr/lib/systemd/system/sshd.service** :
  
 <code> <code>
-[root@centos8 ~]# dumpe2fs --help +[root@redhat9 tmp]# cat /usr/lib/systemd/system/sshd.service 
-dumpe2fs 1.45.6 (20-Mar-2020+[Unit] 
-dumpe2fs: invalid option -- '-' +Description=OpenSSH server daemon 
-Usage: dumpe2fs [-bfghimxV] [-o superblock=<num>] [-o blocksize=<num>] device +Documentation=man:sshd(8) man:sshd_config(5
-</code>+After=network.target sshd-keygen.target 
 +Wants=sshd-keygen.target
  
-Pour supprimer le journal du système de fichier Ext3 sur cette partition, il convient d'utiliser la commande **tune2fs**+[Service] 
 +Type=notify 
 +EnvironmentFile=-/etc/sysconfig/sshd 
 +ExecStart=/usr/sbin/sshd -D $OPTIONS 
 +ExecReload=/bin/kill -HUP $MAINPID 
 +KillMode=process 
 +Restart=on-failure 
 +RestartSec=42s
  
-<code> +[Install] 
-[root@centos8 ~]# tune2fs -O ^has_journal /dev/sdb12 +WantedBy=multi-user.target
-tune2fs 1.45.6 (20-Mar-2020)+
 </code> </code>
  
-Les options de cette commande sont :+Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** :
  
-<code> +  * **Description=OpenSSH server daemon**, 
-[root@centos8 ~]# tune2fs --help +    * Cette directive est utilisée pour donner une courte description des fonctionnalités de l'Unité, 
-tune2fs 1.45.6 (20-Mar-2020+  * **Documentation=man:sshd(8) man:sshd_config(5)**, 
-tune2fs: invalid option -- '-+    * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, 
-Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group] +  * **After=network.target sshd-keygen.target**, 
- [-i interval[d|m|w]] [-j] [-J journal_options] [-l] +    * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l'Unité sshd. Par contre, cette directive ne spécifie pas une dépendance, 
- [-m reserved_blocks_percent] [-o [^]mount_options[,...]] +  * **Wants=sshd-keygen.target**
- [-r reserved_blocks_count] [-u user] [-C mount_count] +    * Cette directive stipule une dépendance douce. Autrement dit, Systemd essayera de démarrer l'Unité **sshd-keygen.target** mais si ce démarrage est en échecl'Unité sshd sera démarré.
- [-L volume_label] [-M last_mounted_dir] +
- [-O [^]feature[,...]] [-Q quota_options] +
- [-E extended-option[,...]] [-T last_check_time] [-U UUID] +
- [-I new_inode_size] [-z undo_file] device +
-</code>+
  
-Constatez le résultat de cette commande :+Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** :
  
-<code> +  * **Type=notify**, 
-[root@centos8 ~]# dumpe2fs -h /dev/sdb12 +    * Cette directive indique que le service informera Systemd quand son démarrage a terminé, 
-dumpe2fs 1.45.6 (20-Mar-2020) +  * **ExecStart=/usr/sbin/sshd -D $OPTIONS**, 
-Filesystem volume name:   <none> +     * Cette directive définit l'exécutable à lancer, 
-Last mounted on:          <not available> +  * **ExecReload=/bin/kill -HUP $MAINPID**, 
-Filesystem UUID:          a2515f45-a32a-4e87-b7e6-170448f3f803 +    * Cette directive indique la commande necéssaire pour redémarrer le service, 
-Filesystem magic number:  0xEF53 +  * **KillMode=process**, 
-Filesystem revision #:    1 (dynamic) +    * Cette directive indique comment les processus du service doivent être arrêtés. La valeur de **process** implique l'utilisation de SIGTERM suivi par SIGHUP, 
-Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file +  * **Restart=on-failure**, 
-Filesystem flags:         signed_directory_hash  +    * Cette ligne indique que le service doit être re-démarré en cas d'arrêt de celui-ci. 
-Default mount options:    user_xattr acl +  * **RestartSec=42s**, 
-Filesystem state:         clean +    * Cette directive stipule le temps d'attente entre l'arrêt du service et le redémarrage par Systemd,
-Errors behavior:          Continue +
-Filesystem OS type:       Linux +
-Inode count:              51200 +
-Block count:              204800 +
-Reserved block count:     10240 +
-Free blocks:              196787 +
-Free inodes:              51189 +
-First block:              1 +
-Block size:               1024 +
-Fragment size:            1024 +
-Reserved GDT blocks:      256 +
-Blocks per group:         8192 +
-Fragments per group:      8192 +
-Inodes per group:         2048 +
-Inode blocks per group:   256 +
-Filesystem created:       Wed Jun  2 07:55:24 2021 +
-Last mount time:          n/a +
-Last write time:          Wed Jun  2 07:59:01 2021 +
-Mount count:              0 +
-Maximum mount count:      -1 +
-Last checked:             Wed Jun  2 07:55:24 2021 +
-Check interval:           0 (<none>+
-Reserved blocks uid:      0 (user root) +
-Reserved blocks gid:      0 (group root) +
-First inode:              11 +
-Inode size:           128 +
-Default directory hash:   half_md4 +
-Directory Hash Seed:      faee0b81-0538-4c06-8d86-468bc0c760ac +
-Journal backup:           inode blocks +
-</code>+
  
-<WRAP center round important 60%> +Dernièrement on note la présence de la ligne suivante dans la section **[Install]** :
-**Important** : Notez que le drapeau **Filesystem features:      has_journal ...** a été supprimé. +
-</WRAP>+
  
-Supprimez maintenant l'inode du journal : +  * **WantedBy=multi-user.target**, 
- +    * Cette directive indique la Cible dans laquelle le service doit être démarréLa présence de cette directive crée un lien symbolique dans le répertoire **/etc/systemd/system/multi-user.target.wants** qui pointe vers ce fichier.
-<code> +
-[root@centos8 ~]# fsck /dev/sdb12 +
-fsck from util-linux 2.32.1 +
-e2fsck 1.45.6 (20-Mar-2020) +
-/dev/sdb12: clean, 11/51200 files, 8013/204800 blocks +
-</code>+
  
-Créez maintenant un point de montage pour /dev/sdb12 :+Pour consulter **l'ensemble** des directives de configuration ainsi que leurs valeurs d'une Unité, il convient d'utiliser la commande **systemctl show**  en spécifiant l'Unité concernée :
  
 <code> <code>
-[root@centos8 ~]# mkdir /mnt/sdb12+[root@redhat9 tmp]# systemctl show sshd 
 +Type=notify 
 +ExitType=main 
 +Restart=on-failure 
 +NotifyAccess=main 
 +RestartUSec=42s 
 +TimeoutStartUSec=1min 30s 
 +TimeoutStopUSec=1min 30s 
 +TimeoutAbortUSec=1min 30s 
 +TimeoutStartFailureMode=terminate 
 +TimeoutStopFailureMode=terminate 
 +RuntimeMaxUSec=infinity 
 +RuntimeRandomizedExtraUSec=0 
 +WatchdogUSec=0 
 +WatchdogTimestampMonotonic=0 
 +RootDirectoryStartOnly=no 
 +RemainAfterExit=no 
 +GuessMainPID=yes 
 +MainPID=1175 
 +ControlPID=0 
 +FileDescriptorStoreMax=0 
 +NFileDescriptorStore=0 
 +StatusErrno=0 
 +Result=success 
 +ReloadResult=success 
 +CleanResult=success 
 +UID=[not set] 
 +GID=[not set] 
 +NRestarts=0 
 +OOMPolicy=stop 
 +ReloadSignal=1 
 +ExecMainStartTimestamp=Thu 2024-10-24 09:29:16 CEST 
 +ExecMainStartTimestampMonotonic=38779836 
 +ExecMainExitTimestampMonotonic=0 
 +ExecMainPID=1175 
 +ExecMainCode=0 
 +ExecMainStatus=0 
 +ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS ; ignore_errors=no ; start_time=[Thu 2024-10-24 09:29:16 CEST] ; stop_time=[n/a] ; pid=1175 ; code=(null) ; status=0/0 } 
 +ExecStartEx={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS ; flags= ; start_time=[Thu 2024-10-24 09:29:16 CEST] ; stop_time=[n/a] ; pid=1175 ; code=(null) ; status=0/0 } 
 +ExecReload={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +ExecReloadEx={ path=/bin/kill ; argv[]=/bin/kill -HUP $MAINPID ; flags= ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 } 
 +Slice=system.slice 
 +ControlGroup=/system.slice/sshd.service 
 +ControlGroupId=4041 
 +MemoryCurrent=5337088 
 +MemoryAvailable=infinity 
 +CPUUsageNSec=63348000 
 +TasksCurrent=1 
 +IPIngressBytes=[no data] 
 +IPIngressPackets=[no data] 
 +IPEgressBytes=[no data] 
 +IPEgressPackets=[no data] 
 +IOReadBytes=18446744073709551615 
 +IOReadOperations=18446744073709551615 
 +IOWriteBytes=18446744073709551615 
 +IOWriteOperations=18446744073709551615 
 +lines 1-55
 </code> </code>
  
-Essayez de monter /dev/sdb12 en tant que système de fichiers Ext3. Vous obtiendrez un résultat similaire à celui-ci :+Pour consulter la liste des dépendances d'une Unité, il convient d'utiliser **systemctl list-dependancies** en spécifiant l'Unité concernée :
  
 <code> <code>
-[root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 +[root@redhat9 tmp]# systemctl list-dependencies sshd.service 
-mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error.+sshd.service 
 +● ├─system.slice 
 +● ├─sshd-keygen.target 
 +○ │ ├─sshd-keygen@ecdsa.service 
 +○ │ ├─sshd-keygen@ed25519.service 
 +○ │ └─sshd-keygen@rsa.service 
 +● └─sysinit.target 
 +●   ├─dev-hugepages.mount 
 +●   ├─dev-mqueue.mount 
 +●   ├─dracut-shutdown.service 
 +○   ├─iscsi-onboot.service 
 +○   ├─iscsi-starter.service 
 +●   ├─kmod-static-nodes.service 
 +○   ├─ldconfig.service 
 +●   ├─lvm2-lvmpolld.socket 
 +●   ├─lvm2-monitor.service 
 +○   ├─multipathd.service 
 +●   ├─nis-domainname.service 
 +●   ├─plymouth-read-write.service 
 +●   ├─plymouth-start.service 
 +●   ├─proc-sys-fs-binfmt_misc.automount 
 +○   ├─selinux-autorelabel-mark.service 
 +●   ├─sys-fs-fuse-connections.mount 
 +●   ├─sys-kernel-config.mount 
 +●   ├─sys-kernel-debug.mount 
 +●   ├─sys-kernel-tracing.mount 
 +○   ├─systemd-ask-password-console.path 
 +○   ├─systemd-binfmt.service 
 +○   ├─systemd-boot-random-seed.service 
 +●   ├─systemd-boot-update.service 
 +○   ├─systemd-firstboot.service 
 +○   ├─systemd-hwdb-update.service 
 +○   ├─systemd-journal-catalog-update.service 
 +●   ├─systemd-journal-flush.service 
 +●   ├─systemd-journald.service 
 +○   ├─systemd-machine-id-commit.service 
 +●   ├─systemd-modules-load.service 
 +●   ├─systemd-network-generator.service 
 +○   ├─systemd-pcrmachine.service 
 +○   ├─systemd-pcrphase-sysinit.service 
 +○   ├─systemd-pcrphase.service 
 +●   ├─systemd-random-seed.service 
 +○   ├─systemd-repart.service 
 +●   ├─systemd-sysctl.service 
 +○   ├─systemd-sysusers.service 
 +●   ├─systemd-tmpfiles-setup-dev.service 
 +●   ├─systemd-tmpfiles-setup.service 
 +●   ├─systemd-udev-trigger.service 
 +●   ├─systemd-udevd.service 
 +○   ├─systemd-update-done.service 
 +●   ├─systemd-update-utmp.service 
 +●   ├─cryptsetup.target 
 +●   │ └─systemd-cryptsetup@sdb12.service 
 +●   ├─integritysetup.target 
 +●   ├─local-fs.target 
 +lines 1-55
 </code> </code>
  
-<WRAP center round important 60%> +===2.2 - Surchargement des Fichiers de Configuration par Défaut===
-**Important** : Notez l'erreur due au mauvais système de fichiers qui suit l'option **-t**. +
-</WRAP>+
  
-Montez maintenant le système de fichiers en tant que Ext2 :+Les fichiers de configuration par défaut peuvent aussi être surchargés par des fichiers dans d'autres répertoires :
  
 <code> <code>
-[root@centos8 ~]# mount -t ext2 /dev/sdb12 /mnt/sdb12+[root@redhat9 tmp]# pkg-config systemd --variable=systemdsystemunitpath 
 +/etc/systemd/system:/etc/systemd/system:/run/systemd/system:/usr/local/lib/systemd/system:/usr/lib/systemd/system:/usr/lib/systemd/system:/lib/systemd/system
 </code> </code>
- 
-===LAB #12 - Convertir un Système de Fichiers Ext2 en Ext3=== 
- 
-Pour replacer le journal sur /dev/sdb12, il convient d'utiliser la commande **tune2fs** : 
  
 <code> <code>
-[root@centos8 ~]# umount /mnt/sdb12 +[root@redhat9 tmp]# ls -l /etc/systemd/system 
- +total 8 
-[root@centos8 ~]# tune2fs -/dev/sdb12 +drwxr-xr-x. 2 root root   65 Oct 19  2023  basic.target.wants 
-tune2fs 1.45.6 (20-Mar-2020) +drwxr-xr-x. 2 root root   31 Oct 19  2023  bluetooth.target.wants 
-Creating journal inodedone+lrwxrwxrwx. 1 root root   37 Oct 19  2023  ctrl-alt-del.target -> /usr/lib/systemd/system/reboot.target 
 +lrwxrwxrwx. root root   41 Oct 19  2023  dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service 
 +lrwxrwxrwx. 1 root root   41 Oct 19  2023  dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service 
 +lrwxrwxrwx. 1 root root   44 Oct 19  2023  dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx. 1 root root   44 Oct 19  2023  dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service 
 +lrwxrwxrwx. 1 root root   57 Oct 19  2023  dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service 
 +lrwxrwxrwx. 1 root root   43 Oct 19  2023  dbus.service -> /usr/lib/systemd/system/dbus-broker.service 
 +lrwxrwxrwx. 1 root root   40 Oct 19  2023  default.target -> /usr/lib/systemd/system/graphical.target 
 +drwxr-xr-x. 2 root root   45 Oct 19  2023  default.target.wants 
 +drwxr-xr-x. 2 root root   38 Oct 19  2023 'dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants' 
 +lrwxrwxrwx. 1 root root   35 Oct 19  2023  display-manager.service -> /usr/lib/systemd/system/gdm.service 
 +drwxr-xr-x. 2 root root   32 Oct 19  2023  getty.target.wants 
 +drwxr-xr-x. 2 root root  181 Oct 19  2023  graphical.target.wants 
 +drwxr-xr-x. 2 root root   36 Oct 19  2023  local-fs.target.wants 
 +drwxr-xr-x. 2 root root 4096 Oct 24 08:02  multi-user.target.wants 
 +drwxr-xr-x. 2 root root   48 Oct 19  2023  network-online.target.wants 
 +drwxr-xr-x. 2 root root   26 Oct 19  2023  printer.target.wants 
 +drwxr-xr-x. 2 root root   27 Oct 19  2023  remote-fs.target.wants 
 +drwxr-xr-x. 2 root root  186 Oct 19  2023  sockets.target.wants 
 +drwxr-xr-x. 2 root root 4096 Sep 25 12:08  sysinit.target.wants 
 +drwxr-xr-x. 2 root root   27 Oct 23 13:09  sysstat-collect.timer.d 
 +drwxr-xr-x. 2 root root   64 Oct 23 12:58  sysstat.service.wants 
 +drwxr-xr-x. 2 root root   27 Oct 21 16:32  systemd-tmpfiles-clean.timer.d 
 +drwxr-xr-x. 2 root root   86 Oct 19  2023  timers.target.wants 
 +drwxr-xr-x. 2 root root   29 Oct 19  2023  vmtoolsd.service.requires
 </code> </code>
  
-<WRAP center round important 60%> +====LAB #3 - La Commande systemd-analyze====
-**Important** : Notez que vous avez du démonter la partition avant d'exécuter la commande **tune2fs**. +
-</WRAP>+
  
-===LAB #13 - Placer le Journal sur un autre Partition=== +Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :
- +
-Le journal d'un système de fichiers peut être placé sur un autre périphérique bloc. +
- +
-Créez un système de fichiers sur /dev/sdb11 :+
  
 <code> <code>
-[root@centos8 ~]# mke2fs -O journal_dev /dev/sdb11 +[root@redhat9 tmp]# systemd-analyze 
-mke2fs 1.45.(20-Mar-2020+Startup finished in 1.361s (kernel) + 4.348s (initrd+ 1min 21.082s (userspace) = 1min 26.792s  
-Creating filesystem with 512000 1k blocks and 0 inodes +graphical.target reached after 53.162s in userspace.
-Filesystem UUID: 23327281-e88a-4da0-bafa-50ee10c52937 +
-Superblock backups stored on blocks:  +
- +
-Zeroing journal device:   +
 </code> </code>
  
-<WRAP center round important 60%> +L'option **blame** de la commande systemd-analyze permet de voir le temps de démarrage de chaque Unité afin de pourvoir se concentrer sur les plus lentes :
-**Important** : Notez l'utilisation de l'option **-O**+
-</WRAP> +
- +
-Créez maintenant un système de fichiers Ext3 sur /dev/sdb12 en plaçant le journal sur /dev/sdb11 :+
  
 <code> <code>
-[root@centos8 ~]# mke2fs --device=/dev/sdb11 /dev/sdb12 +[root@redhat9 tmp]# systemd-analyze blame 
-mke2fs 1.45.6 (20-Mar-2020) +44.601s kdump.service 
-Using journal device's blocksize1024 +18.590s systemd-cryptsetup@sdb12.service 
-/dev/sdb12 contains a ext3 file system +16.592s plymouth-quit-wait.service 
- last mounted on Wed Jun  2 08:03:11 2021 + 9.801s dev-sdb8.device 
-Proceed anyway? (y,N) y + 9.801s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart8.device 
-Creating filesystem with 204800 1k blocks and 51200 inodes + 9.801s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb8.device 
-Filesystem UUID0e783411-6407-4cba-8db5-0e2729000c9e + 9.801s dev-disk-by\x2dpartuuid-23a56c2e\x2d08.device 
-Superblock backups stored on blocks:  + 9.801s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart8.device 
- 8193, 24577, 40961, 57345, 73729 + 9.801s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart8.device 
- + 9.800s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb10.device 
-Allocating group tablesdone                             + 9.800s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart10.device 
-Writing inode tablesdone                             + 9.800s dev-sdb10.device 
-Adding journal to device /dev/sdb11done + 9.800s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart10.device 
-Writing superblocks and filesystem accounting informationdone + 9.800s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart10.device 
 + 9.800s dev-disk-by\x2dpartuuid-23a56c2e\x2d0a.device 
 + 9.800s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb5.device 
 + 9.800s dev-sdb5.device 
 + 9.800s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart5.device 
 + 9.800s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart5.device 
 + 9.800s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart5.device 
 + 9.799s dev-disk-by\x2dpartuuid-23a56c2e\x2d05.device 
 + 9.782s sys-module-fuse.device 
 + 9.750s dev-ttyS3.device 
 + 9.750s sys-devices-platform-serial8250-tty-ttyS3.device 
 + 9.749s dev-ttyS0.device 
 + 9.749s sys-devices-platform-serial8250-tty-ttyS0.device 
 + 9.749s dev-ttyS1.device 
 + 9.749s sys-devices-platform-serial8250-tty-ttyS1.device 
 + 9.749s dev-ttyS2.device 
 + 9.749s sys-devices-platform-serial8250-tty-ttyS2.device 
 + 9.717s sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device 
 + 9.717s sys-subsystem-net-devices-ens18.device 
 + 9.717s sys-module-configfs.device 
 + 9.680s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart6.device 
 + 9.680s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb6.device 
 + 9.680s dev-disk-by\x2dpartuuid-23a56c2e\x2d06.device 
 + 9.680s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart6.device 
 + 9.680s dev-sdb6.device 
 + 9.680s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart6.device 
 + 9.654s dev-disk-by\x2dpath-pci\x2d0000:01:01.0\x2dscsi\x2d0:0:0:0\x2dpart2.device 
 + 9.654s sys-devices-pci0000:00-0000:00:05.0-0000:01:01.0-virtio2-host0-target0:0:0-0:0:0:0-block-sda-sda2.device 
 + 9.654s dev-sda2.device 
 + 9.654s dev-disk-by\x2dpartuuid-d00dfc8a\x2d02.device 
 + 9.654s dev-disk-by\x2did-scsi\x2d0QEMU_QEMU_HARDDISK_drive\x2dscsi0\x2dpart2.device 
 + 9.647s dev-disk-by\x2dpartuuid-23a56c2e\x2d09.device 
 + 9.647s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb9.device 
 + 9.647s dev-sdb9.device 
 + 9.647s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart9.device 
 + 9.647s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart9.device 
 + 9.647s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart9.device 
 + 9.635s dev-sdb7.device 
 + 9.635s sys-devices-pci0000:00-0000:00:07.0-ata3-host3-target3:0:0-3:0:0:0-block-sdb-sdb7.device 
 + 9.635s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1.0\x2dpart7.device 
 + 9.635s dev-disk-by\x2dpartuuid-23a56c2e\x2d07.device 
 + 9.635s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart7.device 
 +lines 1-55
 </code> </code>
  
-<WRAP center round important 60%> +L'option **critical-chain** de la commande **systemd-analyze** permet de voir l'enchaînement des événements qui amènent au chargement de l'Unité qui est passée en argument :
-**Important** : Notez que le journal a été placé sur /dev/sdb11 graĉe à l'utilisation de l'option **-J**+
-</WRAP> +
- +
-===LAB #14 - Modifier la Fréquence de Vérification du Système de Fichiers Ext3=== +
- +
-Pour modifier la fréquence de vérification du système de fichiers sur /dev/sdb12, il convient d'utiliser soit l'option **-c**, soit l'option **-i** :+
  
 <code> <code>
-[root@centos8 ~]# tune2fs -i 100d /dev/sdb12 +[root@redhat9 tmp]# systemd-analyze critical-chain sshd.service 
-tune2fs 1.45.6 (20-Mar-2020) +The time when unit became active or started is printed after the "@" character
-Setting interval between checks to 8640000 seconds +The time the unit took to start is printed after the "+" character.
-</code>+
  
-Dernièrement, pour obtenir seul l'UUID du système de fichiers, utilisez les commandes **dumpe2fs** et **grep** : +sshd.service +348ms 
- +└─network.target @33.014s 
-<code> +  └─wpa_supplicant.service @49.199s +119ms 
-[root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID +    └─basic.target @27.729s 
-dumpe2fs 1.45.6 (20-Mar-2020) +      └─dbus-broker.service @26.718s +1.007s 
-Filesystem UUID:          0e783411-6407-4cba-8db5-0e2729000c9e +        └─dbus.socket @26.682s 
-Journal UUID:             23327281-e88a-4da0-bafa-50ee10c52937+          └─sysinit.target @26.678s 
 +            └─systemd-update-utmp.service @26.658s +19ms 
 +              └─auditd.service @26.278s +369ms 
 +                └─systemd-tmpfiles-setup.service @25.954s +313ms 
 +                  └─local-fs.target @25.942s 
 +                    └─run-user-1000.mount @1min 19.309s 
 +                      └─local-fs-pre.target @6.742s 
 +                        └─systemd-tmpfiles-setup-dev.service @3.994s +1.040s 
 +                          └─kmod-static-nodes.service @3.795s +53ms 
 +                            └─systemd-journald.socket 
 +                              └─system.slice 
 +                                └─-.slice
 </code> </code>
  
-====Ext4==== +Les options de la commande **systemd-analyze** sont :
- +
-Le système de fichiers **Ext4** a été introduit dans le noyau **2.6.19** en mode expérimental et est devenu stable dans le noyau **2.6.28**. +
- +
-Ext4 n'est pas une évolution de Ext3. Cependant il a une compatibilité ascendante avec Ext3. +
- +
-Les fonctionnalités majeures d'Ext4 sont : +
- +
-  * la gestion des volumes d'une taille allant jusqu'à **1 024 pébioctets**, +
-  * l'allocation par **extents** qui permettent la pré-allocation d'une zone contiguë pour un fichier afin de minimiser la fragmentation. +
- +
-L'option **extents** est activée par défaut depuis le noyau **2.6.23**. +
- +
-La compatibilité ascendante avec ext3 comprend : +
- +
-  * la possibilité de monter une partition Ext3 en tant que partition Ext4, +
-  * la possibilité de monter une partition Ext4 en tant que partition Ext3 mais **uniquement** dans le cas où la partition Ext4 n'ait jamais utilisé l'allocation par **extents** pour enregistrer des fichiers, mais l'allocation binaire comprise par ext3. +
- +
-Pour plus d'informations concernant %%Ext4%%, consultez **[[http://fr.wikipedia.org/wiki/Ext4|cette page]]**. +
- +
-===LAB #15 Créer un Système de Fichiers Ext4=== +
- +
-Créez un système de fichiers Ext4 sur **/dev/sdb11** :+
  
 <code> <code>
-[root@centos8 ~]# mkfs.ext4 /dev/sdb11 +[root@redhat9 tmp]# systemd-analyze --help 
-mke2fs 1.45.6 (20-Mar-2020) +systemd-analyze [OPTIONS...] COMMAND ...
-/dev/sdb11 contains a jbd file system +
-Proceed anyway? (y,N) y +
-Creating filesystem with 512000 1k blocks and 128016 inodes +
-Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 +
-Superblock backups stored on blocks:  +
- 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409+
  
-Allocating group tables: done                             +Profile systemd, show unit dependencies, check unit files.
-Writing inode tables: done                             +
-Creating journal (8192 blocks): done +
-Writing superblocks and filesystem accounting information: done  +
-</code>+
  
-Les options de cette commande sont :+Commands: 
 +  [time]                     Print time required to boot the machine 
 +  blame                      Print list of running units ordered by 
 +                             time to init 
 +  critical-chain [UNIT...]   Print a tree of the time critical chain 
 +                             of units 
 +  plot                       Output SVG graphic showing service 
 +                             initialization 
 +  dot [UNIT...]              Output dependency graph in dot(1) format 
 +  dump [PATTERN...]          Output state serialization of service 
 +                             manager 
 +  cat-config                 Show configuration file and drop-ins 
 +  unit-files                 List files and symlinks for units 
 +  unit-paths                 List load directories for units 
 +  exit-status [STATUS...]    List exit status definitions 
 +  capability [CAP...]        List capability definitions 
 +  syscall-filter [NAME...]   List syscalls in seccomp filters 
 +  filesystems [NAME...]      List known filesystems 
 +  condition CONDITION...     Evaluate conditions and asserts 
 +  compare-versions VERSION1 [OP] VERSION2 
 +                             Compare two version strings 
 +  verify FILE...             Check unit files for correctness 
 +  calendar SPEC...           Validate repetitive calendar time 
 +                             events 
 +  timestamp TIMESTAMP...     Validate a timestamp 
 +  timespan SPAN...           Validate a time span 
 +  security [UNIT...]         Analyze security of unit 
 +  inspect-elf FILE...        Parse and print ELF package metadata
  
-<code> +Options: 
-[root@centos8 ~]# mkfs.ext4 --help +     --recursive-errors=MODE Control which units are verified 
-mkfs.ext4: invalid option -- '-' +     --offline=BOOL          Perform a security review on unit file(s) 
-Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size] +     --threshold=N           Exit with a non-zero status when overall 
- [-i bytes-per-inode] [-I inode-size] [-J journal-options] +                             exposure level is over threshold value 
- [-G flex-group-size] [-N number-of-inodes] [-d root-directory] +     --security-policy=PATH  Use custom JSON security policy instead 
- [-m reserved-blocks-percentage] [-o creator-os] +                             of built-in one 
- [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] +     --json=pretty|short|off Generate JSON output of the security 
- [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]+                             analysis table, or plot's raw time data 
- [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] +     --no-pager              Do not pipe output into a pager 
- [-jnqvDFSV] device [blocks-count] +     --no-legend             Disable column headers and hints in plot 
-</code> +                             with either --table or --json= 
- +     --system                Operate on system systemd instance 
-Consultez maintenant les caractéristiques du système de fichier : +     --user                  Operate on user systemd instance 
- +     --global                Operate on global user configuration 
-<code> +  ---host=[USER@]HOST      Operate on remote host 
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | more +  ---machine=CONTAINER     Operate on local container 
-dumpe2fs 1.45.6 (20-Mar-2020) +     --order                 Show only order in the graph 
-Filesystem volume name:   <none> +     --require               Show only requirement in the graph 
-Last mounted on:          <not available> +     --from-pattern=GLOB     Show only origins in the graph 
-Filesystem UUID:          72a6ad08-7023-4561-adcb-d434e00afed1 +     --to-pattern=GLOB       Show only destinations in the graph 
-Filesystem magic number:  0xEF53 +     --fuzz=SECONDS          Also print services which finished SECONDS 
-Filesystem revision #:    1 (dynamic) +lines 1-55
-Filesystem features:      has_journal ext_attr resize_inode dir_index filetype e +
-xtent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize meta +
-data_csum +
-Filesystem flags:         signed_directory_hash  +
-Default mount options:    user_xattr acl +
-Filesystem state:         clean +
-Errors behavior:          Continue +
-Filesystem OS type:       Linux +
-Inode count:              128016 +
-Block count:              512000 +
-Reserved block count:     25600 +
-Free blocks:              485316 +
-Free inodes:              128005 +
-First block:              1 +
-Block size:               1024 +
-Fragment size:            1024 +
-Group descriptor size:    64 +
-Reserved GDT blocks:      256 +
---More--+
 </code> </code>
  
-===LAB #16 Ajouter une Etiquette au Système de Fichiers Ext4===+====LAB #Les Cibles Systemd====
  
-Utilisez la commande **e2label** pour associer une étiquette au système de fichiers :+Chaque Cible est décrite par un fichier de configuration :
  
 <code> <code>
-[root@centos8 ~]# e2label /dev/sdb11 my_ext4 +[root@redhat9 tmp]# cat /usr/lib/systemd/system/graphical.target 
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | more +#  SPDX-License-IdentifierLGPL-2.1-or-later 
-dumpe2fs 1.45.6 (20-Mar-2020) +
-Filesystem volume name:   my_ext4 + This file is part of systemd. 
-Last mounted on:          <not available> +
-Filesystem UUID         72a6ad08-7023-4561-adcb-d434e00afed1 +#  systemd is free software; you can redistribute it and/or modify it 
-Filesystem magic number:  0xEF53 +#  under the terms of the GNU Lesser General Public License as published by 
-Filesystem revision #:    1 (dynamic) +#  the Free Software Foundation; either version 2.of the License, or 
-Filesystem features:      has_journal ext_attr resize_inode dir_index filetype e +#  (at your option) any later version.
-xtent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize meta +
-data_csum +
-Filesystem flags:         signed_directory_hash  +
-Default mount options:    user_xattr acl +
-Filesystem state:         clean +
-Errors behavior:          Continue +
-Filesystem OS type:       Linux +
-Inode count:              128016 +
-Block count:              512000 +
-Reserved block count:     25600 +
-Free blocks:              485316 +
-Free inodes:              128005 +
-First block:              +
-Block size:               1024 +
-Fragment size:            1024 +
-Group descriptor size:    64 +
-Reserved GDT blocks:      256 +
---More-- +
-</code>+
  
-<WRAP center round important 60%> +[Unit] 
-**Important** - Notez que l'étiquette doit être de 16 caractères maximum. +Description=Graphical Interface 
-</WRAP> +Documentation=man:systemd.special(7) 
- +Requires=multi-user.target 
-Créez un point de montage dans **/mnt** et essayez de monter **/dev/sdb11** en tant qu'Ext3 +Wants=display-manager.service 
- +Conflicts=rescue.service rescue.target 
-<code> +After=multi-user.target rescue.service rescue.target display-manager.service 
-[root@centos8 ~]# mkdir /mnt/sdb11 +AllowIsolate=yes
- +
-[root@centos8 ~]# mount -t ext3 /dev/sdb11 /mnt/sdb11 +
-mount: /mnt/sdb11: wrong fs type, bad option, bad superblock on /dev/sdb11, missing codepage or helper program, or other error..+
 </code> </code>
  
-<WRAP center round important 60%> +Dans ce fichier on peut noter la présence des lignes suivantes :
-**Important** - Notez l'erreur qui est signalée. +
-</WRAP>+
  
-Montez de nouveau la partition **sans** stipuler le type de système de fichiers :+  * **Requires=multi-user.target**, 
 +     * Cette ligne indique que le **graphical.target** ne peut pas être atteint si le **multi-user.target** n'a pas été atteint au préalable, 
 +  * **After=multi-user.target rescue.service rescue.target display-manager.service**, 
 +    * Cette ligne indique le **multi-user.target** et **rescue.target** doivent d'abord être atteints et que les services **rescue.service** et **display-manager.service** doivent d'abord être démarrés, 
 +  * **Conflicts=rescue.service rescue.target**, 
 +    * Cette ligne indique la Cible et le service en conflits avec le **graphical.target**, 
 +  * **Wants=display-manager.service**, 
 +    * Cette ligne indique quel service doit être démarré.
  
-<code> +===4.1 - Contrôler les dépendances d'une Cible===
-[root@centos8 ~]# mount /dev/sdb11 /mnt/sdb11+
  
-[root@centos8 ~]# mount | grep sdb11 +Les dépendances d'une Cible peuvent être consultées en utilisant la commande **systemctl list-dependencies** :
-/dev/sdb11 on /mnt/sdb11 type ext4 (rw,relatime,seclabel) +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** - Constatez que la partition a été monté en tant qu'Ext4. +
-</WRAP> +
- +
-===LAB #17 - Convertir un Système de Fichiers Ext3 en Ext4=== +
- +
-Créez un système de fichiers ext3 sur /dev/sdb12 :+
  
 <code> <code>
-[root@centos8 ~]# mkfs.ext3 /dev/sdb12 +[root@redhat9 tmp]# systemctl list-dependencies multi-user.target 
-mke2fs 1.45.6 (20-Mar-2020) +multi-user.target 
-/dev/sdb12 contains a ext3 file system +● ├─atd.service 
- created on Wed Jun  2 08:10:40 2021 +● ├─auditd.service 
-Proceed anyway? (y,N) y +● ├─avahi-daemon.service 
-Creating filesystem with 204800 1k blocks and 51200 inodes +● ├─bar.service 
-Filesystem UUID: b73322d4-f2e4-43bc-96ae-422d4584f3de +● ├─crond.service 
-Superblock backups stored on blocks:  +● ├─cups.path 
- 8193, 24577, 40961, 57345, 73729 +● ├─cups.service 
- +● ├─firewalld.service 
-Allocating group tables: done                             +● ├─foo.service 
-Writing inode tables: done                             +● ├─httpd.service 
-Creating journal (4096 blocks): done +○ ├─insights-client-boot.service 
-Writing superblocks and filesystem accounting information: done +● ├─irqbalance.service 
 +● ├─kdump.service 
 +● ├─libstoragemgmt.service 
 +● ├─mcelog.service 
 +● ├─mdmonitor.service 
 +● ├─ModemManager.service 
 +● ├─NetworkManager.service 
 +○ ├─ostree-readonly-sysroot-migration.service 
 +● ├─plymouth-quit-wait.service 
 +○ ├─plymouth-quit.service 
 +● ├─psacct.service 
 +● ├─rhsmcertd.service 
 +● ├─rsyslog.service 
 +○ ├─smartd.service 
 +● ├─sshd.service 
 +○ ├─sssd.service 
 +● ├─sysstat.service 
 +● ├─systemd-ask-password-wall.path 
 +● ├─systemd-logind.service 
 +○ ├─systemd-update-utmp-runlevel.service 
 +● ├─systemd-user-sessions.service 
 +○ ├─vmtoolsd.service 
 +● ├─basic.target 
 +● │ ├─-.mount 
 +○ │ ├─low-memory-monitor.service 
 +○ │ ├─microcode.service 
 +● │ ├─paths.target 
 +● │ ├─slices.target 
 +● │ │ ├─-.slice 
 +● │ │ └─system.slice 
 +● │ ├─sockets.target 
 +● │ │ ├─avahi-daemon.socket 
 +● │ │ ├─cups.socket 
 +● │ │ ├─dbus.socket 
 +● │ │ ├─dm-event.socket 
 +● │ │ ├─iscsid.socket 
 +● │ │ ├─iscsiuio.socket 
 +○ │ │ ├─multipathd.socket 
 +● │ │ ├─sssd-kcm.socket 
 +● │ │ ├─systemd-coredump.socket 
 +● │ │ ├─systemd-initctl.socket 
 +● │ │ ├─systemd-journald-dev-log.socket 
 +● │ │ ├─systemd-journald.socket 
 +lines 1-55
 </code> </code>
  
-Montez maintenant **/dev/sdb12** sur /mnt/sdb12 :+Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes :
  
-<code> +  * **Vert** implique que le service, la cible ou l'unité est activé et démarré 
-[root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12 +  * **Blanc** implique le service, la cible ou l'unité est inactif. 
- +  * **Rouge** implique que le service, la cible ou l'unité n'a pas démarré à cause d'une erreur fatale.
-[root@centos8 ~]# ls -/mnt/sdb12 +
-total 12 +
-drwx------2 root root 12288 Jun  2 08:42 lost+found +
-</code>+
  
-Créez le fichier **/mnt/sdb12/check_file** :+Pour visualiser les Unités en état d'erreur fatale, utilisez la commande **systemctl --failed** :
  
 <code> <code>
-[root@centos8 ~]# touch /mnt/sdb12/check_file+[root@redhat9 tmp]# systemctl --failed 
 +  UNIT LOAD ACTIVE SUB DESCRIPTION 
 +0 loaded units listed.
 </code> </code>
  
-Injectez la chaine **check file** dans le fichier /mnt/sdb12/check_file puis démontez /dev/sdb12 :+Les dépendances sont créés sous la forme de liens symboliques dans les répertoires **/etc/systemd/system/multi-user.target.wants** et **/usr/lib/systemd/system/multi-user.target.wants** :
  
 <code> <code>
-[root@centos8 ~]# echo "check file" > /mnt/sdb12/check_file+[root@redhat9 tmp]# ls -l /etc/systemd/system/multi-user.target.wants 
 +total 0 
 +lrwxrwxrwx. 1 root root 35 Oct 19  2023 atd.service -> /usr/lib/systemd/system/atd.service 
 +lrwxrwxrwx. 1 root root 38 Oct 19  2023 auditd.service -> /usr/lib/systemd/system/auditd.service 
 +lrwxrwxrwx. 1 root root 44 Oct 19  2023 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx. 1 root root 35 Oct 23 14:01 bar.service -> /usr/lib/systemd/system/bar.service 
 +lrwxrwxrwx. 1 root root 37 Oct 19  2023 crond.service -> /usr/lib/systemd/system/crond.service 
 +lrwxrwxrwx. 1 root root 33 Oct 19  2023 cups.path -> /usr/lib/systemd/system/cups.path 
 +lrwxrwxrwx. 1 root root 36 Oct 19  2023 cups.service -> /usr/lib/systemd/system/cups.service 
 +lrwxrwxrwx. 1 root root 41 Oct 19  2023 firewalld.service -> /usr/lib/systemd/system/firewalld.service 
 +lrwxrwxrwx. 1 root root 35 Oct 23 13:59 foo.service -> /usr/lib/systemd/system/foo.service 
 +lrwxrwxrwx. 1 root root 37 Oct 22 10:15 httpd.service -> /usr/lib/systemd/system/httpd.service 
 +lrwxrwxrwx. 1 root root 52 Oct 19  2023 insights-client-boot.service -> /usr/lib/systemd/system/insights-client-boot.service 
 +lrwxrwxrwx. 1 root root 42 Oct 19  2023 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service 
 +lrwxrwxrwx. 1 root root 37 Oct 19  2023 kdump.service -> /usr/lib/systemd/system/kdump.service 
 +lrwxrwxrwx. 1 root root 46 Oct 19  2023 libstoragemgmt.service -> /usr/lib/systemd/system/libstoragemgmt.service 
 +lrwxrwxrwx. 1 root root 38 Oct 19  2023 mcelog.service -> /usr/lib/systemd/system/mcelog.service 
 +lrwxrwxrwx. 1 root root 41 Oct 19  2023 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service 
 +lrwxrwxrwx. 1 root root 44 Oct 19  2023 ModemManager.service -> /usr/lib/systemd/system/ModemManager.service 
 +lrwxrwxrwx. 1 root root 46 Oct 19  2023 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service 
 +lrwxrwxrwx. 1 root root 38 Oct 22 15:41 psacct.service -> /usr/lib/systemd/system/psacct.service 
 +lrwxrwxrwx. 1 root root 40 Oct 19  2023 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target 
 +lrwxrwxrwx. 1 root root 41 Oct 19  2023 rhsmcertd.service -> /usr/lib/systemd/system/rhsmcertd.service 
 +lrwxrwxrwx. 1 root root 39 Oct 19  2023 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service 
 +lrwxrwxrwx. 1 root root 38 Oct 19  2023 smartd.service -> /usr/lib/systemd/system/smartd.service 
 +lrwxrwxrwx. 1 root root 36 Oct 19  2023 sshd.service -> /usr/lib/systemd/system/sshd.service 
 +lrwxrwxrwx. 1 root root 36 Oct 19  2023 sssd.service -> /usr/lib/systemd/system/sssd.service 
 +lrwxrwxrwx. 1 root root 39 Oct 23 12:58 sysstat.service -> /usr/lib/systemd/system/sysstat.service 
 +lrwxrwxrwx. 1 root root 40 Oct 19  2023 vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service
  
-[root@centos8 ~]# umount /dev/sdb12+[root@redhat9 tmp]# ls -l /usr/lib/systemd/system/multi-user.target.wants 
 +total 0 
 +lrwxrwxrwx. 1 root root 15 Jul 18 13:00 getty.target -> ../getty.target 
 +lrwxrwxrwx. 1 root root 44 May 17 18:27 ostree-readonly-sysroot-migration.service -> ../ostree-readonly-sysroot-migration.service 
 +lrwxrwxrwx. 1 root root 24 Jul 14  2023 plymouth-quit.service -> ../plymouth-quit.service 
 +lrwxrwxrwx. 1 root root 29 Jul 14  2023 plymouth-quit-wait.service -> ../plymouth-quit-wait.service 
 +lrwxrwxrwx. 1 root root 33 Jul 18 13:00 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path 
 +lrwxrwxrwx. 1 root root 25 Jul 18 13:00 systemd-logind.service -> ../systemd-logind.service 
 +lrwxrwxrwx. 1 root root 39 Jul 18 13:00 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service 
 +lrwxrwxrwx. 1 root root 32 Jul 18 13:00 systemd-user-sessions.service -> ../systemd-user-sessions.service
 </code> </code>
  
-Exécutez e2fsck sur /dev/sda12 :+===4.2 - La Cible par Défaut===
  
-<code> +==Consulter la Cible par Défaut==
-[root@centos8 ~]# e2fsck /dev/sdb12 +
-e2fsck 1.45.6 (20-Mar-2020) +
-/dev/sdb12: clean, 12/51200 files, 12128/204800 blocks +
-</code>+
  
-Convertissez /dev/sdb12 en Ext4 :+Pour consulter la cible par défaut, il convient d'utiliser la commande **systemctl get-default** :
  
 <code> <code>
-[root@centos8 ~]# tune2fs -O extents,uninit_bg,dir_index /dev/sdb12 +[root@redhat9 tmp]# systemctl get-default 
-tune2fs 1.45.6 (20-Mar-2020)+graphical.target
 </code> </code>
  
-Optimisez le système de fichiers :+La Cible par défaut est représentée par le lien symbolique **/etc/systemd/system/default.target** :
  
 <code> <code>
-[root@centos8 ~]# e2fsck -fDC0 /dev/sdb12 +[root@redhat9 tmp]# ls -/etc/systemd/system/default.target 
-e2fsck 1.45.6 (20-Mar-2020) +lrwxrwxrwx. root root 40 Oct 19  2023 /etc/systemd/system/default.target -/usr/lib/systemd/system/graphical.target
-Pass 1: Checking inodes, blocks, and sizes +
-Pass 2: Checking directory structure                                            +
-Pass 3: Checking directory connectivity +
-Pass 3A: Optimizing directories +
-Pass 4: Checking reference counts                                               +
-Pass 5: Checking group summary information +
-                                                                                 +
-/dev/sdb12: ***** FILE SYSTEM WAS MODIFIED ***** +
-/dev/sdb12: 12/51200 files (0.0% non-contiguous), 12128/204800 blocks+
 </code> </code>
  
-Essayez de monter **/dev/sdb12** en tant qu'Ext3 :+==Modifier la Cible par Défaut==
  
-<code> +Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient d'utiliser la commande **systemctl set-default** :
-[root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 +
-mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error. +
-</code> +
- +
-Montez /dev/sdb12 sans spécifier le type de fichiers Ext3 et vérifiez le contenu du fichier **check_file** :+
  
 <code> <code>
-[root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12+[root@redhat9 tmp]# systemctl get-default 
 +graphical.target
  
-[root@centos8 ~]# ls -l /mnt/sdb12 +[root@redhat9 tmp]# ls -l /etc/systemd/system/default.target 
-total 14 +lrwxrwxrwx. 1 root root 40 Oct 19  2023 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target
--rw-r--r--. 1 root root    11 Jun  2 08:45 check_file +
-drwx------. 2 root root 12288 Jun  2 08:42 lost+found+
  
-[root@centos8 ~]# cat /mnt/sdb12/check_file +[root@redhat9 tmp]# systemctl set-default multi-user.target 
-check file +Removed "/etc/systemd/system/default.target". 
-</code>+Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
  
-Dernièrement, pour obtenir seul l'UUID du système de fichiers, utilisez les commandes **dumpe2fs** et **grep** :+[root@redhat9 tmp]# systemctl get-default 
 +multi-user.target
  
-<code> +[root@redhat9 tmp]# ls -l /etc/systemd/system/default.target 
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | grep UUID +lrwxrwxrwx. root root 41 Oct 24 11:47 /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target
-dumpe2fs 1.45.6 (20-Mar-2020) +
-Filesystem UUID:          72a6ad08-7023-4561-adcb-d434e00afed1+
  
-[root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID +[root@redhat9 tmp]# systemctl set-default graphical.target 
-dumpe2fs 1.45.6 (20-Mar-2020) +Removed "/etc/systemd/system/default.target"
-Filesystem UUID:          b73322d4-f2e4-43bc-96ae-422d4584f3de +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
-</code>+
  
-====XFS====+[root@redhat9 tmp]# systemctl get-default 
 +graphical.target
  
-XFS est un système de fichiers 64-bit journalisé de haute performance crée par SGI pour son système d'exploitation IRIX. XFS est inclus par défaut avec les versions du noyau Linux 2.5.xx et 2.6.xx. XFS est le système de fichiers par défaut de RHEL/CentOS 8+[root@redhat9 tmp]# ls -/etc/systemd/system/default.target 
- +lrwxrwxrwx1 root root 40 Oct 24 11:47 /etc/systemd/system/default.target -/usr/lib/systemd/system/graphical.target
-<WRAP center round important 60%> +
-**Important** : Le système de fichiers XFS permet l'augmentation de sa taille à chaudPar contre, la taille d'un système de fichiers XFS ne peut pas être réduite. +
-</WRAP> +
- +
-Pour plus d'informations concernant XFS, consultez **[[http://en.wikipedia.org/wiki/XFS|cette page]]**. +
- +
-===LAB #18 Créer un Système de Fichiers XFS=== +
- +
-Démontez **/dev/sdb12** : +
- +
-<code> +
-[root@centos8 ~]# umount /dev/sdb12+
 </code> </code>
  
-Créez un système de fichiers XFS sur la partition **/dev/sdb12** :+==Modifier la Cible en Cours==
  
-<code> +Il est possible de modifier la cible actuellement en cours en utilisant la commande **systemctl isolate** :
-[root@centos8 ~]# mkfs.xfs -f /dev/sdb12 +
-meta-data=/dev/sdb12             isize=512    agcount=4, agsize=12800 blks +
-                               sectsz=512   attr=2, projid32bit=1 +
-                               crc=1        finobt=1, sparse=1, rmapbt=0 +
-                               reflink=1 +
-data                           bsize=4096   blocks=51200, imaxpct=25 +
-                               sunit=0      swidth=0 blks +
-naming   =version 2              bsize=4096   ascii-ci=0, ftype=1 +
-log      =internal log           bsize=4096   blocks=1368, version=2 +
-                               sectsz=512   sunit=0 blks, lazy-count=1 +
-realtime =none                   extsz=4096   blocks=0, rtextents=0 +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** - Notez l'utilisation de l'option **-f** afin d'écraser le système de fichiers Ext4 existant. +
-</WRAP> +
- +
-Les options de cette commande sont :+
  
 <code> <code>
-[root@centos8 ~]# mkfs.xfs --help +[root@redhat9 tmp]# systemctl isolate rescue
-mkfs.xfs: invalid option -- '-' +
-unknown option --  +
-Usage: mkfs.xfs +
-/* blocksize */ [-b size=num] +
-/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1] +
-/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num, +
-     (sunit=value,swidth=value|su=num,sw=num|noalign), +
-     sectsize=num +
-/* force overwrite */ [-f] +
-/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2, +
-     projid32bit=0|1,sparse=0|1] +
-/* no discard */ [-K] +
-/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n +
-     sunit=value|su=num,sectsize=num,lazy-count=0|1] +
-/* label */ [-L label (maximum 12 characters)] +
-/* naming */ [-n size=num,version=2|ci,ftype=0|1] +
-/* no-op info only */ [-N] +
-/* prototype file */ [-p fname] +
-/* quiet */ [-q] +
-/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx] +
-/* sectorsize */ [-s size=num] +
-/* version */ [-V] +
- devicename +
-<devicename> is required unless -d name=xxx is given. +
-<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB), +
-      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB). +
-<value> is xxx (512 byte blocks). +
-</code>+
  
-Consultez maintenant les caractéristiques du système de fichier :+[root@redhat9 tmp]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
 +  rescue.target          loaded active active      Rescue Mode
  
-<code> +[root@redhat9 tmp]# runlevel 
-[root@centos8 ~]# xfs_info /dev/sdb12 +1
-meta-data=/dev/sdb12             isize=512    agcount=4, agsize=12800 blks +
-                               sectsz=512   attr=2, projid32bit=1 +
-                               crc=1        finobt=1, sparse=1, rmapbt=0 +
-                               reflink=1 +
-data                           bsize=4096   blocks=51200, imaxpct=25 +
-                               sunit=0      swidth=0 blks +
-naming   =version 2              bsize=4096   ascii-ci=0, ftype=1 +
-log      =internal log           bsize=4096   blocks=1368, version=2 +
-                               sectsz=512   sunit=0 blks, lazy-count=1 +
-realtime =none                   extsz=4096   blocks=0, rtextents=0 +
-</code>+
  
-Les options de cette commande sont : +[root@redhat9 tmp]# who -r 
- +         run-level 1  2024-10-24 11:48                   last=5
-<code> +
-[root@centos8 ~]# xfs_info --help +
-/usr/sbin/xfs_info: illegal option -- - +
-Usagexfs_info [-V] [-t mtab] [mountpoint|device|file]+
 </code> </code>
- 
-===LAB #19 - Ajouter une Etiquette au Système de Fichiers XFS=== 
- 
-Utilisez la commande **xfs_admin** pour associer une étiquette au système de fichiers : 
  
 <code> <code>
-[root@centos8 ~]# xfs_admin -L my_xfs /dev/sdb12 +[root@redhat9 tmp]# systemctl isolate graphical
-xfs_admin: /dev/sdb12 contains a mounted filesystem+
  
-fatal error -- couldn't initialize XFS library+[root@redhat9 tmp]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
 +  graphical.target       loaded active active Graphical Interface
  
-[root@centos8 ~]# umount /dev/sdb12+[root@redhat9 tmp]# runlevel 
 +1 5
  
-[root@centos8 ~]# xfs_admin -L my_xfs /dev/sdb12 +[root@redhat9 tmp]# who -r 
-writing all SBs +         run-level 5  2024-10-24 11:50                   last=1
-new label "my_xfs"+
 </code> </code>
  
-<WRAP center round important 60%> +=====Arrêt du Système=====
-**Important** - Notez que la partition XFS doit être démonté pour pouvoir utiliser la commande **xfs_admin**. +
-</WRAP>+
  
-Pour voir l'étiquetteutilisez la commande suivante :+Sous Red Hat 9 les commandes **halt****poweroff**, **reboot** et **shutdown** sont des liens symboliques vers **/bin/systemctl** :
  
 <code> <code>
-[root@centos8 ~]# xfs_admin -l /dev/sdb12 +[root@redhat9 tmp]# ls -l /usr/sbin/shutdown /usr/sbin/halt /usr/sbin/poweroff /usr/sbin/reboot 
-label = "my_xfs"+lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/sbin/halt -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/sbin/poweroff -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/sbin/reboot -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Jul 18 13:00 /usr/sbin/shutdown -> ../bin/systemctl
 </code> </code>
  
-<WRAP center round important 60%> +La manière recommendée d'utiliser ces commandes est donc :
-**Important** - Notez que l'étiquette doit être de 12 caractères maximum. +
-</WRAP>+
  
-Les options de cette commande sont :+  * systemctl halt 
 +  * systemctl poweroff 
 +  * systemctl reboot 
 +  * systemctl shutdown
  
-<code> +Il est cependant toujours possibles d'utiliser les commandes **halt**, **poweroff**, **reboot** et **shutdown**.
-[root@centos8 ~]# xfs_admin --help +
-/usr/sbin/xfs_admin: illegal option -- - +
-Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device +
-</code>+
  
-Dernièrement, pour obtenir seul l'UUID du système de fichiers, utilisez la commande **xfs-admin** et l'option **-u** :+====La Commande shutdown====
  
-<code> +Lors de l'arrêt de la machine, Linux procède, entre autre, aux tâches suivantes :
-[root@centos8 ~]# xfs_admin -u /dev/sdb12 +
-UUID = 15db1b62-0866-4aa4-9ac1-3ac325a4e20f +
-</code>+
  
-<WRAP center round important 60%> +  * Il previent les utilisateurs,  
-**Important** - La commande **xfs_metadump** est utilisée pour sauvegarder les méta-données du système de fichierstandis que la commande **xfs_mdrestore** est utilisée pour restaurer les les méta-données du système de fichiers. +  Il arrête tous les services, 
-</WRAP>+  Il inscrit toutes les données sur disque, 
 +  Il démonte les systèmes de fichiers.
  
-=====Autres Systèmes de Fichiers=====+La commande utilisée pour arrêter le système est la commande **shutdown** :
  
-<WRAP center round important 60%> +  shutdown [-t sec] [-HPrhkc] heure [message]
-**Important** Veuillez noter que le support des systèmes de fichiers **ReiserFS**, **JFS** et **Btrfs** est **absent** du noyau des distributions de Red Hat. +
-</WRAP>+
  
-====ReiserFS====+===Options de la commande===
  
-%%ReiserFS%% permet : +Les options de cette commande sont :
- +
-  * de meilleurs temps d'accès à des sous-répertoires que Ext3, même ceux contenant des dizaines de milliers de fichiers, +
-  * une plus grande efficacité pour ce qui concerne le stockage des fichiers moins de quelques ko. Le gain d'espace peut aller jusqu'à 10% par rapport à Ext2/Ext3. +
- +
-Pour plus d'informations concernant %%ReiserFS%%, consultez **[[http://en.wikipedia.org/wiki/ReiserFS|cette page]]**. +
- +
-====JFS==== +
- +
-JFS //Journaled File System// est un système de fichiers journalisé mis au point par IBM et disponible sous licence GPL. +
- +
-Pour plus d'informations concernant JFS, consultez **[[http://en.wikipedia.org/wiki/JFS_(file_system)|cette page]]**. +
- +
-====Btrfs==== +
- +
-**[[https://btrfs.wiki.kernel.org/|Btrfs]]**, (B-tree file system, prononcé ButterFS) est un système de fichiers expérimental basé sur la copie sur écriture sous licence GNU GPL, développé principalement par Oracle, Red Hat, Fujitsu, Intel, SUSE et STRATO AG, qui s'inspire grandement du système de fichiers ZFS utilisé par Solaris. +
- +
-A noter sont les points suivants : +
- +
-  * Btrfs utilise des extents, +
-  * Btrfs stocke les données des très petits fichiers directement dans l'extent du fichier répertoire, et non dans un extent séparé, +
-  * Btrfs gère une notion de « sous-volumes » permettant ainsi des snapshots, +
-  * Btrfs possède ses techniques propres de protection des données, +
-  * Btrfs permet de redimensionner à chaud la taille du système de fichiers, +
-  * Btrfs gère le RAID 0 ainsi que le RAID 1 logiciel, +
-  * Btrfs gère la comprssion du système de fichiers. +
- +
-=====Comparaison des Commandes par Système de Fichiers===== +
- +
-^ Description ^ Ext3 ^ Ext4 ^ XFS ^ ReiserFS ^ JFS ^ Btrfs ^ +
-| Build a Linux filesystem | mkfs.ext3 (mke2fs -j) | mkfs.ext4 (mke4fs) | mkfs.xfs | mkfs.reiserfs (mkreiserfs) | mkfs.jfs (jfs_mkfs) | mkfs.btrfs | +
-| Check a Linux filesystem | e2fsck | e2fsck | xfs_check / xfs_repair | reiserfsck | jfs_fsck | btrfsck | +
-| Adjust tunable filesystem parameters Linux filesystems | tune2fs | tune2fs | xfs_admin | reiserfstune | jfs_tune | btrfs-show-super, btrfs filesystem show, et btrfs filesystem df | +
-| File system resizer | resize2fs | resize2fs | xfs_growfs | resize_reiserfs | S/O | btrfs filesystem resize | +
-| Dump filesystem information | dumpe2fs | dumpe2fs | xfs_info / xfs_metadump | debugreiserfs | jfs_tune | btrfstune | +
-| File system debugger | debugfs | debugfs | xfs_db | debugreiserfs | jfs_debugfs | btrfs-debug-tree | +
-| Change the label on a filesystem | e2label | e2label | xfs_admin | reiserfstune | jfs_tune | btrfs filesystem label | +
- +
-=====LAB #20 - Créer un Système de Fichiers ISO===== +
- +
-====La Commande mkisofs==== +
- +
-Pour créer un fichier ISO à partir d'une arborescence de fichiers, il convient d'utiliser la commande **mkisofs** :+
  
 <code> <code>
-[root@centos8 ~]# cd /tmp +[root@redhat9 tmp]# shutdown --help 
-[root@centos8 tmp]# mkisofs --T -o tmp.iso . +shutdown [OPTIONS...] [TIME] [WALL...]
-I: -input-charset not specified, using utf-8 (detected in locale settings) +
-Total translation table size: 1827 +
-Total rockridge attributes bytes: 1976 +
-Total directory bytes: 14336 +
-Path table size(bytes): 122 +
-Max brk space used 1c000 +
-186 extents written (0 MB) +
-</code>+
  
-Le fichier ISO peut être monter en utilisant un périphérique de type **loop** :+Shut down the system.
  
-<code> 
-[root@centos8 tmp]# mount tmp.iso /mnt -o loop 
-mount: /mnt: WARNING: device write-protected, mounted read-only. 
-[root@centos8 tmp]# ls /mnt 
-systemd-private-192104a9224f499286f5adb5754e9e04-chronyd.service-FI2YXs  TRANS.TBL  vg0_backup 
-[root@centos8 tmp]# ls  
-systemd-private-192104a9224f499286f5adb5754e9e04-chronyd.service-FI2YXs  tmp.iso  vg0_backup 
-</code> 
- 
-Démontez maintenant le fichier ISO : 
- 
-<code> 
-[root@centos8 tmp]# cd ~ 
-[root@centos8 ~]# umount /tmp/tmp.iso 
-</code> 
- 
-====Options de la Commande mkisofs==== 
- 
-Les options de cette commande sont : 
- 
-<code> 
-[root@centos8 ~]# mkisofs --help 
-Usage: genisoimage [options] file... 
 Options: Options:
-  -nobak                      Do not include backup files +     --help      Show this help 
-  -no-bak                     Do not include backup files +  ---halt      Halt the machine 
-  -abstract FILE              Set Abstract filename +  -P --poweroff  Power-off the machine 
-  -A ID, -appid ID            Set Application ID +  ---reboot    Reboot the machine 
-  -biblio FILE                Set Bibliographic filename +  -h             Equivalent to --poweroffoverridden by --halt 
-  -cache-inodes               Cache inodes (needed to detect hard links) +  -k             Don'halt/power-off/rebootjust send warnings 
-  -no-cache-inodes            Do not cache inodes (if filesystem has no unique unides) +     --no-wall   Don't send wall message before halt/power-off/reboot 
-  -check-oldnames             Check all imported ISO9660 names from old session +  -            Cancel a pending shutdown 
-  -check-session FILE         Check all ISO9660 names from previous session +     --show      Show pending shutdown
-  -copyright FILE             Set Copyright filename +
-  -debug                      Set debug flag +
-  -b FILE, -eltorito-boot FILE +
-                              Set El Torito boot image name +
-  -e FILE, -efi-boot FILE     Set EFI boot image name +
-  -eltorito-alt-boot          Start specifying alternative El Torito boot parameters +
-  -B FILES, -sparc-boot FILES Set sparc boot image names +
-  -sunx86-boot FILES          Set sunx86 boot image names +
-  -G FILE, -generic-boot FILE Set generic boot image name +
-  -sparc-label label text     Set sparc boot disk label +
-  -sunx86-label label text    Set sunx86 boot disk label +
-  -c FILE, -eltorito-catalog FILE +
-                              Set El Torito boot catalog name +
-  -C PARAMS, -cdrecord-params PARAMS +
-                              Magic paramters from cdrecord +
-  -d, -omit-period            Omit trailing periods from filenames (violates ISO9660) +
-  -dir-mode mode              Make the mode of all directories this mode. +
-  -D, -disable-deep-relocation +
-                              Disable deep directory relocation (violates ISO9660) +
-  -file-mode mode             Make the mode of all plain files this mode. +
-  -f, -follow-links           Follow symbolic links +
-  -gid gid                    Make the group owner of all files this gid. +
-  -graft-points               Allow to use graft points for filenames +
-  -root DIR                   Set root directory for all new files and directories +
-  -old-root DIR               Set root directory in previous session that is searched for files +
-  -help                       Print option help +
-  -hide GLOBFILE              Hide ISO9660/RR file +
-  -hide-list FILE             File with list of ISO9660/RR files to hide +
-  -hidden GLOBFILE            Set hidden attribute on ISO9660 file +
-  -hidden-list FILE           File with list of ISO9660 files with hidden attribute +
-  -hide-joliet GLOBFILE       Hide Joliet file +
-  -hide-joliet-list FILE      File with list of Joliet files to hide +
-  -hide-joliet-trans-tbl      Hide TRANS.TBL from Joliet tree +
-  -hide-rr-moved              Rename RR_MOVED to .rr_moved in Rock Ridge tree +
-  -gui                        Switch behaviour for GUI +
-  -i ADD_FILES                No longer supported +
-  -input-charset CHARSET      Local input charset for file name conversion +
-  -output-charset CHARSET     Output charset for file name conversion +
-  -iso-level LEVEL            Set ISO9660 conformance level (1..3) or 4 for ISO9660 version 2 +
-  -J, -joliet                 Generate Joliet directory information +
-  -joliet-long                Allow Joliet file names to be 103 Unicode characters +
-  -jcharset CHARSET           Local charset for Joliet directory information +
-  -l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names +
-  -max-iso9660-filenames      Allow 37 character filenames for ISO9660 names (violates ISO9660) +
-  -allow-limited-size         Allow different file sizes in ISO9660/UDF on large files +
-  -allow-leading-dots         Allow ISO9660 filenames to start with '.' (violates ISO9660) +
-  -ldots                      Allow ISO9660 filenames to start with '.' (violates ISO9660) +
-  -L, -allow-leading-dots     Allow ISO9660 filenames to start with '.' (violates ISO9660) +
-  -log-file LOG_FILE          Re-direct messages to LOG_FILE +
-  -m GLOBFILE, -exclude GLOBFILE +
-                              Exclude file name +
-  -exclude-list FILE          File with list of file names to exclude +
-  -pad                        Pad output to a multiple of 32k (default) +
-  -no-pad                     Do not pad output to a multiple of 32k +
-  -M FILE, -prev-session FILE Set path to previous session to merge +
-  -dev SCSIdev                Set path to previous session to merge +
-  -N, -omit-version-number    Omit version number from ISO9660 filename (violates ISO9660) +
-  -new-dir-mode mode          Mode used when creating new directories. +
-  -force-rr                   Inhibit automatic Rock Ridge detection for previous session +
-  -no-rr                      Inhibit reading of Rock Ridge attributes from previous session +
-  -no-split-symlink-components +
-                              Inhibit splitting symlink components +
-  -no-split-symlink-fields    Inhibit splitting symlink fields +
-  -o FILE, -output FILE       Set output file name +
-  -path-list FILE             File with list of pathnames to process +
-  -p PREP, -preparer PREP     Set Volume preparer +
-  -print-size                 Print estimated filesystem size and exit +
-  -publisher PUB              Set Volume publisher +
-  -P PUB, -publisher PUB      Set Volume publisher +
-  -quiet                      Run quietly +
-  -r, -rational-rock          Generate rationalized Rock Ridge directory information +
-  -R, -rock                   Generate Rock Ridge directory information +
-  -s TYPE, -sectype TYPE      Set output sector type to e.g. data/xa1/raw +
-  -alpha-boot FILE            Set alpha boot image name (relative to image root) +
-  -hppa-cmdline CMDLINE       Set hppa boot command line (relative to image root) +
-  -hppa-kernel-32 FILE        Set hppa 32-bit image name (relative to image root) +
-  -hppa-kernel-64 FILE        Set hppa 64-bit image name (relative to image root) +
-  -hppa-bootloader FILE       Set hppa boot loader file name (relative to image root) +
-  -hppa-ramdisk FILE          Set hppa ramdisk file name (relative to image root) +
-  -mips-boot FILE             Set mips boot image name (relative to image root) +
-  -mipsel-boot FILE           Set mipsel boot image name (relative to image root) +
-  -jigdo-jigdo FILE           Produce a jigdo .jigdo file as well as the .iso +
-  -jigdo-template FILE        Produce a jigdo .template file as well as the .iso +
-  -jigdo-min-file-size SIZE   Minimum size for a file to be listed in the jigdo file +
-  -jigdo-force-md5 PATTERN    Pattern(s) where files MUST match an externally-supplied MD5sum +
-  -jigdo-exclude PATTERN      Pattern(s) to exclude from the jigdo file +
-  -jigdo-map PATTERN1=PATTERN2 +
-                              Pattern(s) to map paths (e.g. Debian=/mirror/debian) +
-  -md5-list FILE              File containing MD5 sums of the files that should be checked +
-  -jigdo-template-compress ALGORITHM +
-                              Choose to use gzip or bzip2 compression for template data; default is gzip +
-  -checksum_algorithm_iso alg1,alg2,... +
-                              Specify the checksum types desired for the output image +
-  -checksum_algorithm_template alg1,alg2,... +
-                              Specify the checksum types desired for the output jigdo template +
-  -sort FILE                  Sort file content locations according to rules in FILE +
-  -split-output               Split output into files of approx. 1GB size +
-  -stream-file-name FILE_NAME Set the stream file ISO9660 name (incl. version) +
-  -stream-media-size #        Set the size of your CD media in sectors +
-  -sysid ID                   Set System ID +
-  -T, -translation-table      Generate translation tables for systems that don'understand long filenames +
-  -table-name TABLE_NAME      Translation table file name +
-  -ucs-level LEVEL            Set Joliet UCS level (1..3) +
-  -udf                        Generate UDF file system +
-  -dvd-video                  Generate DVD-Video compliant UDF file system +
-  -uid uid                    Make the owner of all files this uid. +
-  -U-untranslated-filenames Allow Untranslated filenames (for HPUX & AIX - violates ISO9660). Forces -l, -d, -N, -allow-leading-dots, -relaxed-filenames, -allow-lowercase, -allow-multidot +
-  -relaxed-filenames          Allow 7 bit ASCII except lower case characters (violates ISO9660) +
-  -no-iso-translate           Do not translate illegal ISO characters '~', '-' and '#' (violates ISO9660) +
-  -allow-lowercase            Allow lower case characters in addition to the current character set (violates ISO9660) +
-  -allow-multidot             Allow more than one dot in filenames (e.g. .tar.gz) (violates ISO9660) +
-  -use-fileversion LEVEL      Use file version # from filesystem +
-  -v, -verbose                Verbose +
-  -version                    Print the current version +
-  -V ID, -volid ID            Set Volume ID +
-  -volset ID                  Set Volume set ID +
-  -volset-size #              Set Volume set size +
-  -volset-seqno #             Set Volume set sequence number +
-  -x FILE, -old-exclude FILE  Exclude file name(depreciated) +
-  -hard-disk-boot             Boot image is a hard disk image +
-  -no-emul-boot               Boot image is 'no emulation' image +
-  -no-boot                    Boot image is not bootable +
-  -boot-load-seg #            Set load segment for boot image +
-  -boot-load-size #           Set numbers of load sectors +
-  -boot-info-table            Patch boot image with info table +
-  -XA                         Generate XA directory attruibutes +
-  -xa                         Generate rationalized XA directory attruibutes +
-  -z, -transparent-compression +
-                              Enable transparent compression of files +
-  -hfs-type TYPE              Set HFS default TYPE +
-  -hfs-creator CREATOR        Set HFS default CREATOR +
-  -g, -apple                  Add Apple ISO9660 extensions +
-  -h, -hfs                    Create ISO9660/HFS hybrid +
-  -map MAPPING_FILE           Map file extensions to HFS TYPE/CREATOR +
-  -H MAPPING_FILE, -map MAPPING_FILE +
-                              Map file extensions to HFS TYPE/CREATOR +
-  -magic FILE                 Magic file for HFS TYPE/CREATOR +
-  -probe                      Probe all files for Apple/Unix file types +
-  -mac-name                   Use Macintosh name for ISO9660/Joliet/RockRidge file name +
-  -no-mac-files               Do not look for Unix/Mac files (depreciated) +
-  -boot-hfs-file FILE         Set HFS boot image name +
-  -part                       Generate HFS partition table +
-  -cluster-size SIZE          Cluster size for PC Exchange Macintosh files +
-  -auto FILE                  Set HFS AutoStart file name +
-  -no-desktop                 Do not create the HFS (empty) Desktop files +
-  -hide-hfs GLOBFILE          Hide HFS file +
-  -hide-hfs-list FILE         List of HFS files to hide +
-  -hfs-volid HFS_VOLID        Volume name for the HFS partition +
-  -icon-position              Keep HFS icon position +
-  -root-info FILE             finderinfo for root folder +
-  -input-hfs-charset CHARSET  Local input charset for HFS file name conversion +
-  -output-hfs-charset CHARSET Output charset for HFS file name conversion +
-  -hfs-unlock                 Leave HFS Volume unlocked +
-  -hfs-bless FOLDER_NAME      Name of Folder to be blessed +
-  -hfs-parms PARAMETERS       Comma separated list of HFS parameters +
-  -prep-boot FILE             PReP boot image file -- up to 4 are allowed +
-  -chrp-boot                  Add CHRP boot header +
-  --cap                       Look for AUFS CAP Macintosh files +
-  --netatalk                  Look for NETATALK Macintosh files +
-  --double                    Look for AppleDouble Macintosh files +
-  --ethershare                Look for Helios EtherShare Macintosh files +
-  --exchange                  Look for PC Exchange Macintosh files +
-  --sgi                       Look for SGI Macintosh files +
-  --macbin                    Look for MacBinary Macintosh files +
-  --single                    Look for AppleSingle Macintosh files +
-  --ushare                    Look for IPT UShare Macintosh files +
-  --xinet                     Look for XINET Macintosh files +
-  --dave                      Look for DAVE Macintosh files +
-  --sfm                       Look for SFM Macintosh files +
-  --osx-double                Look for MacOS X AppleDouble Macintosh files +
-  --osx-hfs                   Look for MacOS X HFS Macintosh files+
  
-Report problems to debburn-devel@lists.alioth.debian.org.+See the shutdown(8) man page for details.
 </code> </code>
  
-=====Systèmes de Fichiers Chiffrés sous RHEL/CentOS 8=====+L'option **heure** peut prendre plusieurs valeurs :
  
-====LAB #21 - Créer un Système de Fichiers Chiffré avec LUKS sous RHEL/CentOS 8===== +^ Valeur ^ Description ^ 
- +| hh:mm | L'heure à laquelle l'opération aura lieu | 
-===Présentation=== +| +m | Nombre de minutes avant que l'opération aura lieuSi aucune valeur n'est spécifiée, la valeur par défaut est +| 
- +| now | L'opération est immédiatenow est un alias de +0 |
-**LUKS** ( Linux Unified Key Setup ) permet de chiffrer l'intégralité d'un disque de telle sorte que celui-ci soit utilisable sur d'autres plates-formes et distributions de Linux (voire d'autres systèmes d'exploitation)Il supporte jusqu'à 8 mots de passeafin que plusieurs utilisateurs soient en mesure de déchiffrer le même volume sans partager leur mot de passe. +
- +
-===Mise en Place=== +
- +
-Remplissez la partition /dev/sdb12 avec des données aléatoires : +
- +
-<code> +
-[root@centos8 ~]# shred -v --iterations=/dev/sdb12 +
-shred: /dev/sdb12: pass 1/1 (random)... +
-</code>+
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : L'étape ci-dessus est très importante parce que elle permet de s'assurer qu'aucune donnée ne reste sur la partition.+**Important** : Si l'opération est programmée pour dans moins de 5 minutes, les connexions supplémentaires sont interdites, y comprises les tentatives de connexion de root
 </WRAP> </WRAP>
  
-Initialisez la partition avec LUKS :+L'option **-t** est utilisée pour accorder un temps de grâce :
  
 <code> <code>
-[root@centos8 ~]# cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb12 +[root@redhat9 tmp]# date && shutdown -t 60 -k 
- +Thu Oct 24 11:53:34 AM CEST 2024 
-WARNING! +Shutdown scheduled for Thu 2024-10-24 11:54:34 CEST, use 'shutdown -c' to cancel.
-======== +
-This will overwrite data on /dev/sdb12 irrevocably. +
- +
-Are you sure? (Type 'yes' in capital letters)YES +
-Enter passphrase for /dev/sdb12fenestros123456789 +
-Verify passphrasefenestros123456789 +
-Key slot 0 created. +
-Command successful.+
 </code> </code>
  
-<WRAP center round important 60%> +==== La Commande reboot====
-**Important** : La passphrase ne sera pas en claire. Elle l'est ici pour vous montrer un mot de passe acceptable pour LUKS. +
-</WRAP>+
  
-Ouvrez la partition LUKS en lui donnant le nom **sdb12** :+Cette commande redémarre le système.
  
-<code> +===Options de la commande===
-[root@centos8 ~]# cryptsetup luksOpen /dev/sdb12 sdb12 +
-Enter passphrase for /dev/sdb12: fenestros123456789 +
-</code>+
  
-Vérifiez que le système voit la partition :+Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# ls -l /dev/mapper | grep sdb12 +[root@redhat9 tmp]# reboot --help 
-lrwxrwxrwx1 root root       7 Jun  2 10:03 sdb12 -> ../dm-2 +reboot [OPTIONS...] [ARG]
-</code>+
  
-Créez maintenant un système de fichiers sur **/dev/mapper/sdb12** :+Reboot the system.
  
-<code> +Options: 
-[root@centos8 ~]# mkfs.xfs /dev/mapper/sdb12 +     --help      Show this help 
-meta-data=/dev/mapper/sdb12      isize=512    agcount=4, agsize=11776 blks +     --halt      Halt the machine 
-         =                       sectsz=512   attr=2, projid32bit=1 +  -p --poweroff  Switch off the machine 
-         =                       crc=1        finobt=1, sparse=1, rmapbt=0 +     --reboot    Reboot the machine 
-         =                       reflink=1 +  -f --force     Force immediate halt/power-off/reboot 
-data     =                       bsize=4096   blocks=47104, imaxpct=25 +  -w --wtmp-only Don't halt/power-off/rebootjust write wtmp record 
-         =                       sunit=0      swidth=0 blks +  -d --no-wtmp   Don't write wtmp record 
-naming   =version 2              bsize=4096   ascii-ci=0ftype=1 +     --no-wall   Don't send wall message before halt/power-off/reboot
-log      =internal log           bsize=4096   blocks=1368, version=2 +
-         =                       sectsz=512   sunit=0 blks, lazy-count=1 +
-realtime =none                   extsz=4096   blocks=0, rtextents=0 +
-</code>+
  
-Montez la partition LUKS : +See the halt(8) man page for details.
- +
-<code> +
-[root@centos8 ~]# mount /dev/mapper/sdb12 /mnt/sdb12+
 </code> </code>
  
-Vérifiez la présence du montage :+==== La Commande halt====
  
-<code> +Cette commande arrête le système.
-[root@centos8 ~]# df -h | grep sdb12 +
-/dev/mapper/sdb12  179M   11M  168M   6% /mnt/sdb12 +
-</code>+
  
-Editez le fichier **/etc/crypttab/** :+===Options de la commande===
  
-<code> +Les options de cette commande sont :
-[root@centos8 ~]# vi /etc/crypttab +
-[root@centos8 ~]# cat /etc/crypttab +
-sdb12 /dev/sdb12 none +
-</code> +
- +
-Modifiez le fichier **/etc/fstab** :+
  
 <code> <code>
-[root@centos8 ~]# vi /etc/fstab +[root@redhat9 tmp]# halt --help 
-[root@centos8 ~]# cat /etc/fstab +halt [OPTIONS...]
- +
-+
-# /etc/fstab +
-# Created by anaconda on Fri May  8 07:35:23 2020 +
-+
-# Accessible filesystems, by reference, are maintained under '/dev/disk/'+
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. +
-+
-# After editing this file, run 'systemctl daemon-reload' to update systemd +
-# units generated from this file. +
-+
-UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c /                       xfs     defaults        0 0 +
-UUID=2ae4c035-9244-458c-82c5-a49ae169cdb6 /boot                   ext4    defaults        1 2 +
-UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 swap                    swap    defaults        0 0 +
-/dev/mapper/sdb12   /mnt/sdb12   xfs   defaults   0 0 +
-</code> +
- +
-Restaurer les SC par défaut de SELinux : +
- +
-<code> +
-[root@centos8 ~]# /sbin/restorecon -v -R /mnt/sdb12 +
-Relabeled /mnt/sdb12 from system_u:object_r:unlabeled_t:s0 to system_u:object_r:mnt_t:s0 +
-</code> +
- +
-Redémarrez votre machine virtuelle : +
- +
-<code> +
-[root@centos8 ~]# shutdown -r now +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Lors du démarrage de la machine virtuelle, le système devrait vous demander d'entrer la passphrase **fenestros123456789** pour permettre le montage de /dev/sda12. +
-</WRAP> +
- +
-===Ajouter une deuxième Passphrase=== +
- +
-Pour ajouter une deuxième passphrase, utilisez la commande cryptsetup avec la sous-commande **luksAddKey** : +
- +
-<code> +
-[trainee@centos8 ~]$ su - +
-Password: fenestros +
-[root@centos8 ~]# cryptsetup luksAddKey /dev/sdb12 +
-Enter any existing passphrase: fenestros123456789 +
-Enter new passphrase for key slot: redhat123456789 +
-Verify passphrase: redhat123456789 +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Les passphrases ne seront pas en claireElle le sont ici pour vous montrer des mots de passe acceptables pour LUKS. +
-</WRAP> +
- +
-===Supprimer une Passphrase=== +
- +
-Pour supprimer une passphrase, utilisez la commande cryptsetup avec la sous-commande **luksRemoveKey** : +
- +
-<code> +
-[root@centos8 ~]# cryptsetup luksRemoveKey /dev/sdb12 +
-Enter passphrase to be deleted: redhat123456789 +
-</code> +
- +
-Avant de poursuivre, éditez les fichiers **/etc/fstab** et **/etc/crypttab** : +
- +
-<code> +
-[root@centos8 ~]# vi /etc/fstab +
-[root@centos8 ~]# cat /etc/fstab +
- +
-+
-# /etc/fstab +
-# Created by anaconda on Fri May  8 07:35:23 2020 +
-+
-# Accessible filesystems, by reference, are maintained under '/dev/disk/'+
-# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. +
-+
-# After editing this file, run 'systemctl daemon-reload' to update systemd +
-# units generated from this file. +
-+
-UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c /                       xfs     defaults        0 0 +
-UUID=2ae4c035-9244-458c-82c5-a49ae169cdb6 /boot                   ext4    defaults        1 2 +
-UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 swap                    swap    defaults        0 0 +
- +
-[root@centos8 ~]# vi /etc/crypttab +
-[root@centos8 ~]# cat /etc/crypttab +
-[root@centos8 ~]#  +
-</code> +
- +
-=====Le Swap===== +
- +
-====Taille du swap==== +
- +
-Le tableau suivant résume la taille du swap recommandée en fonction de la mémoire de la machine : +
- +
-^ Mémoire ^ Taille du swap ^ +
-| 4 Go ou moins | 2 Go | +
-| 4 Go à 16 Go | 4 Go | +
-| 16 Go à 64 Go | 8 Go | +
-| 64 Go à 256 Go | 16 Go | +
- +
-====Partitions de swap==== +
- +
-Une partition de swap peut être créée sur : +
- +
-  * une partition du disque dur +
-  * un RAID logiciel +
-  * un Volume Logique +
- +
-====La Commande swapon==== +
- +
-Pour préparer un espace de swap, il convient d'utiliser la commande **mkswap**. Pour activer une partition de swap, il convient d'utiliser la commande **swapon**. Pour consulter la liste des partitions swap, il convient d'utiliser la commande **swapon** avec l'option **-s**. +
- +
-<code> +
-[root@centos8 ~]# swapon -s +
-Filename Type Size Used Priority +
-/dev/dm-1                               partition       3358716 0       -2 +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Vous noterez que dans l'exemple ci-dessus, le swap n'est pas utilisé. Notez aussi qu'il existe une notion de **priorité** pour les partions de swap. +
-</WRAP> +
- +
-===Options de la Commande=== +
- +
-Les options de la commande swapon sont : +
- +
-<code> +
-[root@centos8 ~]# swapon --help +
- +
-Usage: +
- swapon [options] [<spec>]+
  
-Enable devices and files for paging and swapping.+Halt the system.
  
 Options: Options:
- -a, --all                enable all swaps from /etc/fstab +     --help      Show this help 
- -d, --discard[=<policy>] enable swap discards, if supported by device +     --halt      Halt the machine 
- -e, --ifexists           silently skip devices that do not exist +  ---poweroff  Switch off the machine 
- -f, --fixpgsz            reinitialize the swap space if necessary +     --reboot    Reboot the machine 
- -o, --options <list>     comma-separated list of swap options +  ---force     Force immediate halt/power-off/reboot 
- -p, --priority <prio>    specify the priority of the swap device +  ---wtmp-only Don'halt/power-off/reboot, just write wtmp record 
- -s, --summary            display summary about used swap devices (DEPRECATED) +  ---no-wtmp   Don't write wtmp record 
-     --show[=<columns>  display summary in definable table +     --no-wall   Don't send wall message before halt/power-off/reboot
-     --noheadings         don'print table heading (with --show) +
-     --raw                use the raw output format (with --show) +
-     --bytes              display swap size in bytes in --show output +
- -v, --verbose            verbose mode+
  
- -h, --help               display this help +See the halt(8) man page for details.
- -V, --version            display version +
- +
-The <spec> parameter: +
- -L <label>             synonym for LABEL=<label> +
- -U <uuid>              synonym for UUID=<uuid> +
- LABEL=<label>          specifies device by swap area label +
- UUID=<uuid>            specifies device by swap area UUID +
- PARTLABEL=<label>      specifies device by partition label +
- PARTUUID=<uuid>        specifies device by partition UUID +
- <device>               name of device to be used +
- <file>                 name of file to be used +
- +
-Available discard policy types (for --discard): +
- once    : only single-time area discards are issued +
- pages   : freed pages are discarded before they are reused +
-If no policy is selected, both discard types are enabled (default). +
- +
-Available output columns: +
- NAME   device file or partition path +
- TYPE   type of the device +
- SIZE   size of the swap area +
- USED   bytes in use +
- PRIO   swap priority +
- UUID   swap uuid +
- LABEL  swap label +
- +
-For more details see swapon(8).+
 </code> </code>
  
-<WRAP center round important 60%> +==== La Commande poweroff====
-**Important** : L'option **-p** de la commande **swapon** permet de régler la priorité. +
-</WRAP>+
  
-====La Commande swapoff====+Cette commande arrête le système et coupe l'alimentation électrique. 
  
-Dans le cas de notre exemple, la partition de swap se trouve sur **/dev/dm-1**. Pour la désactiver, il convient de saisir la commande suivante :+===Options de la commande===
  
-<code> +Les options de cette commande sont :
-[root@centos8 ~]# swapoff /dev/dm-1 +
-[root@centos8 ~]# swapon -s +
-[root@centos8 ~]#  +
-</code> +
- +
-===Options de la Commande===+
  
 <code> <code>
-[root@centos8 ~]# swapoff --help+[root@redhat9 tmp]# poweroff --help 
 +poweroff [OPTIONS...]
  
-Usage: +Power off the system.
- swapoff [options] [<spec>+
- +
-Disable devices and files for paging and swapping.+
  
 Options: Options:
- -a, --all              disable all swaps from /proc/swaps +     --help      Show this help 
- -v, --verbose          verbose mode+     --halt      Halt the machine 
 +  ---poweroff  Switch off the machine 
 +     --reboot    Reboot the machine 
 +  -f --force     Force immediate halt/power-off/reboot 
 +  -w --wtmp-only Don't halt/power-off/rebootjust write wtmp record 
 +  ---no-wtmp   Don't write wtmp record 
 +     --no-wall   Don't send wall message before halt/power-off/reboot
  
- -h, --help             display this help +See the halt(8) man page for details.
- -V, --version          display version +
- +
-The <spec> parameter: +
- -L <label>             LABEL of device to be used +
- -U <uuid>              UUID of device to be used +
- LABEL=<label>          LABEL of device to be used +
- UUID=<uuid>            UUID of device to be used +
- <device>               name of device to be used +
- <file>                 name of file to be used +
- +
-For more details see swapoff(8). +
-</code> +
- +
-====LAB #22 - Créer un Fichier de Swap==== +
- +
-Sous Linux, vous pouvez aussi bien utiliser un fichier de swap qu'une partition. La mise en place de ce fichier est faite en utilisant la commande **dd**.  +
- +
-La commande **dd** copie le fichier passé en entrée dans le fichier de sortie en limitant le nombre d'octets copiés par l'utilisation de deux options : +
- +
-  * **count** +
-    * le nombre +
-  * **bs** +
-    * la taille du bloc à copier +
- +
-Dans le cas du fichier swap il convient d'utiliser le fichier spécial **/dev/zero** en tant que fichier d'entrée. Le fichier **/dev/zero** contient une valeur **null**. +
- +
-Pour créer votre fichier de swap de 268Mo, appelé **swap**, saisissez la commande suivante : +
- +
-<code> +
-[root@centos8 ~]# dd if=/dev/zero of=/swap bs=1024k count=256 +
-256+0 records in +
-256+0 records out +
-268435456 bytes (268 MB, 256 MiB) copied, 0.103048 s, 2.6 GB/s +
-</code> +
- +
-Pour préparer le fichier en tant qu'espace de swap, saisissez la commande suivante : +
- +
-<code> +
-[root@centos8 ~]# mkswap /swap +
-mkswap: /swap: insecure permissions 0644, 0600 suggested. +
-Setting up swapspace version 1, size = 256 MiB (268431360 bytes) +
-no label, UUID=ee6c9e3f-0712-47b1-8f97-17ba215959d7 +
-</code> +
- +
-Pour activer le fichier avec une priorité de **1**, saisissez la commande suivante : +
- +
-<code> +
-[root@centos8 ~]# swapon -p1 /swap +
-swapon: /swap: insecure permissions 0644, 0600 suggested. +
-</code> +
- +
-Pour visualiser les éspaces swap, saisissez la commande suivante : +
- +
-<code> +
-[root@centos8 ~]# swapon -s +
-Filename Type Size Used Priority +
-/swap                                  file    262140 0 1 +
-/dev/dm-1                               partition       3358716 0       -2 +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** : Le fichier de swap ayant une priorité de 1 sera utilisé avant la partition de swap ayant une priorité de -2. +
-</WRAP> +
- +
-<WRAP center round important 60%> +
-**Important** : Pour activer le fichier swap d'une manière permanente, il convient d'ajouter une ligne au fichier **/etc/fstab**. Ne modifiez pas votre fichier **/etc/fstab** car vous allez supprimer le fichier de swap. +
-</WRAP> +
- +
-Désactivez maintenant le fichier swap : +
- +
-<code> +
-[root@centos8 ~]# swapoff /swap +
-[root@centos8 ~]# swapon -s +
-Filename Type Size Used Priority +
-/dev/dm-1                               partition       3358716 0       -2 +
-</code> +
- +
-Supprimez maintenant le fichier de swap : +
- +
-<code> +
-[root@centos8 ~]# rm /swap +
-rm: remove regular file '/swap'? y+
 </code> </code>
  
 ----- -----
 Copyright © 2024 Hugh Norris. Copyright © 2024 Hugh Norris.
Menu