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:centos:8:junior:l123 [2024/10/01 07:41] – created adminelearning:workbooks:centos:8:junior:l123 [2024/10/01 08:05] (Version actuelle) – created admin
Ligne 5: Ligne 5:
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF603 - Gestion des Disques, des Systèmes de Fichiers et du Swap======+======LCF603 - Gestion du Démarrage et de l'Arrêt du Système======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF603 - Gestion des Disques, des Systèmes de Fichiers et du Swap**+  * **LCF603 - 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 +      * LAB #5 - Gestion des Services 
-      * La Commande mkisofs +        * 5.1 - Gestion des Instances Uniques 
-    * Systèmes de Fichiers Chiffrés +        * 5.2 - Gestion d'Instances Multiples 
-      * LAB #21 Créer un Système de Fichiers Chiffré avec LUKS +        * 5.3 - Interdire la Modification du Statut d'un Service 
-        * Présentation +    * Arrêt Système du Système 
-        * Mise en Place +      * La Commande shutdown 
-        * Ajouter une deuxième Passphrase +      * La Commande reboot 
-        * Supprimer une Passphrase +      * La Commande halt 
-    * Raid Logiciel +      * La Commande poweroff
-      * LAB #22 - Mise en Place du RAID 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**, +</WRAP>
-    * Jusqu'à **15**+
-  * **Disques utilisant l'API libata**, +
-    * Jusqu'à **15**.+
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** : Ces limites peuvent être dépassées en utilisant la gestion **LVM** (//Logical Volume Management//).+**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>
  
-=====Partitionnement=====+====Autres Systèmes====
  
-====LAB #1 Partitionnement de votre Disque sous RHEL/CentOS 8 avec fdisk====+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]]**.
  
-Pour procéder au partitionnement de votre disque ou de vos disques, RHEL/CentOS 8 possède l'outil dénommé **fdisk**.+=====Gestionnaires de Démarrage=====
  
-Lancez fdisk en fournissant en argument le fichier de référence de votre premier disque dur, par exemple :+====GRUB 2====
  
-<code> +GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, notamment GRUB 2 sait utiliser des partitions RAID et LVM.
-[root@centos8 ~]# fdisk /dev/sdb+
  
-Welcome to fdisk (util-linux 2.32.1). +Le lancement de GRUB se fait en trois étapes :
-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. +  * 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, 
-Created a new DOS disklabel with disk identifier 0xb0dacb39.+  * Etape 1.5 : Le **core.img**, d'une taille approximative de 25 Ko et stocké dans les secteurs 1 à 62, est lanceSon 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, 
 +  * 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.
  
-Command (m for help) +Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installé, il convient de saisir la commande suivante :
-</code>+
  
-Tapez ensuite la lettre **m** puis <key>Entrée</key> pour obtenir le menu :+  # grub2-install /dev/périphérique [Entrée]
  
-<code> +où **périphérique** est le nom du périphérique ou l'étape 1 de GRUB2 doit s'installer dans le MBR. 
-Command (m for help): m+
  
-Help: +**GRUB 2** lit ses entrées de menus à partir du fichier **/boot/grub2/grub.cfg**. Pour visualiser ce fichier, il convient de saisir la commande suivante :
- +
-  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> <code>
-Command (m for help): n +[root@centos8 ~]# cat /boot/grub2/grub.cfg  
-Partition type +# 
-   p   primary (0 primary, 0 extended, 4 free) +# DO NOT EDIT THIS FILE 
-   e   extended (container for logical partitions) +# 
-Select (default p): +# It is automatically generated by grub2-mkconfig using templates 
 +# from /etc/grub.d and settings from /etc/default/grub 
 +#
  
-Using default response p+### BEGIN /etc/grub.d/00_header ### 
-Partition number (1-4, default 1):  +set pager=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.+if [ -f ${config_directory}/grubenv ]; then 
 +  load_env -f ${config_directory}/grubenv 
 +elif [ -s $prefix/grubenv ]; then 
 +  load_env 
 +fi 
 +if [ "${next_entry}" ] ; then 
 +   set default="${next_entry}" 
 +   set next_entry= 
 +   save_env next_entry 
 +   set boot_once=true 
 +else 
 +   set default="${saved_entry}" 
 +fi
  
-Command (m for help): n +if [ x"${feature_menuentry_id}" = xy ]; then 
-Partition type +  menuentry_id_option="--id" 
-   p   primary (1 primary, 0 extended, 3 free) +else 
-   e   extended (container for logical partitions) +  menuentry_id_option="" 
-Select (default p): +fi
  
-Using default response p. +export menuentry_id_option
-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.+if [ "${prev_saved_entry}" ]; then 
 +  set saved_entry="${prev_saved_entry}" 
 +  save_env saved_entry 
 +  set prev_saved_entry= 
 +  save_env prev_saved_entry 
 +  set boot_once=true 
 +fi
  
-Command (m for help): n +function savedefault { 
-Partition type +  if [ -z "${boot_once}" ]; then 
-   p   primary (2 primary, 0 extended, 2 free) +    saved_entry="${chosen}" 
-   e   extended (container for logical partitions) +    save_env saved_entry 
-Select (default p): +  fi 
 +}
  
-Using default response p. +function load_video { 
-Partition number (3,4, default 3):  +  if [ x$feature_all_video_module = xy ]; then 
-First sector (411648-8388607, default 411648):  +    insmod all_video 
-Last sector, +sectors or +size{K,M,G,T,P(411648-8388607, default 8388607): +100M+  else 
 +    insmod efi_gop 
 +    insmod efi_uga 
 +    insmod ieee1275_fb 
 +    insmod vbe 
 +    insmod vga 
 +    insmod video_bochs 
 +    insmod video_cirrus 
 +  fi 
 +}
  
-Created a new partition 3 of type 'Linux' and of size 100 MiB.+terminal_output console 
 +if [ x$feature_timeout_style = xy ] ; then 
 +  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 ###
  
-Command (m for help):  +### BEGIN /etc/grub.d/00_tuned ### 
-</code>+set tuned_params="" 
 +set tuned_initrd="" 
 +### END /etc/grub.d/00_tuned ###
  
-Créez ensuite la partition étendue :+### BEGIN /etc/grub.d/01_menu_auto_hide ### 
 +if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then 
 +  set last_boot_ok=1 
 +else 
 +  set last_boot_ok=0 
 +fi
  
-<code> +# Reset boot_indeterminate after a successful boot 
-Command (m for help): n +if [ "${boot_success}" = "1" ] ; then 
-Partition type +  set boot_indeterminate=0 
-     primary (3 primary, extended, free) +# Avoid boot_indeterminate causing the menu to be hidden more then once 
-   e   extended (container for logical partitions) +elif [ "${boot_indeterminate}" = "1" ]; then 
-Select (default e): e+  set boot_indeterminate=2 
 +fi 
 +set boot_success=0 
 +save_env boot_success boot_indeterminate
  
-Selected partition 4 +if [ x$feature_timeout_style = xy ] ; then 
-First sector (616448-8388607, default 616448):  +  if [ "${menu_show_once}" ]; then 
-Last sector, +sectors or +size{K,M,G,T,P(616448-8388607, default 8388607): +    unset menu_show_once 
 +    save_env menu_show_once 
 +    set timeout_style=menu 
 +    set timeout=60 
 +  elif [ "${menu_auto_hide}-a "${last_boot_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/01_menu_auto_hide ###
  
-Created a new partition 4 of type 'Extended' and of size 3.7 GiB.+### BEGIN /etc/grub.d/01_users ### 
 +if [ -f ${prefix}/user.cfg ]; then 
 +  source ${prefix}/user.cfg 
 +  if [ -n "${GRUB2_PASSWORD}" ]; then 
 +    set superusers="root" 
 +    export superusers 
 +    password_pbkdf2 root ${GRUB2_PASSWORD} 
 +  fi 
 +fi 
 +### END /etc/grub.d/01_users ###
  
-Command (m for help):   +### BEGIN /etc/grub.d/10_linux ### 
-</code>+insmod part_msdos 
 +insmod ext2 
 +set root='hd0,msdos1' 
 +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'  2ae4c035-9244-458c-82c5-a49ae169cdb6 
 +else 
 +  search --no-floppy --fs-uuid --set=root 2ae4c035-9244-458c-82c5-a49ae169cdb6 
 +fi 
 +insmod part_msdos 
 +insmod ext2 
 +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'  2ae4c035-9244-458c-82c5-a49ae169cdb6 
 +else 
 +  search --no-floppy --fs-uuid --set=boot 2ae4c035-9244-458c-82c5-a49ae169cdb6 
 +fi
  
-Créez maintenant les autres partitions l'une après l'autre :+# 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 formathttps://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
  
-<code> +set default_kernelopts="root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet "
-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.+insmod blscfg 
 +blscfg 
 +### END /etc/grub.d/10_linux ###
  
-Command (m for help): n +### BEGIN /etc/grub.d/20_linux_xen ### 
-All primary partitions are in use. +### END /etc/grub.d/20_linux_xen ###
-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.+### BEGIN /etc/grub.d/20_ppc_terminfo ### 
 +### END /etc/grub.d/20_ppc_terminfo ###
  
-Command (m for help): n +### BEGIN /etc/grub.d/30_os-prober ### 
-All primary partitions are in use. +### END /etc/grub.d/30_os-prober ###
-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.+### BEGIN /etc/grub.d/30_uefi-firmware ### 
 +### END /etc/grub.d/30_uefi-firmware ###
  
-Command (m for help): n +### BEGIN /etc/grub.d/40_custom ### 
-All primary partitions are in use+# This file provides an easy way to add custom menu entries Simply type the 
-Adding logical partition 8 +# menu entries you want to add after this comment.  Be careful not to change 
-First sector (2672640-8388607, default 2672640):  +# the 'exec tail' line above. 
-Last sector, +sectors or +size{K,M,G,T,P} (2672640-8388607, default 8388607): +500M+### END /etc/grub.d/40_custom ###
  
-Created a new partition 8 of type 'Linux' and of size 500 MiB+### BEGIN /etc/grub.d/41_custom ### 
- +if [ -f  ${config_directory}/custom.cfg ]; then 
-Command (m for help): n +  source ${config_directory}/custom.cfg 
-All primary partitions are in use. +elif [ -z "${config_directory}-a -f  $prefix/custom.cfg ]; then 
-Adding logical partition 9 +  source $prefix/custom.cfg; 
-First sector (3698688-8388607, default 3698688):  +fi 
-Last sector, +sectors or +size{K,M,G,T,P(3698688-8388607, default 8388607): +400M +### END /etc/grub.d/41_custom ###
- +
-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 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> </code>
  
-Tapez ensuite la lettre **p** puis <key>Entrée</key> pour visualiser la nouvelle table des partitionsVous obtiendrez un résultat similaire à celui-ci :+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.cfgou 
-Command (m for help): p +  grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
-Disk /dev/sdb: 4 GiB4294967296 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 +Lors de l'exécution de la commande **grub2-mkconfig** plusieurs fichiers sont lus :
-/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):  +===Le fichier /boot/grub2/device.map===
-</code> +
- +
-Ecrivez la table des partitions sur disque et exécutez la commande **partprobe** :+
  
 <code> <code>
-Command (m for help): w +[root@centos8 ~]# cat /boot/grub2/device.map 
-The partition table has been altered. +this device map was generated by anaconda 
-Calling ioctl() to re-read partition table. +(hd0)      /dev/sda 
-Syncing disks. +(hd1)      /dev/sda
- +
-[root@centos8 ~]# partprobe +
-[root@centos8 ~]+
 </code> </code>
  
-Lancez fdisk puis tapez ensuite la lettre **p** puis <key>Entrée</key> pour visualiser la table des partitions actuelle :+===Le fichier /etc/default/grub===
  
-<code> +Ce fichier contient la configuration par défaut des paramètres de GRUB 2 :
-[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> <code>
-Command (m for help): d +[root@centos8 ~]# cat /etc/default/grub 
-Partition number (1-12, default 12): 12 +GRUB_TIMEOUT=5 
- +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 
-Partition 12 has been deleted. +GRUB_DEFAULT=saved 
- +GRUB_DISABLE_SUBMENU=true 
-Command (m for help): p +GRUB_TERMINAL_OUTPUT="console" 
-Disk /dev/sdb: 4 GiB4294967296 bytes8388608 sectors +GRUB_CMDLINE_LINUX="crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet" 
-Units: sectors of 1 * 512 = 512 bytes +GRUB_DISABLE_RECOVERY="true" 
-Sector size (logical/physical): 512 bytes 512 bytes +GRUB_ENABLE_BLSCFG=true
-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> </code>
  
-A ce stade, la partition n'**pas** été réellement supprimée. En effet, vous avez la possibilité de sortir de fdisk en utilisant la commande **q**. +<WRAP center round important 60%> 
 +**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>
  
-Tapez donc q pour sortir de fdisk puis relancez fdisk. Vous obtiendrez un résultat similaire à celui-ci :+Dans ce fichier les directives sont :
  
-<code> +^  Directive  ^ Description ^ 
-Command (m for help): q+| GRUB_TIMEOUT | Durée de l'affichage du menu avant le démarrage en utilisant la valeur de GRUB_DEFAULT | 
 +| 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 |
  
-[root@centos8 ~]# fdisk /dev/sdb+===Les fichiers du répertoire /etc/grub.d===
  
-Welcome to fdisk (util-linux 2.32.1). +Les fichiers de ce répertoire sont exécutés dans l'ordre alphanumérique et servent à construire les menus de GRUB 2 :
-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> <code>
-Command (m for help): t +[root@centos8 ~]#  ls -l /etc/grub.d 
-Partition number (1-12, default 12): 5 +total 92 
-Hex code (type L to list all codes): fd +-rwxr-xr-x. 1 root root  8958 Mar  2 15:51 00_header 
- +-rwxr-xr-x. root root  1043 Jun 15  2020 00_tuned 
-Changed type of partition 'Linux' to 'Linux raid autodetect'+-rwxr-xr-x. 1 root root   232 Mar  2 15:51 01_users 
- +-rwxr-xr-x1 root root   832 Mar  2 15:51 08_fallback_counting 
-Command (m for help)t +-rwxr-xr-x. 1 root root 14088 Mar  2 15:51 10_linux 
-Partition number (1-12, default 12)+-rwxr-xr-x1 root root   830 Mar  2 15:51 10_reset_boot_success 
-Hex code (type L to list all codes): 8e +-rwxr-xr-x. 1 root root   889 Mar  2 15:51 12_menu_auto_hide 
- +-rwxr-xr-x1 root root 11696 Mar  2 15:51 20_linux_xen 
-Changed type of partition 'Linux' to 'Linux LVM'. +-rwxr-xr-x. 1 root root  2559 Mar  2 15:51 20_ppc_terminfo 
- +-rwxr-xr-x1 root root 10670 Mar  2 15:51 30_os-prober 
-Command (m for help)t +-rwxr-xr-x. 1 root root  1412 Mar  2 15:51 30_uefi-firmware 
-Partition number (1-12, default 12)7 +-rwxr-xr-x1 root root   214 Mar  2 15:51 40_custom 
-Hex code (type L to list all codes): 8e +-rwxr-xr-x. 1 root root   216 Mar  2 15:51 41_custom 
- +-rw-r--r--1 root root   483 Mar  2 15:51 README
-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> </code>
  
-A l'issu des modificationsvous obtiendrez un résultat similaire à celui-ci :+  * **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===
-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 +Le fichier **/boot/grub2/grubenv** contient l'entrée du menu sauvegardéeréférencée par la directive **GRUB_DEFAULT** du fichier **/etc/default/grub** :
-/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 disquevous devez utilisez la commande **w** puis la commande **partprobe** :+
  
 <code> <code>
-Command (m for help): w +[root@centos8 ~]# cat /boot/grub2/grubenv 
-The partition table has been altered! +# GRUB Environment Block 
- +saved_entry=de79af4f226d480fa7d3fec4cabbf97a-4.18.0-240.22.1.el8_3.x86_64 
-Calling ioctl() to re-read partition table. +kernelopts=root=UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c ro crashkernel=auto resume=UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 rhgb quiet  
- +boot_success=1 
-WARNING: Re-reading the partition table failed with error 16: Device or resource busy. +boot_indeterminate=0 
-The kernel still uses the old tableThe new table will be used at +########################################################################################################################################## 
-the next reboot or after you run partprobe(8) or kpartx(8) +########################################################################################################################################## 
-Syncing disks. +########################################################################################################################################## 
-[root@centos8 ~]# partprobe+########################################################################################################################################## 
 +########################################################################################################################################## 
 +############################################################[root@centos8 ~]#
 </code> </code>
  
-====Options de la Commande fdisk====+===Modifier la Configuration de GRUB 2 en Ligne de Commande===
  
-Les options de cette commande sont :+Lors du démarrage de GRUB 2, trois actions sont possibles à partir du menu :
  
-<code+  * Lancer un système d'exploitation en le sélectionnant avec les flèches puis en appuyant sur la touche <key>Entrée</key>, 
-[root@centos8 ~]# fdisk --help+  * Lancer l'éditeur en appuyant sur la touche **e**, 
 +  * Lancer l’interface de la ligne de commande GRUB en appuyant sur la touche **c**.
  
-Usage: +En mode édition notez l'utilisation des touches suivantes :
- fdisk [options] <disk>      change partition table +
- fdisk [options] -[<disk>] list partition table(s)+
  
-Display or manipulate a disk partition table.+  * **flèches** : se déplacer dans l'écran. L'édition se fait en utilisant simplement les touches du clavier, 
 +  * **Crtl-X** : démarrer avec la configuration modifiée, 
 +  * **echap** : abandonner les modifications et retourner à l'interface menu de GRUB 2.
  
-Options: +====Chargeurs de Démarrages Alternatifs====
- -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 +===Systemd-boot===
- -H, --heads <number>          specify the number of heads +
- -S, --sectors <number>        specify the number of sectors per track+
  
- -h, --help                    display this help +Un Chargeur de Démarrage étroitement lié à Systemd ( voir plus bas )celui-ci connaît actuellement un gain de popularité.
- -V, --version                 display version+
  
-Available output columns: +===U-boot===
- 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/+
- 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). +Un Chargeur de Démarrage qui peut booter n'importe quelle image à partir de n'importe quel support.
-</code>+
  
-=====Logical Volume Manager (LVM)=====+===Le Projet Syslinux===
  
-====LAB #3 - Volumes Logiques Linéaires====+==SYSLINUX==
  
-Afin de mettre en place le LVM, vous avez besoin du paquet **lvm2** et du paquet **device-mapper**+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.
  
-Nous allons travailler sous RHEL/CentOS 8 avec les partitions suivantes :+==EXTLINUX==
  
-<code> +Un Chargeur de Démarrage de petite taille qui sait booter des systèmes de fichier, EXT2, EXT3, EXT4 et BRTFS.
-/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 :+==ISOLINUX==
  
-<code> +Un Chargeur de Démarrage pour booter des LiveCD et LiveDVD. Dans le cas d'ISOLINUX, deux fichiers sont necéssaires :
-[root@centos8 ~]# vgscan +
-  Found volume group "cl_centos8" using metadata type lvm2 +
-</code>+
  
-Les options de la commande **vgscan** sont :+  * **isolinux.bin** qui contient l'image du Chargeur de Démarrage et 
 +  * **isolinux.cfg** qui contient les paramètres de configuration.
  
-<code> +==PXELINUX== 
-[root@centos8 ~]# vgscan --longhelp +  
-  vgscan Search for all volume groups+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 :
  
-  vgscan +    * **DHCP** pour attribuer une adresse IP à la machine et 
-    --ignorelockingfailure ] +    * **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/**
- [    --mknodes ] +
- [    --notifydbus ] +
- [    --reportformat basic|json ] +
- [ COMMON_OPTIONS ]+
  
-  Common options for lvm: +===Isodhpfx===
- [ -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: +Un Chargeur de Démarrage hybrideappelé **isodhpfx.bin**, qui peut être chargé sur un disque **ou** une clef USBLe fichier isodhpfx.bin est créé avec le programme **xorriso**.
-        Variables in option or position args are capitalized, +
-        e.gPV, VG, LV, Size, Number, String, Tag.+
  
-        PV +====Initramfs====
-        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 +Le fichier Initramfs //%%INITial Ram File System%%// est une archive au format cpio :
-        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> <code>
-[root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@centos8 ~]# cp /boot/initramfs-4.18.0-240.22.1.el8_3.x86_64.img /tmp/custom 
-  Physical volume "/dev/sdb6" successfully created+[root@centos8 ~]# cd /tmp 
-  Physical volume "/dev/sdb7" successfully created+[root@centos8 tmp]# ls 
-  Physical volume "/dev/sdb9" successfully created+cpio.list 
-</code>+custom 
 +dateref 
 +incremental.tar 
 +mbr.save 
 +systemd-private-9af7a2f7444849578f55b306bfd9f820-chronyd.service-iQiNzF 
 +tblpart.save 
 +test.cpio 
 +test.print 
 +test.tar 
 +tmp.iso 
 +vg0_backup
  
-Les options de la commande **pvcreate** sont :+[root@centos8 tmp]# mv custom custom.gz
  
-<code> +[root@centos8 tmp]# gunzip custom.gz
-[root@centos8 ~]# pvcreate --longhelp +
-  pvcreate - Initialize physical volume(s) for use by LVM+
  
-  pvcreate PV ... +[root@centos8 tmp]# mkdir initramfs
- -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: +[root@centos8 tmp]# cd initramfs
- -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: +[root@centos8 initramfs]# cpio -cid -../custom 
-        Variables in option or position args are capitalized, +216 blocks 
-        e.g. PV, VG, LV, Size, Number, String, Tag. +[root@centos8 initramfs]# ls 
- +bin  dev  etc  init  lib  lib64  proc  root  run  sbin  shutdown  sys  sysroot  tmp  usr  var
-        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 usedNo 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> </code>
  
-Pour visualiser le PV il convient d'utiliser la commande **pvdisplay** : +===Examiner l'image existante===
- +
-<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 :+Pour examiner une image initramfs archivée, il convient d'utiliser la commande **lsinitrd** :
  
 <code> <code>
-[root@centos8 ~]# pvdisplay --longhelp +[root@centos8 tmp]# lsinitrd custom | more 
-  pvdisplay Display various attributes of physical volume(s)+Image: custom: 25M 
 +======================================================================== 
 +Early CPIO image 
 +======================================================================== 
 +drwxr-xr-x   3 root     root            0 Feb 22 10:57 . 
 +-rw-r--r--   1 root     root            2 Feb 22 10:57 early_cpio 
 +drwxr-xr-x   3 root     root            0 Feb 22 10:57 kernel 
 +drwxr-xr-x   3 root     root            0 Feb 22 10:57 kernel/x86 
 +drwxr-xr-x   2 root     root            0 Feb 22 10:57 kernel/x86/microcode 
 +-rw-r--r--   1 root     root       109568 Feb 22 10:57 kernel/x86/microcode/GenuineIntel.bin 
 +======================================================================== 
 +Version: dracut-049-95.git20200804.el8_3.4
  
-  pvdisplay +Arguments: ---kver '4.18.0-240.22.1.el8_3.x86_64'
--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+dracut modules
- -d|--debug ] +bash 
- -h|--help ] +systemd 
- -q|--quiet ] +systemd-initrd 
- -v|--verbose ] +nss-softokn 
- -y|--yes ] +rngd 
- -t|--test ] +i18n 
- [    --commandprofile String ] +network-legacy 
- [    --config String ] +network 
- [    --driverloaded y|n ] +ifcfg 
- [    --nolocking ] +drm 
- [    --lockopt String ] +plymouth 
- [    --longhelp ] +prefixdevname 
- [    --profile String ] +kernel-modules 
- [    --version ] +kernel-modules-extra 
- +kernel-network-modules 
-  Common variables for lvm+resume 
-        Variables in option or position args are capitalized, +rootfs-block 
-        e.g. PV, VG, LV, Size, Number, String, Tag. +terminfo 
- +udev-rules 
-        PV +biosdevname 
-        Physical Volume name, a device path under /dev. +dracut-systemd 
-        For commands managing physical extents, a PV positional arg +usrmount 
-        generally accepts a suffix indicating a range (or multiple ranges) +base 
-        of PEs. When the first PE is omitted, it defaults to the start of +fs-lib 
-        the device, and when the last PE is omitted it defaults to the end. +memstrack 
-        PV[:PE-PE]... is start and end range (inclusive), +microcode_ctl-fw_dir_override 
-        PV[:PE+PE]... is start and length range (counting from 0). +shutdown 
- +======================================================================== 
-        LV +drwxr-xr-x  12 root     root            0 Feb 22 10:57 . 
-        Logical Volume nameSee lvm(8) for valid names. An LV positional +crw-r--r--   1 root     root       5,   1 Feb 22 10:57 dev/console 
-        arg generally includes the VG name and LV name, e.g. VG/LV. +crw-r--r--   1 root     root       1,  11 Feb 22 10:57 dev/kmsg 
-        LV followed by _<type> indicates that an LV of the given type is +crw-r--r--   1 root     root       1,   3 Feb 22 10:57 dev/null 
-        required. (raid represents raid<N> type). +crw-r--r--   1 root     root       1,   8 Feb 22 10:57 dev/random 
-        The _new suffix indicates that the LV name is new+crw-r--r--   1 root     root       1  9 Feb 22 10:57 dev/urandom 
- +lrwxrwxrwx   1 root     root            7 Feb 22 10:57 bin -> usr/bin 
-        Tag +drwxr-xr-x   2 root     root            0 Feb 22 10:57 dev 
-        Tag name. See lvm(8) for information about tag names and using +drwxr-xr-x  11 root     root            Feb 22 10:57 etc 
-        tags in place of a VG, LV or PV. +-rw-r--r--   1 root     root           30 Nov 10  2020 etc/centos-release 
- +drwxr-xr-x   2 root     root            0 Feb 22 10:57 etc/cmdline.d 
-        Select +drwxr-xr-x   2 root     root            0 Feb 22 10:57 etc/conf.d 
-        Select indicates that a required positional arg can be omitted +-rw-r--r--   1 root     root          124 Feb 22 10:57 etc/conf.d/systemd.conf 
-        if the --select option is usedNo arg appears in this position. +--More--
- +
-        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> </code>
  
-===Volume Group (VG) et Physical Extent (PE)===+===Le script init===
  
-Pour créer un Volume Group dénommé **vg0**, il convient d'utiliser la commande **vgcreate** :+RHEL/CentOS 8 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 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@centos8 tmp]# lsinitrd custom | grep usr/lib/systemd/systemd | grep init 
-  Volume group "vg0" successfully created+lrwxrwxrwx   1 root     root           23 Feb 22 10:57 init -> usr/lib/systemd/systemd
 </code> </code>
  
-Les options de la commande **vgcreate** sont :+===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 ~]# 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> <code>
-[root@centos8 ~]# vgdisplay vg0 +[root@centos8 tmp]# lsinitrd /boot/initramfs-$(uname -r).img  /etc/ld.so.conf 
-  --- Volume group --- +include ld.so.conf.d/*.conf
-  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> </code>
  
-Les options de la commande **vgdisplay** sont :+====Processus de Démarrage du Noyau Linux====
  
-<code> +Le processus de démarrage du Noyau Linux peut être divisé en 6 étapes :
-[root@centos8 ~]# vgdisplay --help +
-  vgdisplay - Display volume group information+
  
-  vgdisplay +^ Etape ^ Description ^ 
- [ -A|--activevolumegroups ] +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 
- [ -c|--colon ] +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 
- [ -C|--columns ] +Décompression du Noyau Le fichier **head.s** décompresse le noyau | 
- [ -o|--options String ] +Initialisation du noyau et de la mémoire Le fichier **head.s** crée un GDT et IDT définitif | 
- [ -S|--select String ] +Configuration du noyau Le fichier **main.c** met en place les contraintes de mémoire et configure la mémoire virtuelle | 
- [ -s|--short ] +Création du processus Init Le fichier **main.c** crée le processus init |
- -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: +La fonction **init_post()** essaie ensuite d'exécuter un des processus suivant dans l'ordre :
- [ -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. +  * /sbin/init ==> /usr/sbin/init ==> /usr/lib/systemd/systemd 
-</code>+  /etc/init 
 +  * /bin/init 
 +  * /bin/sh ==/bin/bash ==> /usr/bin/bash
  
-===Logical Volumes (LV)===+Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché.
  
-Pour créer un **Logical Volume** dénommé **lv0** dans le **Volume Group** **vg0**, il convient d'utiliser la commande **lvcreate** :+=====Systemd=====
  
-<code> +Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, étaient des systèmes de démarrage **séquentiels**
-[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%> +**Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d'architectures matérielles modernes sont multi-cœurs. Si un service dépend d'un autre qui n'est pas encore démarré ce premier est mis en attente dans une mémoire tampon. Qui 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.
-**Important** -Notez que la taille du LV est un multiple du PE. +
-</WRAP>+
  
-Les options de la commande **lvcreate** sont :+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 :
  
-<code> +  * **.automount** - active la fonctionalité d'automount. 
-[root@centos8 ~]# lvcreate --help +  * **.device** expose une périphérique dans systemd. 
-  lvcreate Create logical volume+  * **.mount** contrôle quand et comment les systèmes de fichiers sont montés. 
 +  * **.path** active un service quand il y un accès à un fichier ou répertoire sous surveillance par le système. 
 +  * **.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.
  
-  Create a linear LV. +Une Cible est en quelque sorte une **grande étape** dans le démarrage du système :
-  lvcreate -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [    --type linear ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Create a striped LV (infers --type striped)+  * **halt.target** arrête le système. 
-  lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG +  * **poweroff.target** arrête le système et coupe le courant
- -l|--extents Number[PERCENT] ] +  * **shutdown.target** arrête le système. 
- -I|--stripesize Size[k|UNIT] ] +  * **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é. 
- [ COMMON_OPTIONS ] +  * **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é. 
- [ PV ... ]+  * **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èmeQuand le système est démarré, l'état est restauré. 
 +  * **reboot.target** - redémarre le système.
  
-  Create a raid1 or mirror LV (infers --type raid1|mirror). +**Systemd** utilise des Cibles d'une manière similaire à ce que **SysVinit** utilise des niveaux d'exécutionPour rendre la transition plus facileil existe des **Cibles** qui "simulent" les niveaux d'exécution de **SysVinit** :
-  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 usede.g. raid1). +
-  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. +
-  lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG +
- [ -l|--extents Number[PERCENT] ] +
- [ -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. +
-  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. +
-  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. +
-  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). +
-  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|2 ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Create a new LV, then 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@centos8 ~]# ls -l /usr/lib/systemd/system/runlevel* 
-</code>+lrwxrwxrwx. 1 root root 15 Apr  7 16:55 /usr/lib/systemd/system/runlevel0.target -> poweroff.target 
 +lrwxrwxrwx. 1 root root 13 Apr  7 16:55 /usr/lib/systemd/system/runlevel1.target -> rescue.target 
 +lrwxrwxrwx. 1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel2.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel3.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 17 Apr  7 16:55 /usr/lib/systemd/system/runlevel4.target -> multi-user.target 
 +lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/lib/systemd/system/runlevel5.target -> graphical.target 
 +lrwxrwxrwx. 1 root root 13 Apr  7 16:55 /usr/lib/systemd/system/runlevel6.target -reboot.target
  
-Créez un système de fichiers en **ext3** sur /dev/vg0/lv0 :+/usr/lib/systemd/system/runlevel1.target.wants: 
 +total 0
  
-<code> +/usr/lib/systemd/system/runlevel2.target.wants
-[root@centos8 ~]# mke2fs -j /dev/vg0/lv0 +total 0
-mke2fs 1.45.6 (20-Mar-2020) +
-Creating filesystem with 360448 1k blocks and 90112 inodes +
-Filesystem UUID: 87b6d526-d379-4e0c-8984-94811f1cee33 +
-Superblock backups stored on blocks:  +
- 8193, 24577, 40961, 57345, 73729, 204801, 221185+
  
-Allocating group tablesdone                             +/usr/lib/systemd/system/runlevel3.target.wants
-Writing inode tables: done                             +total 0
-Creating journal (8192 blocks): done +
-Writing superblocks and filesystem accounting information: done +
-</code>+
  
-Montez votre lv0 :+/usr/lib/systemd/system/runlevel4.target.wants: 
 +total 0
  
-<code> +/usr/lib/systemd/system/runlevel5.target.wants: 
-[root@centos8 ~]# mount -t ext3 /dev/vg0/lv0 /mnt/lvm+total 0
 </code> </code>
  
-Vous allez maintenant copier le contenu de votre répertoire /home vers /mnt/lvm.+====LAB #1 - La Commande systemctl====
  
-Saisissez donc la commande pour copier le contenu de /home :+Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option **list-units** :
  
 <code> <code>
-[root@centos8 ~]# cp -/home /mnt/lvm+[root@centos8 ~]# 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-host1-target1:0:0-1:0:0:0-block-sr0.device       loaded active plugged   CD-ROM                                                                        
 +sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device                                     loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)             
 +sys-devices-pci0000:00-0000:00:05.0-sound-card0.device                                    loaded active plugged   82801AA AC'97 Audio Controller                                                
 +sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda1.device  loaded active plugged   VBOX_HARDDISK 1                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda2.device  loaded active plugged   VBOX_HARDDISK 2                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda3.device  loaded active plugged   VBOX_HARDDISK 3                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda.device       loaded active plugged   VBOX_HARDDISK                                                                 
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb1.device  loaded active plugged   VBOX_HARDDISK 1                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb10.device loaded active plugged   VBOX_HARDDISK 10                                                              
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb11.device loaded active plugged   VBOX_HARDDISK my_ext4                                                         
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb12.device loaded active plugged   VBOX_HARDDISK 12                                                              
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb2.device  loaded active plugged   VBOX_HARDDISK 2                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb3.device  loaded active plugged   VBOX_HARDDISK 3                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb4.device  loaded active plugged   VBOX_HARDDISK 4                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb5.device  loaded active plugged   VBOX_HARDDISK 5                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb6.device  loaded active plugged   VBOX_HARDDISK 6                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb7.device  loaded active plugged   VBOX_HARDDISK 7                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb8.device  loaded active plugged   VBOX_HARDDISK 8                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb9.device  loaded active plugged   VBOX_HARDDISK 9                                                               
 +sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb.device       loaded active plugged   VBOX_HARDDISK                                                                 
 +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-net-virbr0.device                                                     loaded active plugged   /sys/devices/virtual/net/virbr0                                               
 +sys-devices-virtual-net-virbr0\x2dnic.device                                              loaded active plugged   /sys/devices/virtual/net/virbr0-nic                                           
 +sys-module-configfs.device                                                                loaded active plugged   /sys/module/configfs                                                          
 +sys-subsystem-net-devices-enp0s3.device                                                   loaded active plugged   82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)             
 +sys-subsystem-net-devices-virbr0.device                                                   loaded active plugged   /sys/subsystem/net/devices/virbr0                                             
 +sys-subsystem-net-devices-virbr0\x2dnic.device                                            loaded active plugged   /sys/subsystem/net/devices/virbr0-nic                                         
 +-.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-user-1000.mount                                                                       loaded active mounted   /run/user/1000                                                                
 +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   /sys/kernel/tracing                                                           
 +var-lib-nfs-rpc_pipefs.mount                                                              loaded active mounted   RPC Pipe File System                                                          
 +cups.path                                                                                 loaded active running   CUPS Scheduler                                                                
 +systemd-ask-password-plymouth.path                                                        loaded active waiting   Forward Password Requests to Plymouth Directory Watch                         
 +systemd-ask-password-wall.path                                                            loaded active waiting   Forward Password Requests to Wall Directory Watch                             
 +init.scope                                                                                loaded active running   System and Service Manager                                                    
 +session-96.scope                                                                          loaded active running   Session 96 of user trainee                                                    
 +atd.service                                                                               loaded active running   Job spooling tools                                                            
 +auditd.service                                                                            loaded active running   Security Auditing Service                                                     
 +avahi-daemon.service                                                                      loaded active running   Avahi mDNS/DNS-SD Stack                                                       
 +chronyd.service                                                                           loaded active running   NTP client/server                                                             
 +crond.service                                                                             loaded active running   Command Scheduler                                                             
 +cups.service                                                                              loaded active running   CUPS Scheduler                                                                
 +dbus.service                                                                              loaded active running   D-Bus System Message Bus                                                      
 +dracut-shutdown.service                                                                   loaded active exited    Restore /run/initramfs on shutdown                                            
 +firewalld.service                                                                         loaded active running   firewalld - dynamic firewall daemon                                           
 +lines 1-57
 </code> </code>
  
-Constatez ensuite le contenu de /mnt/lvm :+Pour consulter la liste des Unités inactifs, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# ls -l /mnt/lvm +[root@centos8 ~]# systemctl list-units --all | grep inactive | more 
-total 14 +● boot.automount                                                                                                 not-found inactive dead      boot.automount                                                                               
-drwxr-xr-x5 root root  1024 Apr 20 14:35 home +  proc-fs-nfsd.mount                                                                                             loaded    inactive dead      NFSD configuration filesystem                                                                
-drwx------. root root 12288 May 26 17:00 lost+found+  proc-sys-fs-binfmt_misc.mount                                                                                  loaded    inactive dead      Arbitrary Executable File Formats File System                                                
 +  sys-fs-fuse-connections.mount                                                                                  loaded    inactive dead      FUSE Control File System                                                                     
 +● sysroot.mount                                                                                                  not-found inactive dead      sysroot.mount                                                                                
 +  tmp.mount                                                                                                      loaded    inactive dead      Temporary Directory (/tmp)                                                                   
 +  var-lib-machines.mount                                                                                         loaded    inactive dead      Virtual Machine and Container Storage                                                        
 +  systemd-ask-password-console.path                                                                              loaded    inactive dead      Dispatch Password Requests to Console Directory Watch                                        
 +● apparmor.service                                                                                               not-found inactive dead      apparmor.service                                                                             
 +  auth-rpcgss-module.service                                                                                     loaded    inactive dead      Kernel Module supporting RPCSEC_GSS                                                          
 +  cpupower.service                                                                                               loaded    inactive dead      Configure CPU power related settings                                                         
 +● display-manager.service                                                                                        not-found inactive dead      display-manager.service                                                                      
 +  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                                                                         
 +  ebtables.service                                                                                               loaded    inactive dead      Ethernet Bridge Filtering tables                                                             
 +  emergency.service                                                                                              loaded    inactive dead      Emergency Shell                                                                              
 +  initrd-cleanup.service                                                                                         loaded    inactive dead      Cleaning Up and Shutting Down Daemons                                                        
 +  initrd-parse-etc.service                                                                                       loaded    inactive dead      Reload Configuration from the Real Root                                                      
 +  initrd-switch-root.service                                                                                     loaded    inactive dead      Switch Root                                                                                  
 +  initrd-udevadm-cleanup-db.service                                                                              loaded    inactive dead      Cleanup udevd DB                                                                             
 +● 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-onboot.service                                                                                           loaded    inactive dead      Special handling of early boot iSCSI sessions                                                
 +  iscsi.service                                                                                                  loaded    inactive dead      Login and scanning of iSCSI devices                                                          
 +  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                                                                 
 +  libvirt-guests.service                                                                                         loaded    inactive dead      Suspend/Resume Running libvirt Guests                                                        
 +  libvirtd.service                                                                                               loaded    inactive dead      Virtualization daemon                                                                        
 +  loadmodules.service                                                                                            loaded    inactive dead      Load legacy module configuration                                                             
 +● lvm2-activation.service                                                                                        not-found inactive dead      lvm2-activation.service                                                                      
 +  lvm2-lvmpolld.service                                                                                          loaded    inactive dead      LVM2 poll daemon                                                                             
 +  mdmonitor.service                                                                                              loaded    inactive dead      Software RAID monitoring and management                                                      
 +  microcode.service                                                                                              loaded    inactive dead      Load CPU microcode update                                                                    
 +● network.service                                                                                                not-found inactive dead      network.service                                                                              
 +  nfs-blkmap.service                                                                                             loaded    inactive dead      pNFS block layout mapping daemon                                                             
 +  nfs-convert.service                                                                                            loaded    inactive dead      Preprocess NFS configuration convertion                                                      
 +  nfs-idmapd.service                                                                                             loaded    inactive dead      NFSv4 ID-name mapping service                                                                
 +  nfs-mountd.service                                                                                             loaded    inactive dead      NFS Mount Daemon                                                                             
 +  nfs-server.service                                                                                             loaded    inactive dead      NFS server and services                                                                      
 +  nfs-utils.service                                                                                              loaded    inactive dead      NFS server and client services                                                               
 +  nfsdcld.service                                                                                                loaded    inactive dead      NFSv4 Client Tracking Daemon                                                                 
 +  nftables.service                                                                                               loaded    inactive dead      Netfilter Tables                                                                             
 +● ntpd.service                                                                                                   not-found inactive dead      ntpd.service                                                                                 
 +● ntpdate.service                                                                                                not-found inactive dead      ntpdate.service                                                                              
 +  plymouth-switch-root.service                                                                                   loaded    inactive dead      Plymouth switch root service                                                                 
 +  rc-local.service                                                                                               loaded    inactive dead      /etc/rc.d/rc.local Compatibility                                                             
 +  rescue.service                                                                                                 loaded    inactive dead      Rescue Shell                                                                                 
 +  rpc-gssd.service                                                                                               loaded    inactive dead      RPC security service for NFS client and server                                               
 +--More--
 </code> </code>
  
-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 :+Les points noirs au début de certaines lignes dans la sortie ci-dessus sont en réalité des points blancs à l'écranCes 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 ~]# df -h /mnt/lvm +[root@centos8 ~]# systemctl status ntpd 
-Filesystem           Size  Used Avail Use% Mounted on +Unit ntpd.service could not be found.
-/dev/mapper/vg0-lv0  333M  17M  314M   1% /mnt/lvm+
 </code> </code>
  
-Dans la cas de notre exemple, la taille est de **333 Mo** avec **17 Mo** occupé. +Pour consulter la liste des Unités ainsi que leurs statutsutilisez la commande suivante :
- +
-====LAB #4 - Etendre un Volume Logique à Chaud==== +
- +
-Pour agrandir un volume logique, le paquet **lvm2** contient les commandes **lvextend** et **resize2fs** :+
  
 <code> <code>
-[root@centos8 ~]# lvextend -L +100M /dev/vg0/lv0 +[root@centos8 ~]# systemctl list-unit-files | more 
-  Rounding size to boundary between physical extents: 104.00 MiB+UNIT FILE                                                              STATE     
-  Size of logical volume vg0/lv0 changed from 352.00 MiB (44 extents) to 456.00 MiB (57 extents)+proc-sys-fs-binfmt_misc.automount                                      static    
-  Logical volume vg0/lv0 successfully resized.+-.mount                                                                generated 
 +boot.mount                                                             generated 
 +dev-hugepages.mount                                                    static    
 +dev-mqueue.mount                                                       static    
 +proc-fs-nfsd.mount                                                     static    
 +proc-sys-fs-binfmt_misc.mount                                          static    
 +sys-fs-fuse-connections.mount                                          static    
 +sys-kernel-config.mount                                                static    
 +sys-kernel-debug.mount                                                 static    
 +tmp.mount                                                              disabled  
 +var-lib-machines.mount                                                 static    
 +var-lib-nfs-rpc_pipefs.mount                                           static    
 +cups.path                                                              enabled   
 +systemd-ask-password-console.path                                      static    
 +systemd-ask-password-plymouth.path                                     static    
 +systemd-ask-password-wall.path                                         static    
 +session-96.scope                                                       transient 
 +arp-ethers.service                                                     disabled  
 +atd.service                                                            enabled   
 +auditd.service                                                         enabled   
 +auth-rpcgss-module.service                                             static    
 +autovt@.service                                                        enabled   
 +avahi-daemon.service                                                   enabled   
 +blk-availability.service                                               disabled  
 +chrony-dnssrv@.service                                                 static    
 +chrony-wait.service                                                    disabled  
 +chronyd.service                                                        enabled   
 +cockpit-motd.service                                                   static    
 +cockpit-wsinstance-http-redirect.service                               static    
 +cockpit-wsinstance-http.service                                        static    
 +cockpit-wsinstance-https-factory@.service                              static    
 +cockpit-wsinstance-https@.service                                      static    
 +cockpit.service                                                        static    
 +console-getty.service                                                  disabled  
 +container-getty@.service                                               static    
 +cpupower.service                                                       disabled  
 +crond.service                                                          enabled   
 +cups-browsed.service                                                   disabled  
 +cups.service                                                           enabled   
 +dbus-org.fedoraproject.FirewallD1.service                              enabled   
 +dbus-org.freedesktop.Avahi.service                                     enabled   
 +dbus-org.freedesktop.hostname1.service                                 static    
 +dbus-org.freedesktop.import1.service                                   static    
 +dbus-org.freedesktop.locale1.service                                   static    
 +dbus-org.freedesktop.login1.service                                    static    
 +dbus-org.freedesktop.machine1.service                                  static    
 +dbus-org.freedesktop.nm-dispatcher.service                             enabled   
 +dbus-org.freedesktop.portable1.service                                 static    
 +dbus-org.freedesktop.timedate1.service                                 enabled   
 +dbus.service                                                           static    
 +debug-shell.service                                                    disabled  
 +dm-event.service                                                       static    
 +dnf-makecache.service                                                  static    
 +dnsmasq.service                                                        disabled  
 +dracut-cmdline.service                                                 static    
 +--More--
 </code> </code>
  
-<WRAP center round important 60%> +Pour visualiser les Unités d'un type spécifique, il convient d'utiliser l'option **-t** :
-**Important** - Notez que l'agrandissement du volume est un multiple du PE. +
-</WRAP> +
- +
-Les options de la commande **lvextend** sont :+
  
 <code> <code>
-[root@centos8 ~]# lvextend --help +[root@centos8 ~]# systemctl list-unit-files -t mount 
-  lvextend Add space to a logical volume+UNIT FILE                     STATE     
 +-.mount                       generated 
 +boot.mount                    generated 
 +dev-hugepages.mount           static    
 +dev-mqueue.mount              static    
 +proc-fs-nfsd.mount            static    
 +proc-sys-fs-binfmt_misc.mount static    
 +sys-fs-fuse-connections.mount static    
 +sys-kernel-config.mount       static    
 +sys-kernel-debug.mount        static    
 +tmp.mount                     disabled  
 +var-lib-machines.mount        static    
 +var-lib-nfs-rpc_pipefs.mount  static   
  
-  Extend an LV by a specified size. +12 unit files listed.
-  lvextend -L|--size [+]Size[m|UNIT] LV +
- [ -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. +
-  lvextend LV PV ... +
- [ -r|--resizefs ] +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- +
-  Extend a pool metadata SubLV by a specified size. +
-  lvextend --poolmetadatasize [+]Size[m|UNIT] LV_thinpool +
- [ -i|--stripes Number ] +
- [ -I|--stripesize Size[k|UNIT] ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Extend an LV according to a predefined policy. +
-  lvextend --usepolicies LV_snapshot_thinpool +
- [ -r|--resizefs ] +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Common options for command: +
- [ -A|--autobackup y|n ] +
- [ -f|--force ] +
- [ -m|--mirrors Number ] +
- [ -n|--nofsck ] +
- [    --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: +
- [ -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>
  
-Le volume ayant été agrandi, il est necessaire maintenant d'agrandir le filesystem qui s'y trouve :+Dans la colonne STATE on voit les mots **static** et **generated**. 
  
-<code> +  * STATE = static 
-[root@centos8 ~]# resize2fs /dev/vg0/lv0 +    * 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é
-resize2fs 1.45.6 (20-Mar-2020) +
-Filesystem at /dev/vg0/lv0 is mounted on /mnt/lvm; on-line resizing required +
-old_desc_blocks = 2new_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 :+  * 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** :
  
 <code> <code>
-[root@centos8 ~]# df -/mnt/lvm +[root@centos8 ~]# ls -/lib/systemd/system-generators/systemd-fstab-generator 
-Filesystem           Size  Used Avail Use% Mounted on +-rwxr-xr-x. 1 root root 46096 Apr  7 16:56 /lib/systemd/system-generators/systemd-fstab-generator
-/dev/mapper/vg0-lv0  434M   17M  395M   5% /mnt/lvm+
 </code> </code>
  
-Vous noterez que la taille a augmentée mais que les données sont toujours présentes. +Il existe aussi d'autres exécutables responsables de la génération d'autres fichiers :
- +
-====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@centos8 ~]# ls -l /lib/systemd/system-generators 
-10+0 records in +total 508 
-10+0 records out +-rwxr-xr-x. 1 root root    504 Jan  4 11:25 kdump-dep-generator.sh 
-10485760 bytes (10 MB, 10 MiB) copied, 0.0281282 s, 373 MB/s+-r-xr-xr-x1 root root 134976 Aug 17  2020 lvm2-activation-generator 
 +-rwxr-xr-x. 1 root root  67792 Jul 20  2020 nfs-server-generator 
 +-rwxr-xr-x. 1 root root  38216 Jul 20  2020 rpc-pipefs-generator 
 +-rwxr-xr-x. 1 root root    743 Apr 23  2020 selinux-autorelabel-generator.sh 
 +-rwxr-xr-x. 1 root root  33504 Apr  7 16:56 systemd-cryptsetup-generator 
 +-rwxr-xr-x. 1 root root  16648 Apr  7 16:56 systemd-debug-generator 
 +-rwxr-xr-x. 1 root root  46096 Apr  7 16:56 systemd-fstab-generator 
 +-rwxr-xr-x. 1 root root  17064 Apr  7 16:56 systemd-getty-generator 
 +-rwxr-xr-x. 1 root root  29432 Apr  7 16:56 systemd-gpt-auto-generator 
 +-rwxr-xr-x. 1 root root  12568 Apr  7 16:56 systemd-hibernate-resume-generator 
 +-rwxr-xr-x. 1 root root  12368 Apr  7 16:56 systemd-rc-local-generator 
 +-rwxr-xr-x. 1 root root  12408 Apr  7 16:56 systemd-system-update-generator 
 +-rwxr-xr-x. 1 root root  33544 Apr  7 16:56 systemd-sysv-generator 
 +-rwxr-xr-x. 1 root root  17024 Apr  7 16:56 systemd-veritysetup-generator
 </code> </code>
  
-Créez maintenant un snapshot :+Les options de la commande **systemctl** sont :
  
 <code> <code>
-[root@centos8 ~]# lvcreate --L 18M -n testsnap /dev/vg0/lv0 +[root@centos8 ~]# systemctl --help 
-  Rounding up size to full physical extent 24.00 MiB +systemctl [OPTIONS...] {COMMAND} ...
-  Logical volume "testsnap" created. +
-</code>+
  
-Pour avoir une confirmation de la création du snapshot, utilisez la commande **lvs** :+Query or send control commands to the systemd manager.
  
-<code> +  -h --help           Show this help 
-[root@centos8 ~]# lvs +     --version        Show package version 
-  LV       VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert +     --system         Connect to system manager 
-  root     cl_centos8 -wi-ao----  27.79g                                                     +     --user           Connect to user service manager 
-  swap     cl_centos8 -wi-ao----   3.20g                                                     +  -H --host=[USER@]HOST 
-  lv0      vg0        owi-aos--- 456.00m                                                     +                      Operate on remote host 
-  testsnap vg0        swi-a-s---  24.00m      lv0    0.05   +  -M --machine=CONTAINER 
-</code>+                      Operate on local container 
 +  -t --type=TYPE      List units of a particular type 
 +     --state=STATE    List units with particular LOAD or SUB or ACTIVE state 
 +  -p --property=NAME  Show only properties by this name 
 +  -a --all            Show all properties/all units currently in memory, 
 +                      including dead/empty ones. To list all units installed on 
 +                      the system, use the 'list-unit-files' command instead. 
 +     --failed         Same as --state=failed 
 +  ---full           Don't ellipsize unit names on output 
 +  -r --recursive      Show unit list of host and local containers 
 +     --reverse        Show reverse dependencies with 'list-dependencies' 
 +     --job-mode=MODE  Specify how to deal with already queued jobs, when 
 +                      queueing a new job 
 +     --show-types     When showing sockets, explicitly show their type 
 +     --value          When showing properties, only print the value 
 +  -i --ignore-inhibitors 
 +                      When shutting down or sleeping, ignore inhibitors 
 +     --kill-who=WHO   Who to send signal to 
 +  ---signal=SIGNAL  Which signal to send 
 +     --now            Start or stop unit in addition to enabling or disabling it 
 +     --dry-run        Only print what would be done 
 +  -q --quiet          Suppress output 
 +     --wait           For (re)start, wait until service stopped again 
 +     --no-block       Do not wait until operation finished 
 +     --no-wall        Don't send wall message before halt/power-off/reboot 
 +     --no-reload      Don't reload daemon after en-/dis-abling unit files 
 +     --no-legend      Do not print legend (column headers and hints) 
 +     --no-pager       Do not pipe output into a pager 
 +     --no-ask-password 
 +                      Do not ask for system passwords 
 +     --global         Enable/disable/mask unit files globally 
 +     --runtime        Enable/disable/mask unit files temporarily until next 
 +                      reboot 
 +  -f --force          When enabling unit files, override existing symlinks 
 +                      When shutting down, execute action immediately 
 +     --preset-mode=   Apply only enable, only disable, or all presets 
 +     --root=PATH      Enable/disable/mask unit files in the specified root 
 +                      directory 
 +  -n --lines=INTEGER  Number of journal entries to show 
 +  -o --output=STRING  Change journal output mode (short, short-precise, 
 +                             short-iso, short-iso-precise, short-full, 
 +                             short-monotonic, short-unix, 
 +                             verbose, export, json, json-pretty, json-sse, cat) 
 +     --firmware-setup Tell the firmware to show the setup menu on next boot 
 +     --plain          Print unit dependencies as a list instead of a tree
  
-<WRAP center round important 60%> +lines 1-57
-**Important** Notez que le snapshot est créé dans le même VG que le LV d'origine. +
-</WRAP> +
- +
-Les options de la commande **lvs** sont : +
- +
-<code> +
-[root@centos8 ~]# lvs --help +
-  lvs - Display information about logical volumes +
- +
-  lvs +
- [ -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> </code>
  
-Créez maintenant un répertoire pour monter le snapshot :+====LAB #2 - Fichiers de Configuration====
  
-<code> +===2.1 - Fichiers de Configuration par Défaut===
-[root@centos8 ~]# mkdir /mnt/testsnap +
-</code>+
  
-Montez le snapshot :+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** :
  
 <code> <code>
-[root@centos8 ~]# mount /dev/vg0/testsnap /mnt/testsnap+[root@centos8 ~]# pkg-config systemd --variable=systemdsystemunitdir 
 +/usr/lib/systemd/system
 </code> </code>
- 
-Comparez le volume d'origine et le snapshot : 
  
 <code> <code>
-[root@centos8 ~]# ls -l /mnt/lvm +[root@centos8 ~]# ls -l /usr/lib/systemd/system | more 
-total 10296 +total 1464 
--rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M +-rw-r--r--. 1 root root  275 Apr 26  2020 arp-ethers.service 
-drwxr-xr-x. root root     1024 Jun 16 06:39 home +-rw-r--r--. 1 root root  222 May 11  2019 atd.service 
-drwx------. root root    12288 Jun 24 04:20 lost+found +-rw-r--r--. 1 root root 1512 Apr 23  2020 auditd.service 
-[root@centos8 ~]# ls -l /mnt/testsnap/ +-rw-r--r--. 1 root root  628 Jul 20  2020 auth-rpcgss-module.service 
-total 10296 +lrwxrwxrwx. 1 root root   14 Apr  7 16:55 autovt@.service -> getty@.service 
--rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M +-rw-r--r--. 1 root root 1044 Nov 16  2020 avahi-daemon.service 
-drwxr-xr-x. root root     1024 Jun 16 06:39 home +-rw-r--r--. 1 root root  870 Nov 16  2020 avahi-daemon.socket 
-drwx------. 2 root root    12288 Jun 24 04:20 lost+found+-rw-r--r--. 1 root root  956 Apr  7 16:54 basic.target 
 +drwxr-xr-x. root root    6 Apr  7 16:55 basic.target.wants 
 +-r--r--r--. root root  408 Aug 17  2020 blk-availability.service 
 +-rw-r--r--. 1 root root  419 Jun 22  2018 bluetooth.target 
 +-rw-r--r--. 1 root root  455 Apr  7 16:54 boot-complete.target 
 +-rw-r--r--. 1 root root  209 Nov 19  2019 chrony-dnssrv@.service 
 +-rw-r--r--. 1 root root  138 Nov 19  2019 chrony-dnssrv@.timer 
 +-rw-r--r--. 1 root root  491 Nov 19  2019 chronyd.service 
 +-rw-r--r--. 1 root root  472 May 10  2019 chrony-wait.service 
 +-rw-r--r--. 1 root root  222 Aug 24  2020 cockpit-motd.service 
 +-rw-r--r--. 1 root root  835 Aug 24  2020 cockpit.service 
 +-rw-r--r--. 1 root root  373 Aug 24  2020 cockpit.socket 
 +-rw-r--r--. 1 root root  251 Aug 24  2020 cockpit-wsinstance-http-redirect.service 
 +-rw-r--r--. 1 root root  233 Aug 24  2020 cockpit-wsinstance-http-redirect.socket 
 +-rw-r--r--. 1 root root  221 Aug 24  2020 cockpit-wsinstance-http.service 
 +-rw-r--r--. 1 root root  165 Aug 24  2020 cockpit-wsinstance-https-factory@.service 
 +-rw-r--r--. 1 root root  244 Aug 24  2020 cockpit-wsinstance-https-factory.socket 
 +-rw-r--r--. 1 root root  215 Aug 24  2020 cockpit-wsinstance-http.socket 
 +-rw-r--r--. 1 root root  264 Aug 24  2020 cockpit-wsinstance-https@.service 
 +-rw-r--r--. 1 root root  478 Aug 24  2020 cockpit-wsinstance-https@.socket 
 +-rw-r--r--. 1 root root 1082 Apr  7 16:55 console-getty.service 
 +-rw-r--r--. 1 root root 1263 Apr  7 16:55 container-getty@.service 
 +-rw-r--r--. 1 root root  294 Apr  8 15:21 cpupower.service 
 +-rw-r--r--. 1 root root  356 Nov  8  2019 crond.service 
 +-rw-r--r--. 1 root root  465 Jun 22  2018 cryptsetup-pre.target 
 +-rw-r--r--. 1 root root  412 Jun 22  2018 cryptsetup.target 
 +lrwxrwxrwx. 1 root root   13 Apr  7 16:55 ctrl-alt-del.target -> reboot.target 
 +-rw-r--r--. 1 root root  234 Oct  4  2017 cups-browsed.service 
 +-r--r--r--. 1 root root  142 Jun 15  2020 cups.path 
 +-r--r--r--. 1 root root  248 Jun 15  2020 cups.service 
 +-r--r--r--. 1 root root  136 Jun 15  2020 cups.socket 
 +lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service 
 +lrwxrwxrwx. 1 root root   23 Apr  7 16:55 dbus-org.freedesktop.import1.service -> systemd-importd.service 
 +lrwxrwxrwx. 1 root root   23 Apr  7 16:55 dbus-org.freedesktop.locale1.service -> systemd-localed.service 
 +lrwxrwxrwx. 1 root root   22 Apr  7 16:55 dbus-org.freedesktop.login1.service -> systemd-logind.service 
 +lrwxrwxrwx. 1 root root   24 Apr  7 16:55 dbus-org.freedesktop.machine1.service -> systemd-machined.service 
 +lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.portable1.service -> systemd-portabled.service 
 +lrwxrwxrwx. 1 root root   25 Apr  7 16:55 dbus-org.freedesktop.timedate1.service -> systemd-timedated.service 
 +-rw-r--r--. 1 root root  380 Apr  7 12:08 dbus.service 
 +-rw-r--r--. 1 root root  102 Apr  7 12:08 dbus.socket 
 +drwxr-xr-x. root root    6 Apr  7 16:55 dbus.target.wants 
 +-rw-r--r--. 1 root root 1084 Apr  7 16:55 debug-shell.service 
 +lrwxrwxrwx. 1 root root   16 Apr  7 16:55 default.target -> graphical.target 
 +drwxr-xr-x. 2 root root    6 Apr  7 16:55 default.target.wants 
 +-rw-r--r--. 1 root root  750 Jun 22  2018 dev-hugepages.mount 
 +-rw-r--r--. 1 root root  665 Jun 22  2018 dev-mqueue.mount 
 +-r--r--r--. 1 root root  345 Aug 17  2020 dm-event.service 
 +-r--r--r--. 1 root root  248 Aug 17  2020 dm-event.socket 
 +-rw-r--r--. 1 root root  457 Jun  2  2020 dnf-makecache.service 
 +--More--
 </code> </code>
  
-Supprimez maintenant le fichier **10M** de votre volume d'origine :+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 ~]# rm /mnt/lvm/10M +[root@centos8 ~]# ls -l /run/systemd/system
-rm: remove regular file '/mnt/lvm/10M'? y+total 0
 </code> </code>
  
-Constatez le résultat de cette suppression :+Les fichiers de configuration des Unités crées par les utilisateurs doivent être mis dans le répertoire **/usr/lib/systemd/user** :
  
 <code> <code>
-[root@centos8 ~]# df -Ph /mnt/lvm +[root@centos8 ~]# pkg-config systemd --variable=systemduserunitdir 
-Filesystem           Size  Used Avail Use% Mounted on +/usr/lib/systemd/user
-/dev/mapper/vg0-lv0  434M   17M  395M   5% /mnt/lvm +
- +
-[root@centos8 ~]# df -Ph /mnt/testsnap/ +
-Filesystem                Size  Used Avail Use% Mounted on +
-/dev/mapper/vg0-testsnap  434M   27M  385M   7% /mnt/testsnap +
- +
-[root@centos8 ~]# lvs +
-  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%> +
-**A Faire** - Restaurez le fichier 10M à partir du snapshot. +
-</WRAP> +
- +
-====LAB #6 - Suppression des Volumes===+
- +
-La suppression d'un volume logique se fait grace à la commande **lvremove** : +
- +
-<code> +
-[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> </code>
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** - Notez que cette opération necéssite à ce que le volume logique soit démonté.+**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 la commande **lvremove** sont :+Prenons le cas du service **sshd** qui est configuré par le fichier **/usr/lib/systemd/system/sshd.service** :
  
 <code> <code>
-[root@centos8 ~]# lvremove --help +[root@centos8 ~]# cat /usr/lib/systemd/system/sshd.service 
-  lvremove - Remove logical volume(sfrom the system+[Unit] 
 +Description=OpenSSH server daemon 
 +Documentation=man:sshd(8man:sshd_config(5) 
 +After=network.target sshd-keygen.target 
 +Wants=sshd-keygen.target
  
-  lvremove VG|LV|Tag|Select ... +[Service
- -A|--autobackup y|n +Type=notify 
- -f|--force ] +EnvironmentFile=-/etc/crypto-policies/back-ends/opensshserver.config 
- -S|--select String ] +EnvironmentFile=-/etc/sysconfig/sshd 
- [    --nohistory ] +ExecStart=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY 
- [    --noudevsync ] +ExecReload=/bin/kill -HUP $MAINPID 
- [    --reportformat basic|json ] +KillMode=process 
- [ COMMON_OPTIONS ]+Restart=on-failure 
 +RestartSec=42s
  
-  Common options for lvm: +[Install
- -d|--debug +WantedBy=multi-user.target
- [ -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>
  
-Le Volume Group peut aussi être supprimé :+Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** :
  
-<code> +  * **Description=OpenSSH server daemon**, 
-[root@centos8 ~]# vgremove vg0 +    * Cette directive est utilisée pour donner une courte description des fonctionnalités de l'Unité, 
-  Volume group "vg0" successfully removed +  * **Documentation=man:sshd(8) man:sshd_config(5)**, 
-</code>+    * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, 
 +  * **After=network.target sshd-keygen.target**, 
 +    * 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, 
 +  * **Wants=sshd-keygen.target**, 
 +    * 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 échec, l'Unité sshd sera démarré.
  
-Les options de la commande **vgremove** sont :+Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** :
  
-<code> +  * **Type=notify**, 
-[root@centos8 ~]# vgremove --help +    * Cette directive indique que le service informera Systemd quand son démarrage a terminé, 
-  vgremove Remove volume group(s)+  * **ExecStart=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY**, 
 +     * Cette directive définit l'exécutable à lancer, 
 +  * **ExecReload=/bin/kill -HUP $MAINPID**, 
 +    * Cette directive indique la commande necéssaire pour redémarrer le service, 
 +  * **KillMode=process**, 
 +    * 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, 
 +  * **Restart=on-failure**, 
 +    * Cette ligne indique que le service doit être re-démarré en cas d'arrêt de celui-ci. 
 +  * **RestartSec=42s**, 
 +    * Cette directive stipule le temps d'attente entre l'arrêt du service et le redémarrage par Systemd,
  
-  vgremove VG|Tag|Select ... +Dernièrement on note la présence de la ligne suivante dans la section **[Install]** :
- -f|--force ] +
- [ -S|--select String ] +
- [    --noudevsync ] +
- [    --reportformat basic|json ] +
- [ COMMON_OPTIONS ]+
  
-  Common options for lvm: +  * **WantedBy=multi-user.target**, 
--d|--debug ] +    * 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.
- [ -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>+
  
-Ainsi que le volume physique :+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 ~]# pvremove /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@centos8 ~]# systemctl show sshd 
-  Labels on physical volume "/dev/sdb6" successfully wiped. +Type=notify 
-  Labels on physical volume "/dev/sdb7" successfully wiped+Restart=on-failure 
-  Labels on physical volume "/dev/sdb9" successfully wiped.+NotifyAccess=main 
 +RestartUSec=42s 
 +TimeoutStartUSec=1min 30s 
 +TimeoutStopUSec=1min 30s 
 +RuntimeMaxUSec=infinity 
 +WatchdogUSec=0 
 +WatchdogTimestamp=Thu 2021-06-03 15:09:54 EDT 
 +WatchdogTimestampMonotonic=12502561 
 +PermissionsStartOnly=no 
 +RootDirectoryStartOnly=no 
 +RemainAfterExit=no 
 +GuessMainPID=yes 
 +MainPID=902 
 +ControlPID=0 
 +FileDescriptorStoreMax=0 
 +NFileDescriptorStore=0 
 +StatusErrno=0 
 +Result=success 
 +UID=[not set] 
 +GID=[not set] 
 +NRestarts=0 
 +ExecMainStartTimestamp=Thu 2021-06-03 15:09:54 EDT 
 +ExecMainStartTimestampMonotonic=12446178 
 +ExecMainExitTimestampMonotonic=0 
 +ExecMainPID=902 
 +ExecMainCode=0 
 +ExecMainStatus=0 
 +ExecStart={ path=/usr/sbin/sshd ; argv[]=/usr/sbin/sshd -D $OPTIONS $CRYPTO_POLICY ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; 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 } 
 +Slice=system.slice 
 +ControlGroup=/system.slice/sshd.service 
 +MemoryCurrent=6270976 
 +CPUUsageNSec=[not set] 
 +EffectiveCPUs= 
 +EffectiveMemoryNodes= 
 +TasksCurrent=1 
 +IPIngressBytes=18446744073709551615 
 +IPIngressPackets=18446744073709551615 
 +IPEgressBytes=18446744073709551615 
 +IPEgressPackets=18446744073709551615 
 +Delegate=no 
 +CPUAccounting=no 
 +CPUWeight=[not set] 
 +StartupCPUWeight=[not set] 
 +CPUShares=[not set] 
 +StartupCPUShares=[not set] 
 +CPUQuotaPerSecUSec=infinity 
 +CPUQuotaPeriodUSec=infinity 
 +AllowedCPUs= 
 +AllowedMemoryNodes= 
 +IOAccounting=no 
 +IOWeight=[not set] 
 +StartupIOWeight=[not set] 
 +BlockIOAccounting=no 
 +BlockIOWeight=[not set] 
 +lines 1-57
 </code> </code>
  
-Les options de la commande **pvremove** sont :+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 ~]# pvremove --help +[root@centos8 ~]# systemctl list-dependencies sshd.service 
-  pvremove Remove LVM label(s) from physical volume(s) +sshd.service 
- +● ├─system.slice 
-  pvremove PV ... +● ├─sshd-keygen.target 
- -f|--force ] +● │ ├─sshd-keygen@ecdsa.service 
- [    --reportformat basic|json ] +● │ ├─sshd-keygen@ed25519.service 
- [ COMMON_OPTIONS ] +● │ └─sshd-keygen@rsa.service 
- +● └─sysinit.target 
-  Common options for lvm: +●   ├─dev-hugepages.mount 
- -d|--debug ] +●   ├─dev-mqueue.mount 
- -h|--help ] +●   ├─dracut-shutdown.service 
- -q|--quiet ] +●   ├─import-state.service 
- -v|--verbose ] +●   ├─iscsi-onboot.service 
- -y|--yes ] +●   ├─kmod-static-nodes.service 
- -t|--test ] +●   ├─ldconfig.service 
- [    --commandprofile String ] +●   ├─loadmodules.service 
- [    --config String ] +●   ├─lvm2-lvmpolld.socket 
- [    --driverloaded y|n ] +●   ├─lvm2-monitor.service 
- [    --nolocking ] +●   ├─nis-domainname.service 
- [    --lockopt String ] +●   ├─plymouth-read-write.service 
- [    --longhelp ] +●   ├─plymouth-start.service 
- [    --profile String ] +●   ├─proc-sys-fs-binfmt_misc.automount 
- [    --version ] +●   ├─rngd.service 
- +●   ├─selinux-autorelabel-mark.service 
-  Use --longhelp to show all options and advanced commands.+●   ├─sys-fs-fuse-connections.mount 
 +●   ├─sys-kernel-config.mount 
 +●   ├─sys-kernel-debug.mount 
 +●   ├─systemd-ask-password-console.path 
 +●   ├─systemd-binfmt.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-random-seed.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 
 +●   ├─local-fs.target 
 +●   │ ├─-.mount 
 +●   │ ├─boot.mount 
 +●   │ └─systemd-remount-fs.service 
 +●   └─swap.target 
 +●     └─dev-disk-by\x2duuid-c8bb3f47\x2dd67f\x2d4b21\x2db781\x2d766899dc83d4.swap
 </code> </code>
  
-====LAB #7 Volumes Logiques en Miroir====+===2.2 Surchargement des Fichiers de Configuration par Défaut===
  
-Re-créez maintenant votre Volume Group :+Les fichiers de configuration par défaut peuvent aussi être surchargés par des fichiers dans d'autres répertoires :
  
 <code> <code>
-[root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@centos8 ~]# pkg-config systemd --variable=systemdsystemunitpath 
-  Physical volume "/dev/sdb6" successfully created. +/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
-  Physical volume "/dev/sdb7" successfully created. +
-  Physical volume "/dev/sdb9" successfully created. +
- +
-[root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 +
-  Volume group "vg0" successfully created+
 </code> </code>
- 
-Créez maintenant un Logical Volume en miroir grâce à l'option **-m** de la commande **lvcreate**, suivi du nombre de miroirs : 
  
 <code> <code>
-[root@centos8 ~]# lvcreate -1 -L 100M -n lv1 vg0 +[root@centos8 ~]# ls -l /etc/systemd/system 
-  Rounding up size to full physical extent 104.00 MiB +total 4 
-  Logical volume "lv1" created.+drwxr-xr-x. 2 root root   31 May  8  2020 basic.target.wants 
 +lrwxrwxrwx. root root   41 May  8  2020 dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service 
 +lrwxrwxrwx. 1 root root   44 Jun  3 14:02 dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service 
 +lrwxrwxrwx. 1 root root   57 May  8  2020 dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service 
 +lrwxrwxrwx. 1 root root   41 May  8  2020 dbus-org.freedesktop.timedate1.service -> /usr/lib/systemd/system/timedatex.service 
 +lrwxrwxrwx. 1 root root   37 May  8  2020 default.target -> /lib/systemd/system/multi-user.target 
 +drwxr-xr-x. 2 root root   32 May  8  2020 getty.target.wants 
 +drwxr-xr-x. 2 root root 4096 Jun  3 14:02 multi-user.target.wants 
 +drwxr-xr-x. 2 root root   48 May  8  2020 network-online.target.wants 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-blkmap.service.requires 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-idmapd.service.requires 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-mountd.service.requires 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 nfs-server.service.requires 
 +drwxr-xr-x. 2 root root   26 Jun  3 14:02 printer.target.wants 
 +drwxr-xr-x. 2 root root   52 Apr 19 12:07 remote-fs.target.wants 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-gssd.service.requires 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-statd-notify.service.requires 
 +drwxr-xr-x. 2 root root   33 Apr 19 12:07 rpc-statd.service.requires 
 +drwxr-xr-x. 2 root root  260 Jun  3 14:02 sockets.target.wants 
 +drwxr-xr-x. 2 root root  235 Apr 19 12:07 sysinit.target.wants 
 +lrwxrwxrwx. 1 root root   39 May  8  2020 syslog.service -> /usr/lib/systemd/system/rsyslog.service 
 +lrwxrwxrwx. 1 root root    9 May 11  2019 systemd-timedated.service -> /dev/null 
 +drwxr-xr-x. 2 root root   34 May  8  2020 timers.target.wants
 </code> </code>
  
-Constatez maintenant la présence du miroir : +====LAB #La Commande systemd-analyze====
- +
-<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 :+Pour avoir une évaluation du temps de démarrage, il convient d'utiliser la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# pvdisplay -m /dev/sdb6 /dev/sdb7 /dev/sdb9 +[root@centos8 ~]# systemd-analyze 
-  --- Physical volume --- +Startup finished in 1.665s (kernel) + 6.977s (initrd) + 8.458s (userspace) = 17.101s 
-  PV Name               /dev/sdb6 +multi-user.target reached after 5.528s in userspace
-  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 1 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 :+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 :
  
 <code> <code>
-[root@centos8 ~]# lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7 +[root@centos8 ~]# systemd-analyze blame 
-Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y +          4.080s dracut-initqueue.service 
-  Logical volume vg0/lv1 successfully converted.+          3.257s kdump.service 
 +          1.727s tuned.service 
 +          1.415s initrd-switch-root.service 
 +          1.393s NetworkManager-wait-online.service 
 +          1.116s systemd-machined.service 
 +          1.111s dracut-cmdline.service 
 +           850ms sssd.service 
 +           791ms vdo.service 
 +           713ms firewalld.service 
 +           622ms lvm2-monitor.service 
 +           605ms polkit.service 
 +           508ms chronyd.service 
 +           434ms avahi-daemon.service 
 +           426ms systemd-logind.service 
 +           417ms netcf-transaction.service 
 +           410ms dracut-pre-udev.service 
 +           295ms libvirtd.service 
 +           275ms dnf-makecache.service 
 +           243ms systemd-udevd.service 
 +           221ms systemd-journald.service 
 +           196ms systemd-tmpfiles-setup.service 
 +           151ms dracut-pre-pivot.service 
 +           139ms sysroot.mount 
 +           139ms systemd-update-utmp-runlevel.service 
 +           122ms systemd-vconsole-setup.service 
 +           110ms lvm2-pvscan@8:25.service 
 +            98ms systemd-udev-trigger.service 
 +            82ms gssproxy.service 
 +            81ms cups.service 
 +            79ms initrd-parse-etc.service 
 +            77ms NetworkManager.service 
 +            72ms lvm2-pvscan@8:23.service 
 +            69ms systemd-user-sessions.service 
 +            68ms lvm2-pvscan@8:22.service 
 +            67ms unbound-anchor.service 
 +            66ms rsyslog.service 
 +            62ms boot.mount 
 +            56ms sshd.service 
 +            54ms smartd.service 
 +            54ms systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service 
 +            53ms user@1000.service 
 +            52ms auditd.service 
 +            51ms plymouth-quit.service 
 +            49ms rngd-wake-threshold.service 
 +            46ms import-state.service 
 +            46ms systemd-tmpfiles-setup-dev.service 
 +            43ms ksmtuned.service 
 +            42ms plymouth-quit-wait.service 
 +            42ms var-lib-nfs-rpc_pipefs.mount 
 +            42ms rpc-statd-notify.service 
 +            38ms plymouth-switch-root.service 
 +            37ms systemd-remount-fs.service 
 +            37ms plymouth-start.service 
 +            33ms dev-disk-by\x2duuid-c8bb3f47\x2dd67f\x2d4b21\x2db781\x2d766899dc83d4.swap 
 +            33ms systemd-tmpfiles-clean.service 
 +            31ms dev-hugepages.mount 
 +lines 1-57
 </code> </code>
  
-De même, il est possible de créer un miroir pour un volume logique existant :+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 :
  
 <code> <code>
-[root@centos8 ~]# lvconvert -m 1 /dev/vg0/lv1 +[root@centos8 ~]# systemd-analyze critical-chain sshd.service 
-Are you sure you want to convert linear LV vg0/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y +The time after the unit is active or started is printed after the "@" character
-  Logical volume vg0/lv1 successfully converted+The time the unit takes to start is printed after the "+" character.
-</code>+
  
-Supprimez de nouveau votre miroir : +sshd.service +56ms 
- +└─network.target @3.799s 
-<code> +  └─NetworkManager.service @3.719s +77ms 
-[root@centos8 ~]# lvconvert -m 0 /dev/vg0/lv1 /dev/sdb7 +    └─network-pre.target @3.718s 
-Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y +      └─firewalld.service @3.004s +713ms 
-  Logical volume vg0/lv1 successfully converted.+        └─polkit.service @2.397s +605ms 
 +          └─basic.target @2.392s 
 +            └─sockets.target @2.392s 
 +              └─sssd-kcm.socket @2.391s 
 +                └─sysinit.target @2.379s 
 +                  └─systemd-update-utmp.service @2.370s +8ms 
 +                    └─auditd.service @2.317s +52ms 
 +                      └─systemd-tmpfiles-setup.service @2.118s +196ms 
 +                        └─import-state.service @2.070s +46ms 
 +                          └─local-fs.target @2.069s 
 +                            └─boot.mount @2.006s +62ms 
 +                              └─systemd-fsck@dev-disk-by\x2duuid-2ae4c035\x2d9244\x2d458c\x2d82c5\x2da49ae169cdb6.service @1.943s +54ms 
 +                                └─local-fs-pre.target @1.942s 
 +                                  └─lvm2-monitor.service @1.319s +622ms 
 +                                    └─dm-event.socket @1.317s 
 +                                      └─-.mount 
 +                                        └─system.slice 
 +                                          └─-.slice
 </code> </code>
  
-Les options de la commande **lvconvert** sont :+Les options de la commande **systemd-analyze** sont :
  
 <code> <code>
-[root@centos8 ~]# lvconvert --help +[root@centos7 ~]# systemd-analyze --help 
-  lvconvert Change logical volume layout+systemd-analyze [OPTIONS...] {COMMAND} ...
  
-  Convert LV to linear. +Process systemd profiling information
-  lvconvert --type linear LV +
- [ COMMON_OPTIONS ] +
- [ PV ... ]+
  
-  Convert LV to striped. +  -h --help           Show this help 
-  lvconvert --type striped LV +     --version        Show package version 
- -I|--stripesize Size[k|UNIT] ] +     --system         Connect to system manager 
- -R|--regionsize Size[m|UNIT] ] +     --user           Connect to user service manager 
- -i|--interval Number ] +     --order          When generating a dependency graph, show only order 
- [    --stripes Number ] +     --require        When generating a dependency graph, show only requirement 
- [ COMMON_OPTIONS ] +     --from-pattern=GLOB, --to-pattern=GLOB 
- [ PV ... ]+                      When generating a dependency graph, filter only origins 
 +                      or destinations, respectively 
 +     --fuzz=TIMESPAN  When printing the tree of the critical chain, print also 
 +                      services, which finished TIMESPAN earlier, than the 
 +                      latest in the branchThe unit of TIMESPAN is seconds 
 +                      unless specified with a different unit, i.e50ms 
 +     --no-pager       Do not pipe output into a pager
  
-  Convert LV to type mirror (also see type raid1), +Commands: 
-  lvconvert --type mirror LV +  time                Print time spent in the kernel before reaching userspace 
- [ -m|--mirrors [+|-]Number ] +  blame               Print list of running units ordered by time to init 
- [ -I|--stripesize Size[k|UNIT] ] +  critical-chain      Print tree of the time critical chain of units 
- [ -R|--regionsize Size[m|UNIT] ] +  plot                Output SVG graphic showing service initialization 
- [ -i|--interval Number ] +  dot                 Output dependency graph in dot(1format 
- [    --stripes Number ] +  set-log-level LEVEL Set logging threshold for systemd 
- [    --mirrorlog core|disk ] +  dump                Output state serialization of service manager
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Convert LV to raid or change raid layout  +
-  (a specific raid level must be used, e.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 mirror, or change number of mirror images. +
-  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. +
-  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. +
-  lvconvert -I|--stripesize Size[k|UNIT] LV_raid +
- [ -i|--interval Number ] +
- [ -R|--regionsize Size[m|UNIT] ] +
- [ COMMON_OPTIONS ] +
- +
-  Split images from raid1 or mirror LV and use them to create a new LV. +
-  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. +
-  lvconvert --splitmirrors Number --trackchanges LV_cache_raid1 +
- [ COMMON_OPTIONS ] +
- [ PV ... ] +
- +
-  Merge LV images that were split from a raid1 LV. +
-  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(sin 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> </code>
  
-====LAB #Modifier les Attributs LVM====+====LAB #Les Cibles Systemd====
  
-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** :+Chaque Cible est décrite par un fichier de configuration :
  
 <code> <code>
-[root@centos8 ~]# lvs +[root@centos8 ~]# cat /usr/lib/systemd/system/graphical.target 
-  LV   VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert + SPDX-License-Identifier: LGPL-2.1+ 
-  root cl_centos8 -wi-ao----  27.79g                                                     +# 
-  swap cl_centos8 -wi-ao----   3.20g                                                     + This file is part of systemd
-  lv1  vg0        -wi-a----- 104.00m                                                                                                  +
-</code>+ systemd is free software; you can redistribute it and/or modify it 
 + under the terms of the GNU Lesser General Public License as published by 
 +#  the Free Software Foundation; either version 2.1 of the License, or 
 +#  (at your option) any later version.
  
-<WRAP center round important 60%> +[Unit
-Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs. +Description=Graphical Interface 
-</WRAP> +Documentation=man:systemd.special(7) 
- +Requires=multi-user.target 
-La commande equivalente pour les Volume Groups est **vgs** +Wants=display-manager.service 
- +Conflicts=rescue.service rescue.target 
-<code> +After=multi-user.target rescue.service rescue.target display-manager.service 
-[root@centos8 ~]# vgs +AllowIsolate=yes
-  VG         #PV #LV #SN Attr   VSize   VFree   +
-  cl_centos8       0 wz--n- <31.00g      0  +
-  vg0          3     0 wz--n- 880.00m 776.00m+
 </code> </code>
  
-<WRAP center round important 60%> +Dans ce fichier on peut noter la présence des lignes suivantes :
-Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs. +
-</WRAP>+
  
-La commande equivalente pour les Physical Volumes est **pvs** :+  * **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.Contrôler les dépendances d'une Cible===
-[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>+
  
-<WRAP center round important 60%> +Les dépendances d'une Cible peuvent être consultées en utilisant la commande **systemctl list-dependencies** :
-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** :+
  
 <code> <code>
-[root@centos8 ~]# lvchange -a n /dev/vg0/lv1+[root@centos8 ~]# systemctl list-dependencies multi-user.target 
 +multi-user.target 
 +● ├─atd.service 
 +● ├─auditd.service 
 +● ├─avahi-daemon.service 
 +● ├─chronyd.service 
 +● ├─crond.service 
 +● ├─cups.path 
 +● ├─cups.service 
 +● ├─dbus.service 
 +● ├─dnf-makecache.timer 
 +● ├─firewalld.service 
 +● ├─irqbalance.service 
 +● ├─kdump.service 
 +● ├─ksm.service 
 +● ├─ksmtuned.service 
 +● ├─libstoragemgmt.service 
 +● ├─libvirtd.service 
 +● ├─mcelog.service 
 +● ├─mdmonitor.service 
 +● ├─netcf-transaction.service 
 +● ├─NetworkManager.service 
 +● ├─plymouth-quit-wait.service 
 +● ├─plymouth-quit.service 
 +● ├─rpcbind.service 
 +● ├─rsyslog.service 
 +● ├─smartd.service 
 +● ├─sshd.service 
 +● ├─sssd.service 
 +● ├─systemd-ask-password-wall.path 
 +● ├─systemd-logind.service 
 +● ├─systemd-update-utmp-runlevel.service 
 +● ├─systemd-user-sessions.service 
 +● ├─tuned.service 
 +● ├─vdo.service 
 +● ├─basic.target 
 +● │ ├─-.mount 
 +● │ ├─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 
 +● │ │ ├─libvirtd-ro.socket 
 +● │ │ ├─libvirtd.socket 
 +● │ │ ├─rpcbind.socket 
 +● │ │ ├─sssd-kcm.socket 
 +● │ │ ├─systemd-coredump.socket 
 +● │ │ ├─systemd-initctl.socket 
 +● │ │ ├─systemd-journald-dev-log.socket 
 +● │ │ ├─systemd-journald.socket 
 +● │ │ ├─systemd-udevd-control.socket 
 +lines 1-57
 </code> </code>
  
-Pour faire l'inverse il convient de saisir la commande suivante :+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 ~]# lvchange -a y /dev/vg0/lv1 +  * **Blanc** implique le service, la cible ou l'unité est inactif. 
-</code>+  * **Rouge** implique que le service, la cible ou l'unité n'a pas démarré à cause d'une erreur fatale.
  
-Les options de la commande **lvchange** sont :+Pour visualiser les Unités en état d'erreur fatale, utilisez la commande **systemctl --failed** :
  
 <code> <code>
-[root@centos8 ~]# lvchange --help +[root@centos8 ~]# systemctl --failed 
-  lvchange - Change the attributes of logical volume(s) +0 loaded units listed. Pass --all to see loaded but inactive unitstoo
- +To show all installed unit files use 'systemctl list-unit-files'.
-  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==== +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** :
- +
-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@centos8 ~]# ls -/etc/systemd/system/multi-user.target.wants 
-  Rounding up size to full physical extent 104.00 MiB +total 0 
-  Rounding size 104.00 MiB (13 extents) up to stripe boundary size 112.00 MiB(14 extents)+lrwxrwxrwx. 1 root root 35 May  8  2020 atd.service -> /usr/lib/systemd/system/atd.service 
-  Logical volume "lv2" created. +lrwxrwxrwx. 1 root root 38 May  8  2020 auditd.service -> /usr/lib/systemd/system/auditd.service 
-</code+lrwxrwxrwx. 1 root root 44 Jun  3 14:02 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service 
- +lrwxrwxrwx. 1 root root 39 May  8  2020 chronyd.service -/usr/lib/systemd/system/chronyd.service 
-Constatez la présence de vos bandes sur /dev/sda7 et sur /dev/sda9 : +lrwxrwxrwx. 1 root root 37 May  8  2020 crond.service -> /usr/lib/systemd/system/crond.service 
- +lrwxrwxrwx. 1 root root 33 Jun  3 14:02 cups.path -/usr/lib/systemd/system/cups.path 
-<code+lrwxrwxrwx. 1 root root 36 Jun  3 14:02 cups.service -/usr/lib/systemd/system/cups.service 
-[root@centos8 ~]# lvdisplay -/dev/vg0/lv2 +lrwxrwxrwx. 1 root root 43 May  8  2020 dnf-makecache.timer -> /usr/lib/systemd/system/dnf-makecache.timer 
-  --- Logical volume --- +lrwxrwxrwx. 1 root root 41 May  8  2020 firewalld.service -> /usr/lib/systemd/system/firewalld.service 
-  LV Path                /dev/vg0/lv2 +lrwxrwxrwx. 1 root root 42 May   2020 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service 
-  LV Name                lv2 +lrwxrwxrwx. 1 root root 37 May  8  2020 kdump.service -> /usr/lib/systemd/system/kdump.service 
-  VG Name                vg0 +lrwxrwxrwx1 root root 35 Apr 19 12:07 ksm.service -> /usr/lib/systemd/system/ksm.service 
-  LV UUID                MmXbPt-ZF8u-rnIv-3YU9-m64J-RCz2-6NzAuG +lrwxrwxrwx. 1 root root 40 Apr 19 12:07 ksmtuned.service -> /usr/lib/systemd/system/ksmtuned.service 
-  LV Write Access        read/write +lrwxrwxrwx. 1 root root 46 May   2020 libstoragemgmt.service -> /usr/lib/systemd/system/libstoragemgmt.service 
-  LV Creation host, time centos8.ittraining.loc, 2021-06-02 07:47:38 -0400 +lrwxrwxrwx. root root 40 Apr 19 12:07 libvirtd.service -> /usr/lib/systemd/system/libvirtd.service 
-  LV Status              available +lrwxrwxrwx. 1 root root 38 May   2020 mcelog.service -> /usr/lib/systemd/system/mcelog.service 
-  # open                 0 +lrwxrwxrwx. 1 root root 41 May  8  2020 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service 
-  LV Size                112.00 MiB +lrwxrwxrwx. root root 49 Apr 19 12:07 netcf-transaction.service -> /usr/lib/systemd/system/netcf-transaction.service 
-  Current LE             14 +lrwxrwxrwx. 1 root root 46 May  8  2020 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service 
-  Segments               +lrwxrwxrwx. 1 root root 41 Apr 19 12:07 nfs-client.target -> /usr/lib/systemd/system/nfs-client.target 
-  Allocation             inherit +lrwxrwxrwx. 1 root root 40 May  8  2020 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target 
-  Read ahead sectors     auto +lrwxrwxrwx. 1 root root 39 Apr 19 12:07 rpcbind.service -> /usr/lib/systemd/system/rpcbind.service 
-  - currently set to     8192 +lrwxrwxrwx. 1 root root 39 May  8  2020 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service 
-  Block device           253:+lrwxrwxrwx1 root root 38 May  8  2020 smartd.service -> /usr/lib/systemd/system/smartd.service 
-    +lrwxrwxrwx. 1 root root 36 May  8  2020 sshd.service -> /usr/lib/systemd/system/sshd.service 
-  --- Segments --- +lrwxrwxrwx. root root 36 May  8  2020 sssd.service -> /usr/lib/systemd/system/sssd.service 
-  Logical extents 0 to 13+lrwxrwxrwx. 1 root root 37 May  8  2020 tuned.service -> /usr/lib/systemd/system/tuned.service 
-    Type striped +lrwxrwxrwx. 1 root root 35 May  8  2020 vdo.service -> /usr/lib/systemd/system/vdo.service
-    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+
  
 +[root@centos8 ~]# ls -l /usr/lib/systemd/system/multi-user.target.wants
 +total 0
 +lrwxrwxrwx. 1 root root 15 Apr  7 12:08 dbus.service -> ../dbus.service
 +lrwxrwxrwx. 1 root root 15 Apr  7 16:55 getty.target -> ../getty.target
 +lrwxrwxrwx. 1 root root 24 Oct  6  2020 plymouth-quit.service -> ../plymouth-quit.service
 +lrwxrwxrwx. 1 root root 29 Oct  6  2020 plymouth-quit-wait.service -> ../plymouth-quit-wait.service
 +lrwxrwxrwx. 1 root root 33 Apr  7 16:55 systemd-ask-password-wall.path -> ../systemd-ask-password-wall.path
 +lrwxrwxrwx. 1 root root 25 Apr  7 16:55 systemd-logind.service -> ../systemd-logind.service
 +lrwxrwxrwx. 1 root root 39 Apr  7 16:55 systemd-update-utmp-runlevel.service -> ../systemd-update-utmp-runlevel.service
 +lrwxrwxrwx. 1 root root 32 Apr  7 16:55 systemd-user-sessions.service -> ../systemd-user-sessions.service
 </code> </code>
  
-Utilisez maintenant la commande **lvs** pour visualiser les volumes physiques utilisés par le volume logique :+===4.2 - La Cible par Défaut===
  
-<code> +==Consulter la Cible par Défaut==
-[root@centos8 ~]# lvs -o +devices +
-  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==== +Pour consulter la cible par défaut, il convient d'utiliser la commande **systemctl get-default** :
- +
-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@centos8 ~]# systemctl get-default 
-# Generated by LVM2 version 2.03.09(2)-RHEL8 (2020-05-28): Wed Jun  2 07:47:38 2021 +multi-user.target
- +
-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** :+La Cible par défaut est représentée par le lien symbolique **/etc/systemd/system/default.target** :
  
 <code> <code>
-[root@centos8 ~]# ls /etc/lvm/archive/ +[root@centos8 ~]# ls -l /etc/systemd/system/default.target 
-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 +lrwxrwxrwx1 root root 37 May   2020 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target
-vg0_00001-1993147316.vg  vg0_00003-1757437978.vg  vg0_00005-116946854.vg  vg0_00007-1006758937.vg  vg0_00009-1054420117.vg  vg0_00011-973084311.vg+
 </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** :+==Modifier la Cible par Défaut==
  
-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 :+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** :
  
 <code> <code>
-[root@centos8 ~]# vgcfgbackup vg0 +[root@centos8 ~]# systemctl set-default graphical.target 
-  Volume group "vg0" successfully backed up.+Removed /etc/systemd/system/default.target. 
 +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target. 
 +[root@centos8 ~]# ls -l /etc/systemd/system/default.target 
 +lrwxrwxrwx. 1 root root 40 Jun  6 08:11 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target 
 +[root@centos8 ~]# systemctl set-default multi-user.target 
 +Removed /etc/systemd/system/default.target. 
 +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target. 
 +[root@centos8 ~]# ls -l /etc/systemd/system/default.target 
 +lrwxrwxrwx. 1 root root 41 Jun  6 08:11 /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-user.target
 </code> </code>
  
-Il est aussi possible de modifier l'emplacement de la sauvegarde avec l'option **-f** de la commande :+==Modifier la Cible en Cours==
  
-<code> +Il est possible de modifier la cible actuellement en cours en utilisant la commande **systemctl isolate** :
-[root@centos8 ~]# vgcfgbackup -f /tmp/vg0_backup vg0 +
-  Volume group "vg0" successfully backed up. +
-</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** :+
  
 <code> <code>
-[root@centos8 ~]# vgcfgrestore --list vg0 +[root@centos8 ~]# systemctl isolate rescue 
-    +[root@centos8 ~]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -1 
-  File: /etc/lvm/archive/vg0_00000-427117660.vg +rescue.target       loaded active active Rescue Mode              
-  VG name:    vg0 +[root@centos8 ~]# runlevel 
-  Description: Created *before* executing 'vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9' +3 1 
-  Backup Time: Wed May 26 10:43:14 2021 +[root@centos8 ~]# who -r 
- +         run-level 1  2021-06-15 04:22                   last=3
-    +
-  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 -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> </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 -l +[root@centos8 ~]# systemctl isolate multi-user 
-Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors +[root@centos8 ~]# systemctl list-units --type target | egrep "eme|res|gra|mul" | head -
-Units: sectors of * 512 = 512 bytes +multi-user.target      loaded active active Multi-User System           
-Sector size (logical/physical): 512 bytes / 512 bytes +[root@centos8 ~]# runlevel 
-I/O size (minimum/optimal): 512 bytes / 512 bytes +3 
-Disklabel type: dos +[root@centos8 ~]# who -r 
-Disk identifier: 0xb0dacb39 +         run-level 3  2021-06-15 04:24                   last=1
- +
-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 * 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-lv1104 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 * 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** :+====LAB #5 Gestion des Services====
  
-<code> +===5.1 - Gestion des Instances Uniques===
-[root@centos8 ~]# mke2fs -j /dev/sdb12 +
-mke2fs 1.45.6 (20-Mar-2020) +
-Creating filesystem with 204800 1k blocks and 51200 inodes +
-Filesystem UUID: a2515f45-a32a-4e87-b7e6-170448f3f803 +
-Superblock backups stored on blocks:  +
- 8193, 24577, 40961, 57345, 73729 +
- +
-Allocating group tables: done                             +
-Writing inode tables: done                             +
-Creating journal (4096 blocks): done +
-Writing superblocks and filesystem accounting information: done  +
-</code>+
  
-Les options de la commande **mke2fs** sont :+Commencez par installer le paquet **httpd** :
  
 <code> <code>
-[root@centos8 ~]# mke2fs --help +[root@centos8 ~]# dnf install httpd
-mke2fs: invalid option -- '-' +
-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%> +Pour obtenir le détail sur un service donnéil convient d'utiliser la commande **systemctl status** :
-**Important** : Lors de la mise en place d'un filesystem ext2/ext3/ext4le 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@centos8 ~]# systemctl status httpd.service 
-dumpe2fs 1.45.6 (20-Mar-2020) +● httpd.service The Apache HTTP Server 
-Filesystem volume name:   <none> +   Loadedloaded (/usr/lib/systemd/system/httpd.service; disabled; vendor presetdisabled
-Last mounted on:          <not available> +   Activeinactive (dead
-Filesystem UUID:          a2515f45-a32a-4e87-b7e6-170448f3f803 +     Docsman:httpd.service(8)
-Filesystem magic number:  0xEF53 +
-Filesystem revision #   (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     (user root+
-Reserved blocks gid     (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%> +Dans le cas du service httpd ci-dessus, on peut constater que le statut est **disabled**Le statut peut être une de 2 valeurs :
-**Important** Le drapeau **Filesystem features     has_journal ...** démontre que Ext3 est utilisé sur cette partition. +
-</WRAP>+
  
-Les options de cette commande sont :+  * **disabled** - le service ne démarrera pas lors du prochain démarrage du système. 
 +  * **enabled** - le service démarrera lors du prochain démarrage du système.
  
-<code> +Il est possible de vérifier le statut en utilisant le commande **systemctl is-enabled** :
-[root@centos8 ~]# dumpe2fs --help +
-dumpe2fs 1.45.6 (20-Mar-2020) +
-dumpe2fs: invalid option -- '-' +
-Usage: dumpe2fs [-bfghimxV] [-o superblock=<num>] [-o blocksize=<num>] device +
-</code> +
- +
-Pour supprimer le journal du système de fichier Ext3 sur cette partition, il convient d'utiliser la commande **tune2fs**+
  
 <code> <code>
-[root@centos8 ~]# tune2fs -O ^has_journal /dev/sdb12 +[root@centos8 ~]# systemctl is-enabled httpd.service 
-tune2fs 1.45.6 (20-Mar-2020)+disabled
 </code> </code>
  
-Les options de cette commande sont :+Pour rendre le statut **enabled**, il convient d'utiliser la commande **systemctl enable** :
  
 <code> <code>
-[root@centos8 ~]# tune2fs --help +[root@centos8 ~]# systemctl enable httpd.service 
-tune2fs 1.45.6 (20-Mar-2020) +Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
-tune2fs: invalid option -- '-' +
-Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group] +
- [-i interval[d|m|w]] [-j] [-J journal_options] [-l] +
- [-m reserved_blocks_percent] [-o [^]mount_options[,...]] +
- [-r reserved_blocks_count] [-user] [-C mount_count] +
- [-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 :+[root@centos8 ~]# systemctl is-enabled httpd.service 
 +enabled
  
-<code> +[root@centos8 ~]# systemctl status httpd.service 
-[root@centos8 ~]# dumpe2fs -h /dev/sdb12 +● httpd.service The Apache HTTP Server 
-dumpe2fs 1.45.6 (20-Mar-2020) +   Loadedloaded (/usr/lib/systemd/system/httpd.service; enabled; vendor presetdisabled
-Filesystem volume name:   <none> +   Activeinactive (dead
-Last mounted on         <not available> +     Docsman:httpd.service(8)
-Filesystem UUID:          a2515f45-a32a-4e87-b7e6-170448f3f803 +
-Filesystem magic number:  0xEF53 +
-Filesystem revision #:    1 (dynamic) +
-Filesystem features:      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:              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/+
-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     (user root+
-Reserved blocks gid     (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> </code>
  
-<WRAP center round important 60%> +Dans le cas du service httpd ci-dessus, on peut maintenant constater que l'état est **inactive (dead)**.  L'état peut être une de 7 valeurs :
-**Important** : Notez que le drapeau **Filesystem features:      has_journal ...** a été supprimé. +
-</WRAP>+
  
-Supprimez maintenant l'inode du journal : +  * **inactive (dead)** - le service est arrêté. 
- +  * **active(running** le service est démarré avec un ou plusieurs processus
-<code> +  * **active(exited)** - le service a terminé une configuration unique. 
-[root@centos8 ~]# fsck /dev/sdb12 +  * **active(waiting)** le service est démarré mais en attente d'un évènement. 
-fsck from util-linux 2.32.1 +  * **activating** le service est en cours d'activation. 
-e2fsck 1.45.(20-Mar-2020) +  * **deactivating** - le service est en cours de désactivation. 
-/dev/sdb12: clean, 11/51200 files, 8013/204800 blocks +  * **failed** - le service a rencontré une erreur fatale.
-</code>+
  
-Créez maintenant un point de montage pour /dev/sdb12 :+Il est possible de vérifier l'état en utilisant le commande **systemctl is-active** :
  
 <code> <code>
-[root@centos8 ~]# mkdir /mnt/sdb12+[root@centos8 ~]# systemctl is-active httpd.service 
 +inactive
 </code> </code>
  
-Essayez de monter /dev/sdb12 en tant que système de fichiers Ext3. Vous obtiendrez un résultat similaire à celui-ci :+Pour rendre l'état **active(running)**, utilisez la commande suivante :
  
 <code> <code>
-[root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 +[root@centos8 ~]# systemctl start httpd.service
-mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error.+
 </code> </code>
  
-<WRAP center round important 60%> +Vérifiez ensuite l'état du service :
-**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 :+
  
 <code> <code>
-[root@centos8 ~]# mount -t ext2 /dev/sdb12 /mnt/sdb12 +[root@centos8 ~]# systemctl is-active httpd.service 
-</code>+active
  
-===LAB #12 Convertir un Système de Fichiers Ext2 en Ext3===+[root@centos8 ~]systemctl status httpd.service 
 +● httpd.service The Apache HTTP Server 
 +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) 
 +   Active: active (running) since Sun 2021-06-06 15:33:06 EDT; 14s ago 
 +     Docs: man:httpd.service(8) 
 + Main PID: 34382 (httpd) 
 +   Status: "Running, listening on: port 80" 
 +    Tasks: 213 (limit: 23719) 
 +   Memory: 36.3M 
 +   CGroup: /system.slice/httpd.service 
 +           ├─34382 /usr/sbin/httpd -DFOREGROUND 
 +           ├─34383 /usr/sbin/httpd -DFOREGROUND 
 +           ├─34384 /usr/sbin/httpd -DFOREGROUND 
 +           ├─34385 /usr/sbin/httpd -DFOREGROUND 
 +           └─34386 /usr/sbin/httpd -DFOREGROUND
  
-Pour replacer le journal sur /dev/sdb12, il convient d'utiliser la commande **tune2fs** : +Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
- +Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
-<code> +Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening onport 80
-[root@centos8 ~]# umount /mnt/sdb12 +
- +
-[root@centos8 ~]# tune2fs -j /dev/sdb12 +
-tune2fs 1.45.6 (20-Mar-2020) +
-Creating journal inodedone+
 </code> </code>
  
-<WRAP center round important 60%> +Pour arrêter une Unité de service, utilisez la commande suivante :
-**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=== +
- +
-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@centos8 ~]# systemctl stop httpd.service 
-mke2fs 1.45.6 (20-Mar-2020+[root@centos8 ~]# systemctl status httpd.service 
-Creating filesystem with 512000 1k blocks and inodes +● httpd.service The Apache HTTP Server 
-Filesystem UUID23327281-e88a-4da0-bafa-50ee10c52937 +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) 
-Superblock backups stored on blocks+   Active: inactive (dead) since Sun 2021-06-06 23:58:04 EDT; 8s ago 
 +     Docs: man:httpd.service(8
 +  Process: 34382 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS) 
 + Main PID34382 (code=exited, status=0/SUCCESS) 
 +   Status: "Running, listening on: port 80"
  
-Zeroing journal device  +Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
 +Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
 +Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening on: port 80 
 +Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
 +Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. 
 +Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.
 </code> </code>
  
-<WRAP center round important 60%> +Pour désactiver un service au prochain démarrage du système, utilisez l'option **disable** :
-**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 -j -J device=/dev/sdb11 /dev/sdb12 +[root@centos8 ~]# systemctl disable httpd.service 
-mke2fs 1.45.6 (20-Mar-2020) +Removed /etc/systemd/system/multi-user.target.wants/httpd.service. 
-Using journal device's blocksize1024 +[root@centos8 ~]# systemctl status httpd.service 
-/dev/sdb12 contains a ext3 file system +● httpd.service The Apache HTTP Server 
- last mounted on Wed Jun  2 08:03:11 2021 +   Loadedloaded (/usr/lib/systemd/system/httpd.service; disabled; vendor presetdisabled) 
-Proceed anyway? (y,N+   Active: inactive (dead
-Creating filesystem with 204800 1k blocks and 51200 inodes +     Docsman:httpd.service(8)
-Filesystem UUID0e783411-6407-4cba-8db5-0e2729000c9e +
-Superblock backups stored on blocks +
- 8193, 24577, 40961, 57345, 73729+
  
-Allocating group tablesdone                             +Jun 06 15:33:05 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-Writing inode tablesdone                             +Jun 06 15:33:06 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
-Adding journal to device /dev/sdb11done +Jun 06 15:33:06 centos8.ittraining.loc httpd[34382]: Server configured, listening on: port 80 
-Writing superblocks and filesystem accounting informationdone +Jun 06 23:58:02 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
 +Jun 06 23:58:04 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. 
 +Jun 06 23:58:04 centos8.ittraining.loc systemd[1]Stopped The Apache HTTP Server.
 </code> </code>
  
-<WRAP center round important 60%> +===5.2 - Gestion d'Instances Multiples===
-**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=== +Systemd permet l'utilisation des gabarits (templates) des fichiers de configuration des Unités. De cette façon il est possible de faire coexister deux ou plusieurs instances du même service. Un gabarit est reconnaissable par le caractère **@** qui est placé juste avant le point dans le nom du fichier :
- +
-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@centos8 ~]# cat /usr/lib/systemd/system/httpd@.service 
-tune2fs 1.45.(20-Mar-2020) +# This is a template for httpd instances. 
-Setting interval between checks to 8640000 seconds +# See httpd@.service(8for more information.
-</code>+
  
-Dernièrement, pour obtenir seul l'UUID du système de fichiers, utilisez les commandes **dumpe2fs** et **grep** :+[Unit] 
 +Description=The Apache HTTP Server 
 +After=network.target remote-fs.target nss-lookup.target 
 +Documentation=man:httpd@.service(8)
  
-<code> +[Service] 
-[root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID +Type=notify 
-dumpe2fs 1.45.6 (20-Mar-2020) +Environment=LANG=C 
-Filesystem UUID:          0e783411-6407-4cba-8db5-0e2729000c9e +Environment=HTTPD_INSTANCE=%i 
-Journal UUID:             23327281-e88a-4da0-bafa-50ee10c52937 +ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-%i 
-</code>+ExecStartPre=/bin/chown root.apache /run/httpd/instance-%i 
 +ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND -f conf/%i.conf 
 +ExecReload=/usr/sbin/httpd $OPTIONS -k graceful -f conf/%i.conf 
 +# Send SIGWINCH for graceful stop 
 +KillSignal=SIGWINCH 
 +KillMode=mixed 
 +PrivateTmp=true
  
-====Ext4==== +[Install
- +WantedBy=multi-user.target
-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> +
-[root@centos8 ~]# mkfs.ext4 /dev/sdb11 +
-mke2fs 1.45.6 (20-Mar-2020) +
-/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                             +
-Writing inode tables: done                             +
-Creating journal (8192 blocks): done +
-Writing superblocks and filesystem accounting information: done +
 </code> </code>
  
-Les options de cette commande sont :+Une instance créée à partir de ce gabarit devrait avoir un nom sous la forme suivante :
  
 <code> <code>
-[root@centos8 ~]# mkfs.ext4 --help +httpd@<nom_instance>.service
-mkfs.ext4: invalid option -- '-' +
-Usage: mkfs.ext4 [-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>
  
-Consultez maintenant les caractéristiques du système de fichier :+Dans ce fichier on peut constater l'utilisation d'un **identifier** sous la forme de **%i**. Les identifiers sont de deux types - un dit **échappé** où les caractères non-ASCII alphanumérique sont remplacés par **escapes** de type langage C et l'autre non-échappé :
  
-<code> +  * %n : est remplacé par le nom complet échappé de l'Unité
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | more +  * %N est remplacé par le nom complet non-échappé de l'Unité. 
-dumpe2fs 1.45.6 (20-Mar-2020) +  * %p est remplacé par le préfixe échappé de l'Unité, c'est-à-dire la partie **avant** le caractère @. 
-Filesystem volume name  <none> +  * %P est remplacé par le préfixe non-échappé de l'Unité, c'est-à-dire la partie **avant** le caractère @. 
-Last mounted on         <not available> +  * %i est remplacé par le nom de l'instance échappé de l'Unité, c'est-à-dire la partie **après** le caractère @ et **avant** le point. 
-Filesystem UUID         72a6ad08-7023-4561-adcb-d434e00afed1 +  * %I est remplacé par le nom de l'instance non-échappé de l'Unité, c'est-à-dire la partie **après** le caractère @ et **avant** le point. 
-Filesystem magic number:  0xEF53 +  * %f est remplacé par le préfixe non-échappé ou le nom de l'instance non-échappé préfixé par le caractère **/**. 
-Filesystem revision #   1 (dynamic) +  * %c est remplacé par le CGroup de l'Unité sans le chemin /sys/fs/cgroup/systemd/. 
-Filesystem features     has_journal ext_attr resize_inode dir_index filetype e +  * %u est remplacé par le nom de l'utilisateur responsable de l'exécution de l'Unité. 
-xtent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize meta +  * %U est remplacé par l'UID de l'utilisateur responsable de l'exécution de l'Unité. 
-data_csum +  * %H est remplacé par le nom d'hôte sur lequel est exécuté l'Unité. 
-Filesystem flags        signed_directory_hash  +  * %% est remplacé" par le caractère **%**.
-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>+
  
-===LAB #16 - Ajouter une Etiquette au Système de Fichiers Ext4=== +Créez maintenant deux copies du fichier **/usr/lib/systemd/system/httpd@.service** :
- +
-Utilisez la commande **e2label** pour associer une étiquette au système de fichiers :+
  
 <code> <code>
-[root@centos8 ~]# e2label /dev/sdb11 my_ext4 +[root@centos8 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance01.service 
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | more +[root@centos8 ~]# cp /usr/lib/systemd/system/httpd@.service /usr/lib/systemd/system/httpd@instance02.service
-dumpe2fs 1.45.6 (20-Mar-2020) +
-Filesystem volume name:   my_ext4 +
-Last mounted on:          <not available> +
-Filesystem UUID:          72a6ad08-7023-4561-adcb-d434e00afed1 +
-Filesystem magic number:  0xEF53 +
-Filesystem revision #:    1 (dynamic) +
-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>
  
-<WRAP center round important 60%> +Créez deux copies du fichier **/etc/httpd/conf/httpd.conf** :
-**Important** - Notez que l'étiquette doit être de 16 caractères maximum. +
-</WRAP> +
- +
-Créez un point de montage dans **/mnt** et essayez de monter **/dev/sdb11** en tant qu'Ext3 :+
  
 <code> <code>
-[root@centos8 ~]# mkdir /mnt/sdb11 +[root@centos8 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance01.conf 
- +[root@centos8 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/instance02.conf
-[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%> +Editez la directive **Listen** du fichier **/etc/httpd/conf/instance01.conf** et ajoutez la directive **PidFile** :
-**Important** - Notez l'erreur qui est signalée. +
-</WRAP> +
- +
-Montez de nouveau la partition **sans** stipuler le type de système de fichiers :+
  
 <code> <code>
-[root@centos8 ~]# mount /dev/sdb11 /mnt/sdb11+[root@centos8 ~]# vi /etc/httpd/conf/instance01.conf  
 +[root@centos8 ~]# more /etc/httpd/conf/instance01.conf  
 +
 +# This is the main Apache HTTP server configuration file.  It contains the 
 +# configuration directives that give the server its instructions. 
 +# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. 
 +# In particular, see  
 +# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> 
 +# for a discussion of each configuration directive. 
 +
 +# See the httpd.conf(5) man page for more information on this configuration, 
 +# and httpd.service(8) on using and configuring the httpd service. 
 +
 +# Do NOT simply read the instructions in here without understanding 
 +# what they do.  They're here only as hints or reminders.  If you are unsure 
 +# consult the online docs. You have been warned.   
 +
 +# Configuration and logfile names: If the filenames you specify for many 
 +# of the server's control files begin with "/" (or "drive:/" for Win32), the 
 +# server will use that explicit path.  If the filenames do *not* begin 
 +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' 
 +# with ServerRoot set to '/www' will be interpreted by the 
 +# server as '/www/log/access_log', where as '/log/access_log' will be 
 +# interpreted as '/log/access_log'.
  
-[root@centos8 ~]mount | grep sdb11 +
-/dev/sdb11 on /mnt/sdb11 type ext4 (rw,relatime,seclabel) +# ServerRoot: The top of the directory tree under which the server'
-</code>+# configuration, error, and log files are kept. 
 +
 +# Do not add a slash at the end of the directory path.  If you point 
 +# ServerRoot at a non-local disk, be sure to specify a local disk on the 
 +# Mutex directiveif file-based mutexes are used.  If you wish to share the 
 +# same ServerRoot for multiple httpd daemonsyou will need to change at 
 +# least PidFile. 
 +
 +ServerRoot "/etc/httpd"
  
-<WRAP center round important 60%+
-**Important** - Constatez que la partition a été monté en tant qu'Ext4+# Listen: Allows you to bind Apache to specific IP addresses and/or 
-</WRAP>+# ports, instead of the default. See also the <VirtualHost
 +# directive
 +
 +# Change this to Listen on specific IP addresses as shown below to  
 +# prevent Apache from glomming onto all bound IP addresses. 
 +
 +#Listen 12.34.56.78:80 
 +Listen 8008 
 +PidFile /var/run/httpd/instance01.pid
  
-===LAB #17 Convertir un Système de Fichiers Ext3 en Ext4===+# 
 +# Dynamic Shared Object (DSO) Support 
 +
 +# To be able to use the functionality of a module which was built as a DSO you 
 +# have to place corresponding `LoadModule' lines at this location so the 
 +# directives contained in it are actually available _before_ they are used. 
 +# Statically compiled modules (those listed by `httpd -l') do not need 
 +# to be loaded here. 
 +
 +# Example: 
 +# LoadModule foo_module modules/mod_foo.so 
 +--More--(19%) 
 +</code> 
  
-Créez un système de fichiers ext3 sur /dev/sdb12 :+Editez la directive **Listen** du fichier **/etc/httpd/conf/instance02.conf**  et ajoutez la directive **PidFile** :
  
 <code> <code>
-[root@centos8 ~]# mkfs.ext3 /dev/sdb12 +[root@centos8 ~]# vi /etc/httpd/conf/instance02.conf  
-mke2fs 1.45.6 (20-Mar-2020) +[root@centos8 ~]# more /etc/httpd/conf/instance02.conf  
-/dev/sdb12 contains a ext3 file system +
- created on Wed Jun  08:10:40 2021 +# This is the main Apache HTTP server configuration file It contains the 
-Proceed anyway? (y,Ny +# configuration directives that give the server its instructions
-Creating filesystem with 204800 1k blocks and 51200 inodes +# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. 
-Filesystem UUIDb73322d4-f2e4-43bc-96ae-422d4584f3de +# In particular, see  
-Superblock backups stored on blocks:  +# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> 
- 819324577, 40961, 57345, 73729+# for a discussion of each configuration directive. 
 +
 +# See the httpd.conf(5) man page for more information on this configuration, 
 +# and httpd.service(8on using and configuring the httpd service. 
 +
 +# Do NOT simply read the instructions in here without understanding 
 +# what they do.  They're here only as hints or reminders.  If you are unsure 
 +# consult the online docs. You have been warned.   
 +
 +# Configuration and logfile names: If the filenames you specify for many 
 +# of the server's control files begin with "/" (or "drive:/" for Win32), the 
 +# server will use that explicit path.  If the filenames do *not* begin 
 +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' 
 +# with ServerRoot set to '/www' will be interpreted by the 
 +# server as '/www/log/access_log'where as '/log/access_log' will be 
 +# interpreted as '/log/access_log'.
  
-Allocating group tables: done                             +# 
-Writing inode tablesdone                             +# ServerRootThe top of the directory tree under which the server's 
-Creating journal (4096 blocks): done +# configuration, error, and log files are kept. 
-Writing superblocks and filesystem accounting information: done  +
-</code>+# Do not add a slash at the end of the directory path.  If you point 
 +# ServerRoot at a non-local disk, be sure to specify a local disk on the 
 +# Mutex directive, if file-based mutexes are used.  If you wish to share the 
 +# same ServerRoot for multiple httpd daemons, you will need to change at 
 +# least PidFile. 
 +
 +ServerRoot "/etc/httpd"
  
-Montez maintenant **/dev/sdb12** sur /mnt/sdb12 +
- +# ListenAllows you to bind Apache to specific IP addresses and/or 
-<code+# ports, instead of the default. See also the <VirtualHost
-[root@centos8 ~]mount /dev/sdb12 /mnt/sdb12 +directive. 
- +
-[root@centos8 ~]ls -l /mnt/sdb12 +# Change this to Listen on specific IP addresses as shown below to  
-total 12 +# prevent Apache from glomming onto all bound IP addresses. 
-drwx------. 2 root root 12288 Jun  2 08:42 lost+found+
 +#Listen 12.34.56.78:80 
 +Listen 8009  
 +PidFile /var/run/httpd/instance02.pid 
 +# 
 +Dynamic Shared Object (DSO) Support 
 +
 +# To be able to use the functionality of a module which was built as a DSO you 
 +# have to place corresponding `LoadModule' lines at this location so the 
 +# directives contained in it are actually available _before_ they are used. 
 +# Statically compiled modules (those listed by `httpd -l') do not need 
 +# to be loaded here. 
 +
 +# Example: 
 +# LoadModule foo_module modules/mod_foo.so 
 +--More--(19%)
 </code> </code>
  
-Créez le fichier **/mnt/sdb12/check_file** :+Démarrez les deux services :
  
 <code> <code>
-[root@centos8 ~]# touch /mnt/sdb12/check_file +[root@centos8 ~]# systemctl start httpd@instance01.service 
-</code>+[root@centos8 ~]# systemctl status httpd@instance01.service 
 +● httpd@instance01.service - The Apache HTTP Server 
 +   Loaded: loaded (/usr/lib/systemd/system/httpd@instance01.service; disabled; vendor preset: disabled) 
 +   Active: active (running) since Mon 2021-06-07 01:40:43 EDT; 7s ago 
 +     Docs: man:httpd@.service(8) 
 +  Process: 43854 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
 +  Process: 43852 ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-instance01 (code=exited, status=0/SUCCESS) 
 + Main PID: 43856 (httpd) 
 +   Status: "Started, listening on: port 8008" 
 +    Tasks: 213 (limit: 23719) 
 +   Memory: 43.6M 
 +   CGroup: /system.slice/system-httpd.slice/httpd@instance01.service 
 +           ├─43856 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +           ├─43857 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +           ├─43858 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +           ├─43859 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf 
 +           └─43860 /usr/sbin/httpd -DFOREGROUND -f conf/instance01.conf
  
-Injectez la chaine **check file** dans le fichier /mnt/sdb12/check_file puis démontez /dev/sdb12 +Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
- +Jun 07 01:40:43 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
-<code> +Jun 07 01:40:43 centos8.ittraining.loc httpd[43856]: Server configured, listening on: port 8008 
-[root@centos8 ~]# echo "check file/mnt/sdb12/check_file+[root@centos8 ~]# systemctl start httpd@instance02.service 
 +[root@centos8 ~]# systemctl status httpd@instance02.service 
 +● httpd@instance02.service - The Apache HTTP Server 
 +   Loaded: loaded (/usr/lib/systemd/system/httpd@instance02.service; disabled; vendor preset: disabled) 
 +   Active: active (running) since Mon 2021-06-07 01:36:45 EDT; 4min 24s ago 
 +     Docs: man:httpd@.service(8) 
 +  Process: 43568 ExecStartPre=/bin/chown root.apache /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 +  Process: 43566 ExecStartPre=/bin/mkdir -m 710 -p /run/httpd/instance-instance02 (code=exited, status=0/SUCCESS) 
 + Main PID: 43569 (httpd) 
 +   Status: "Running, listening on: port 8009" 
 +    Tasks: 213 (limit: 23719) 
 +   Memory: 43.6M 
 +   CGroup: /system.slice/system-httpd.slice/httpd@instance02.service 
 +           ├─43569 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +           ├─43571 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +           ├─43572 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +           ├─43573 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf 
 +           └─43574 /usr/sbin/httpd -DFOREGROUND -f conf/instance02.conf
  
-[root@centos8 ~]# umount /dev/sdb12+Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
 +Jun 07 01:36:45 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
 +Jun 07 01:36:45 centos8.ittraining.loc httpd[43569]: Server configured, listening on: port 8009
 </code> </code>
  
-Exécutez e2fsck sur /dev/sda12 :+===5.3 - Interdire la Modification du Statut d'un Service===
  
-<code> +Il est possible d'interdire la modification en utilisant la commande **systemctl mask**:
-[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 :+
  
 <code> <code>
-[root@centos8 ~]# tune2fs -O extents,uninit_bg,dir_index /dev/sdb12 +[root@centos8 ~]# systemctl status httpd.service 
-tune2fs 1.45.6 (20-Mar-2020+● httpd.service The Apache HTTP Server 
-</code>+   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) 
 +   Active: inactive (dead
 +     Docs: man:httpd.service(8)
  
-Optimisez le système de fichiers :+Jun 07 18:27:25 centos8.ittraining.loc httpd[58535]: Server configured, listening on: port 80 
 +Jun 07 18:27:29 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
 +Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. 
 +Jun 07 18:27:30 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server. 
 +Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
 +Jun 07 18:27:32 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
 +Jun 07 18:27:32 centos8.ittraining.loc httpd[58760]: Server configured, listening on: port 80 
 +Jun 07 18:27:34 centos8.ittraining.loc systemd[1]: Stopping The Apache HTTP Server... 
 +Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: httpd.service: Succeeded. 
 +Jun 07 18:27:36 centos8.ittraining.loc systemd[1]: Stopped The Apache HTTP Server.
  
-<code> +[root@centos8 ~]# systemctl mask httpd.service 
-[root@centos8 ~]# e2fsck -fDC0 /dev/sdb12 +Created symlink /etc/systemd/system/httpd.service → /dev/null.
-e2fsck 1.45.6 (20-Mar-2020) +
-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>+
  
-Essayez de monter **/dev/sdb12** en tant qu'Ext3 :+[root@centos8 ~]# systemctl enable httpd.service 
 +Failed to enable unit: Unit file /etc/systemd/system/httpd.service is masked.
  
-<code> +[root@centos8 ~]# systemctl start httpd.service 
-[root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 +Failed to start httpd.serviceUnit httpd.service is masked.
-mount: /mnt/sdb12wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error.+
 </code> </code>
  
-Montez /dev/sdb12 sans spécifier le type de fichiers Ext3 et vérifiez le contenu du fichier **check_file** :+Pour autoriser de nouveau les modifications, il convient d'utiliser la commande **systemctl unmask** :
  
 <code> <code>
-[root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12+[root@centos8 ~]# systemctl unmask httpd.service 
 +Removed /etc/systemd/system/httpd.service.
  
-[root@centos8 ~]# ls -l /mnt/sdb12 +[root@centos8 ~]# systemctl enable httpd.service 
-total 14 +Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
--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@centos8 ~]# systemctl start httpd.service
-check file +
-</code>+
  
-Dernièrementpour obtenir seul l'UUID du système de fichiers, utilisez les commandes **dumpe2fs** et **grep** :+[root@centos8 ~]# systemctl status httpd.service 
 +● httpd.service - The Apache HTTP Server 
 +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) 
 +   Active: active (running) since Mon 2021-06-07 18:30:59 EDT; 5s ago 
 +     Docs: man:httpd.service(8) 
 + Main PID: 59101 (httpd) 
 +   Status: "Startedlistening on: port 80" 
 +    Tasks: 213 (limit: 23719) 
 +   Memory: 39.4M 
 +   CGroup/system.slice/httpd.service 
 +           ├─59101 /usr/sbin/httpd -DFOREGROUND 
 +           ├─59102 /usr/sbin/httpd -DFOREGROUND 
 +           ├─59103 /usr/sbin/httpd -DFOREGROUND 
 +           ├─59104 /usr/sbin/httpd -DFOREGROUND 
 +           └─59105 /usr/sbin/httpd -DFOREGROUND
  
-<code> +Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: Starting The Apache HTTP Server... 
-[root@centos8 ~]# dumpe2fs /dev/sdb11 | grep UUID +Jun 07 18:30:59 centos8.ittraining.loc systemd[1]: Started The Apache HTTP Server. 
-dumpe2fs 1.45.6 (20-Mar-2020) +Jun 07 18:31:00 centos8.ittraining.loc httpd[59101]: Server configured, listening onport 80
-Filesystem UUID         72a6ad08-7023-4561-adcb-d434e00afed1 +
- +
-[root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID +
-dumpe2fs 1.45.6 (20-Mar-2020) +
-Filesystem UUID         b73322d4-f2e4-43bc-96ae-422d4584f3de+
 </code> </code>
  
-====XFS==== +=====Arrêt du Système=====
- +
-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. +
- +
-<WRAP center round important 60%> +
-**Important** : Le système de fichiers XFS permet l'augmentation de sa taille à chaud. Par 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** :+Sous RHEL / CentOS 8 les commandes **halt**, **poweroff**, **reboot** et **shutdown** sont des liens symboliques vers **/bin/systemctl** :
  
 <code> <code>
-[root@centos8 ~]# umount /dev/sdb12+[root@centos8 ~]# ls -l /usr/sbin/shutdown /usr/sbin/halt /usr/sbin/poweroff /usr/sbin/reboot 
 +lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/halt -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/poweroff -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/reboot -> ../bin/systemctl 
 +lrwxrwxrwx. 1 root root 16 Apr  7 16:55 /usr/sbin/shutdown -> ../bin/systemctl
 </code> </code>
  
-Créez un système de fichiers XFS sur la partition **/dev/sdb12** :+La manière recommendée d'utiliser ces commandes est donc :
  
-<code> +  * systemctl halt 
-[root@centos8 ~]# mkfs.xfs -f /dev/sdb12 +  * systemctl poweroff 
-meta-data=/dev/sdb12             isize=512    agcount=4, agsize=12800 blks +  * systemctl reboot 
-                               sectsz=512   attr=2, projid32bit=1 +  * systemctl shutdown
-         =                       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%> +Il est cependant toujours possibles d'utiliser les commandes **halt****poweroff**, **reboot** et **shutdown**.
-**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 :+====La Commande shutdown====
  
-<code> +Lors de l'arrêt de la machineLinux procèdeentre autreaux tâches suivantes :
-[root@centos8 ~]# mkfs.xfs --help +
-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 :+  * Il previent les utilisateurs,  
 +  * Il arrête tous les services, 
 +  * Il inscrit toutes les données sur disque, 
 +  * Il démonte les systèmes de fichiers.
  
-<code> +La commande utilisée pour arrêter le système est la commande **shutdown** :
-[root@centos8 ~]# xfs_info /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>+
  
-Les options de cette commande sont :+  shutdown [-t sec] [-HPrhkc] heure [message]
  
-<code> +===Options de la commande===
-[root@centos8 ~]# xfs_info --help +
-/usr/sbin/xfs_info: illegal option -- - +
-Usage: xfs_info [-V] [-t mtab] [mountpoint|device|file] +
-</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> +
-[root@centos8 ~]# xfs_admin -L my_xfs /dev/sdb12 +
-xfs_admin: /dev/sdb12 contains a mounted filesystem +
- +
-fatal error -- couldn't initialize XFS library +
- +
-[root@centos8 ~]# umount /dev/sdb12 +
- +
-[root@centos8 ~]# xfs_admin -L my_xfs /dev/sdb12 +
-writing all SBs +
-new label "my_xfs" +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** - Notez que la partition XFS doit être démonté pour pouvoir utiliser la commande **xfs_admin**. +
-</WRAP> +
- +
-Pour voir l'étiquette, utilisez la commande suivante : +
- +
-<code> +
-[root@centos8 ~]# xfs_admin -l /dev/sdb12 +
-label "my_xfs" +
-</code> +
- +
-<WRAP center round important 60%> +
-**Important** - Notez que l'étiquette doit être de 12 caractères maximum. +
-</WRAP>+
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# xfs_admin --help +[root@centos8 ~]# shutdown --help 
-/usr/sbin/xfs_admin: illegal option -- - +shutdown [OPTIONS...] [TIME] [WALL...]
-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** :+Shut down the system.
  
-<code> +     --help      Show this help 
-[root@centos8 ~]# xfs_admin -/dev/sdb12 +  -H --halt      Halt the machine 
-UUID = 15db1b62-0866-4aa4-9ac1-3ac325a4e20f+  -P --poweroff  Power-off the machine 
 +  -r --reboot    Reboot the machine 
 +  -h             Equivalent to --poweroff, overridden by --halt 
 +  -k             Don't halt/power-off/reboot, just send warnings 
 +     --no-wall   Don't send wall message before halt/power-off/reboot 
 +  -c             Cancel a pending shutdown
 </code> </code>
  
-<WRAP center round important 60%> +L'option **heure** peut prendre plusieurs valeurs :
-**Important** - La commande **xfs_metadump** est utilisée pour sauvegarder les méta-données du système de fichiers, tandis que la commande **xfs_mdrestore** est utilisée pour restaurer les les méta-données du système de fichiers. +
-</WRAP>+
  
-=====Autres Systèmes de Fichiers=====+^ Valeur ^ Description ^ 
 +| hh:mm | L'heure à laquelle l'opération aura lieu | 
 +| +m | Nombre de minutes avant que l'opération aura lieu. Si aucune valeur n'est spécifiée, la valeur par défaut est +1 | 
 +| now | L'opération est immédiate. now est un alias de +0 |
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-**Important** - Veuillez noter que le support des systèmes de fichiers **ReiserFS****JFS** et **Btrfs** est **absent** du noyau des distributions de Red Hat.+**Important** : Si l'opération est programmée pour dans moins de 5 minutesles connexions supplémentaires sont interdites, y comprises les tentatives de connexion de root
 </WRAP> </WRAP>
  
-====ReiserFS==== +L'option **-t** est utilisée pour accorder un temps de grâce :
- +
-%%ReiserFS%% permet : +
- +
-  * 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@centos8 ~]# date && shutdown -t 60 -k 
-[root@centos8 tmp]# mkisofs --T -o tmp.iso . +Mon Jun  7 18:58:26 EDT 2021 
-I: -input-charset not specifiedusing utf-8 (detected in locale settings) +Shutdown scheduled for Mon 2021-06-07 18:59:26 EDTuse 'shutdown -c' to cancel.
-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> </code>
  
-Le fichier ISO peut être monter en utilisant un périphérique de type **loop** :+==== La Commande reboot====
  
-<code> +Cette commande redémarre le système.
-[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====+===Options de la commande===
  
 Les options de cette commande sont : Les options de cette commande sont :
  
 <code> <code>
-[root@centos8 ~]# mkisofs --help +[root@centos8 ~]# reboot --help 
-Usage: genisoimage [options] file... +reboot [OPTIONS...] [ARG]
-Options: +
-  -nobak                      Do not include backup files +
-  -no-bak                     Do not include backup files +
-  -abstract FILE              Set Abstract filename +
-  -A ID, -appid ID            Set Application ID +
-  -biblio FILE                Set Bibliographic filename +
-  -cache-inodes               Cache inodes (needed to detect hard links) +
-  -no-cache-inodes            Do not cache inodes (if filesystem has no unique unides) +
-  -check-oldnames             Check all imported ISO9660 names from old session +
-  -check-session FILE         Check all ISO9660 names from previous session +
-  -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't 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. +Reboot the system.
-</code>+
  
-=====Systèmes de Fichiers Chiffrés sous RHEL/CentOS 8===== +     --help      Show this help 
- +     --halt      Halt the machine 
-====LAB #21 Créer un Système de Fichiers Chiffré avec LUKS sous RHEL/CentOS 8===== +  -p --poweroff  Switch off the machine 
- +     --reboot    Reboot the machine 
-===Présentation=== +  -f --force     Force immediate halt/power-off/reboot 
- +  ---wtmp-only Don't halt/power-off/reboot, just write wtmp record 
-**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 passe, afin que plusieurs utilisateurs soient en mesure de déchiffrer le même volume sans partager leur mot de passe. +  -d --no-wtmp   Don't write wtmp record 
- +     --no-wall   Don't send wall message before halt/power-off/reboot
-===Mise en Place=== +
- +
-Remplissez la partition /dev/sdb12 avec des données aléatoires : +
- +
-<code> +
-[root@centos8 ~]# shred ---iterations=1 /dev/sdb12 +
-shred: /dev/sdb12: pass 1/1 (random)...+
 </code> </code>
  
-<WRAP center round important 60%> +==== La Commande halt====
-**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. +
-</WRAP>+
  
-Initialisez la partition avec LUKS :+Cette commande arrête le système.
  
-<code> +===Options de la commande===
-[root@centos8 ~]# cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb12+
  
-WARNING! +Les options de cette commande sont :
-======== +
-This will overwrite data on /dev/sdb12 irrevocably. +
- +
-Are you sure? (Type 'yes' in capital letters): YES +
-Enter passphrase for /dev/sdb12: fenestros123456789 +
-Verify passphrase: fenestros123456789 +
-Key slot 0 created. +
-Command successful. +
-</code> +
- +
-<WRAP center round important 60%> +
-**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** :+
  
 <code> <code>
-[root@centos8 ~]# cryptsetup luksOpen /dev/sdb12 sdb12 +[root@centos8 ~]# halt --help 
-Enter passphrase for /dev/sdb12: fenestros123456789 +halt [OPTIONS...]
-</code>+
  
-Vérifiez que le système voit la partition :+Halt the system.
  
-<code> +     --help      Show this help 
-[root@centos8 ~]# ls -/dev/mapper | grep sdb12 +     --halt      Halt the machine 
-lrwxrwxrwx. 1 root root       7 Jun  2 10:03 sdb12 -> ../dm-2+  -p --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/reboot, just write wtmp record 
 +  -d --no-wtmp   Don't write wtmp record 
 +     --no-wall   Don't send wall message before halt/power-off/reboot
 </code> </code>
  
-Créez maintenant un système de fichiers sur **/dev/mapper/sdb12** :+==== La Commande poweroff====
  
-<code> +Cette commande arrête le système et coupe l'alimentation électrique
-[root@centos8 ~]# mkfs.xfs /dev/mapper/sdb12 +
-meta-data=/dev/mapper/sdb12      isize=512    agcount=4, agsize=11776 blks +
-                               sectsz=512   attr=2, projid32bit=1 +
-                               crc=1        finobt=1, sparse=1, rmapbt=0 +
-                               reflink=1 +
-data                           bsize=4096   blocks=47104, 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>+
  
-Montez la partition LUKS :+===Options de la commande===
  
-<code> +Les options de cette commande sont :
-[root@centos8 ~]# mount /dev/mapper/sdb12 /mnt/sdb12 +
-</code> +
- +
-Vérifiez la présence du montage :+
  
 <code> <code>
-[root@centos8 ~]# df -h | grep sdb12 +[root@centos8 ~]# poweroff --help 
-/dev/mapper/sdb12  179M   11M  168M   6% /mnt/sdb12 +poweroff [OPTIONS...]
-</code>+
  
-Editez le fichier **/etc/crypttab/** :+Power off the system.
  
-<code> +     --help      Show this help 
-[root@centos8 ~]# vi /etc/crypttab +     --halt      Halt the machine 
-[root@centos8 ~]# cat /etc/crypttab +  ---poweroff  Switch off the machine 
-sdb12 /dev/sdb12 none +     --reboot    Reboot the machine 
-</code> +  ---force     Force immediate halt/power-off/reboot 
- +  ---wtmp-only Don't halt/power-off/rebootjust write wtmp record 
-Modifiez le fichier **/etc/fstab** : +  -d --no-wtmp   Don'write wtmp record 
- +     --no-wall   Don't send wall message before halt/power-off/reboot
-<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 +
-/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 claire. Elle 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 -+
-Filename Type Size Used Priority +
-/dev/dm-1                               partition       3358716 0       -+
-</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. +
- +
-Options: +
- -a--all                enable all swaps from /etc/fstab +
- -d--discard[=<policy>] enable swap discards, if supported by device +
- -e, --ifexists           silently skip devices that do not exist +
- -f, --fixpgsz            reinitialize the swap space if necessary +
- -o, --options <list>     comma-separated list of swap options +
- -p, --priority <prio>    specify the priority of the swap device +
- -s, --summary            display summary about used swap devices (DEPRECATED) +
-     --show[=<columns>  display summary in definable table +
-     --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 +
- -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> +
- +
-<WRAP center round important 60%> +
-**Important** : L'option **-p** de la commande **swapon** permet de régler la priorité. +
-</WRAP> +
- +
-====La Commande swapoff==== +
- +
-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 : +
- +
-<code> +
-[root@centos8 ~]# swapoff /dev/dm-1 +
-[root@centos8 ~]# swapon -s +
-[root@centos8 ~]#  +
-</code> +
- +
-===Options de la Commande=== +
- +
-<code> +
-[root@centos8 ~]# swapoff --help +
- +
-Usage: +
- swapoff [options] [<spec>+
- +
-Disable devices and files for paging and swapping. +
- +
-Options: +
- -a, --all              disable all swaps from /proc/swaps +
- -v, --verbose          verbose mode +
- +
- -h, --help             display this help +
- -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