Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
elearning:workbooks:redhat:rh134:l105 [2024/09/26 13:25] – created admin | elearning:workbooks:redhat:rh134:l105 [2024/10/24 09:58] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======LCF504 | + | ======RH13406 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF504 | + | * **RH13406 |
* 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 | + | * 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' |
- | * Physical Volume (PV) | + | * GRUB 2 |
- | * Volume Group (VG) et Physical Extent (PE) | + | * Le fichier / |
- | * Logical Volumes (LV) | + | * Le fichier / |
- | * LAB #4 - Étendre un Volume Logique à Chaud | + | * Les fichiers du répertoire /etc/grub.d |
- | * LAB #5 - Snapshots | + | * Configurer l' |
- | * 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 | + | * Examiner l' |
- | * LAB #14 - Modifier la Fréquence | + | * Le script init |
- | * Ext4 | + | * Consulter |
- | * LAB #15 - Créer un Système de Fichiers Ext4 | + | * Processus |
- | * LAB #16 - Ajouter une Étiquette au Système de Fichiers Ext4 | + | * Processus Init |
- | * LAB #17 - Convertir un Système | + | * Systemd |
- | * XFS | + | * LAB #1 - La Commande systemctl |
- | * LAB #18 - Créer un Système | + | * LAB #2 - Fichiers |
- | * LAB #19 - Ajouter une Étiquette au Système de Fichiers | + | * 2.1 - Fichiers |
- | * Autres Systèmes | + | * 2.2 - Surchargement des Fichiers de Configuration par Défaut |
- | * ReiserFS | + | * LAB #3 - La Commande |
- | * JFS | + | * LAB #4 - Les Cibles Systemd |
- | * Btrfs | + | * 4.1 - Contrôler les dépendances d'une Cible |
- | | + | * 4.2 - La Cible par Défaut |
- | | + | * Arrêt Système |
- | * La Commande | + | * La Commande shutdown |
- | * Systèmes de Fichiers Chiffrés | + | * La Commande |
- | * LAB #21 - Créer un Système de Fichiers Chiffré avec LUKS | + | * La Commande |
- | * Présentation | + | * La Commande poweroff |
- | * Mise en Place | + | |
- | * Ajouter une deuxième Passphrase | + | |
- | * Supprimer une Passphrase | + | |
- | * Raid Logiciel | + | |
- | * LAB #22 - Mise en Place du RAID 5 Logiciel | + | |
- | * 22.1 - Préparer le disque | + | |
- | * 22.2 - Créer une Unité RAID | + | |
- | * 22.3 - Remplacer une Unité Défaillante | + | |
- | * Le Swap | + | |
- | * Taille | + | |
- | * Partitions de swap | + | |
- | * La Commande | + | |
- | * La Commande | + | |
- | * LAB #23 - Créer un Fichier de Swap | + | |
- | =====Périphériques de stockage===== | + | =====Présentation===== |
- | Les unités | + | Le processus de démarrage |
- | * 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 |
- | | + | * Le noyau se charge |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | * 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' | + | |
- | * Périphériques **loop** | + | |
- | * Il existe 16 unités loop qui sont utilisés pour accèder | + | |
- | * 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 < | ||
+ | </ | ||
- | Un PC comportent en règle générale 2 **contrôleurs** de disque, chacun capable de gérer 2 disques, | + | Cette description simpliste résume cependant |
- | * 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-64, le premier programme exécuté a été traditionnellement le BIOS. Le BIOS a pour fonction |
- | * Maximum de **4**. En effet, la Table des Partitions est grande | + | |
- | * **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 | + | * Tester les composants et les circuits, |
+ | * Faire appel au BIOS de la carte graphique pour initialiser le système d' | ||
+ | * Détecter les périphériques de stockage, | ||
+ | * Lancer le **Charger de Démarrage** du système d' | ||
- | * **hda1**, **hda2**, **hda3** et **hda4** pour le premier disque **IDE** sur le premier contrôleur | + | ===Chargeur |
- | * **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. |
- | Une partition étendue prend la place d' | + | * 446 octets pour le Charger de Démarrage, |
+ | * 64 octets pour la table de partitions, soit 16 octets par partition | ||
+ | | ||
- | 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 | + | Depuis 2011, le BIOS est en train d' |
- | {{free: | + | 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' |
- | Le nombre | + | Pour que EFI fonctionne, le micrologiciel (**firmware**) d'EFI doit avoir connaissance |
- | * **IDE**, | + | <WRAP center round tip 60%> |
- | * Jusqu' | + | **A retenir** : Sous Linux c'est l' |
- | * **SCSI**, | + | |
- | * Jusqu' | + | |
- | * **Disques utilisant l'API libata**, | + | |
- | * Jusqu' | + | |
- | + | ||
- | <WRAP center round important | + | |
- | **Important** : Ces limites peuvent être dépassées en utilisant la gestion | + | |
</ | </ | ||
- | |||
- | =====Partitionnement===== | ||
- | |||
- | ====LAB #1 - Partitionnement de votre Disque sous RHEL/CentOS 8 avec fdisk==== | ||
- | |||
- | Pour procéder au partitionnement de votre disque ou de vos disques, RHEL/CentOS 8 possède l' | ||
- | |||
- | Lancez fdisk en fournissant en argument le fichier de référence de votre premier disque dur, par exemple : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# fdisk /dev/sdb | ||
- | |||
- | Welcome to fdisk (util-linux 2.32.1). | ||
- | Changes will remain in memory only, until you decide to write them. | ||
- | Be careful before using the write command. | ||
- | |||
- | Device does not contain a recognized partition table. | ||
- | Created a new DOS disklabel with disk identifier 0xb0dacb39. | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Tapez ensuite la lettre **m** puis < | ||
- | |||
- | < | ||
- | Command (m for help): m | ||
- | |||
- | Help: | ||
- | |||
- | DOS (MBR) | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Generic | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Misc | ||
- | | ||
- | | ||
- | | ||
- | |||
- | Script | ||
- | | ||
- | | ||
- | |||
- | Save & Exit | ||
- | | ||
- | | ||
- | |||
- | Create a new label | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | 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' | ||
- | |||
- | < | ||
- | Command (m for help): n | ||
- | Partition type | ||
- | | ||
- | | ||
- | Select (default p): | ||
- | |||
- | Using default response p. | ||
- | Partition number (1-4, default 1): | ||
- | First sector (2048-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 1 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | Partition type | ||
- | | ||
- | | ||
- | Select (default p): | ||
- | |||
- | Using default response p. | ||
- | Partition number (2-4, default 2): | ||
- | First sector (206848-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 2 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | Partition type | ||
- | | ||
- | | ||
- | Select (default p): | ||
- | |||
- | Using default response p. | ||
- | Partition number (3,4, default 3): | ||
- | First sector (411648-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 3 of type ' | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Créez ensuite la partition étendue : | ||
- | |||
- | < | ||
- | Command (m for help): n | ||
- | Partition type | ||
- | | ||
- | | ||
- | Select (default e): e | ||
- | |||
- | Selected partition 4 | ||
- | First sector (616448-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 4 of type ' | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Créez maintenant les autres partitions l'une après l' | ||
- | |||
- | < | ||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 5 | ||
- | First sector (618496-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 5 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 6 | ||
- | First sector (1644544-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 6 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 7 | ||
- | First sector (2056192-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 7 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 8 | ||
- | First sector (2672640-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 8 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 9 | ||
- | First sector (3698688-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 9 of type ' | ||
- | |||
- | | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 10 | ||
- | First sector (4519936-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 10 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 11 | ||
- | First sector (5545984-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 11 of type ' | ||
- | |||
- | Command (m for help): n | ||
- | All primary partitions are in use. | ||
- | Adding logical partition 12 | ||
- | First sector (6572032-8388607, | ||
- | Last sector, +sectors or +size{K, | ||
- | |||
- | Created a new partition 12 of type ' | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Tapez ensuite la lettre **p** puis < | ||
- | |||
- | < | ||
- | Command (m for help): p | ||
- | Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | Disklabel type: dos | ||
- | Disk identifier: 0xb0dacb39 | ||
- | |||
- | Device | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Ecrivez la table des partitions sur disque et exécutez la commande **partprobe** : | ||
- | |||
- | < | ||
- | Command (m for help): w | ||
- | The partition table has been altered. | ||
- | Calling ioctl() to re-read partition table. | ||
- | Syncing disks. | ||
- | |||
- | [root@centos8 ~]# partprobe | ||
- | [root@centos8 ~]# | ||
- | </ | ||
- | |||
- | Lancez fdisk puis tapez ensuite la lettre **p** puis < | ||
- | |||
- | < | ||
- | [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/ | ||
- | I/O size (minimum/ | ||
- | Disklabel type: dos | ||
- | Disk identifier: 0xb0dacb39 | ||
- | |||
- | Device | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Pour supprimer une partition, utilisez la commande **d** puis < | ||
- | |||
- | < | ||
- | Command (m for help): d | ||
- | Partition number (1-12, default 12): 12 | ||
- | |||
- | Partition 12 has been deleted. | ||
- | |||
- | Command (m for help): p | ||
- | Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | Disklabel type: dos | ||
- | Disk identifier: 0xb0dacb39 | ||
- | |||
- | Device | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | A ce stade, la partition n'a **pas** été réellement supprimée. En effet, vous avez la possibilité de sortir de fdisk en utilisant la commande **q**. | ||
- | |||
- | Tapez donc q pour sortir de fdisk puis relancez fdisk. Vous obtiendrez un résultat similaire à celui-ci : | ||
- | |||
- | < | ||
- | Command (m for help): q | ||
- | |||
- | [root@centos8 ~]# fdisk /dev/sdb | ||
- | |||
- | Welcome to fdisk (util-linux 2.32.1). | ||
- | Changes will remain in memory only, until you decide to write them. | ||
- | Be careful before using the write command. | ||
- | |||
- | |||
- | Command (m for help): p | ||
- | Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | Disklabel type: dos | ||
- | Disk identifier: 0xb0dacb39 | ||
- | |||
- | Device | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | ====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 : | ||
- | |||
- | < | ||
- | Command (m for help): t | ||
- | Partition number (1-12, default 12): 5 | ||
- | Hex code (type L to list all codes): fd | ||
- | |||
- | Changed type of partition ' | ||
- | |||
- | Command (m for help): t | ||
- | Partition number (1-12, default 12): 6 | ||
- | Hex code (type L to list all codes): 8e | ||
- | |||
- | Changed type of partition ' | ||
- | |||
- | Command (m for help): t | ||
- | Partition number (1-12, default 12): 7 | ||
- | Hex code (type L to list all codes): 8e | ||
- | |||
- | Changed type of partition ' | ||
- | |||
- | 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 ' | ||
- | |||
- | 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 ' | ||
- | |||
- | 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 ' | ||
- | |||
- | 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 ' | ||
- | </ | ||
- | |||
- | A l'issu des modifications, | ||
- | |||
- | < | ||
- | Command (m for help): p | ||
- | Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors | ||
- | Units: sectors of 1 * 512 = 512 bytes | ||
- | Sector size (logical/ | ||
- | I/O size (minimum/ | ||
- | Disklabel type: dos | ||
- | Disk identifier: 0xb0dacb39 | ||
- | |||
- | Device | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | |||
- | Command (m for help): | ||
- | </ | ||
- | |||
- | Pour écrire la nouvelle table des partitions sur disque, vous devez utilisez la commande **w** puis la commande **partprobe** : | ||
- | |||
- | < | ||
- | Command (m for help): w | ||
- | The partition table has been altered! | ||
- | |||
- | Calling ioctl() to re-read partition table. | ||
- | |||
- | WARNING: Re-reading the partition table failed with error 16: Device or resource busy. | ||
- | The kernel still uses the old table. The new table will be used at | ||
- | the next reboot or after you run partprobe(8) or kpartx(8) | ||
- | Syncing disks. | ||
- | [root@centos8 ~]# partprobe | ||
- | </ | ||
- | |||
- | ====Options de la Commande fdisk==== | ||
- | |||
- | Les options de cette commande sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# fdisk --help | ||
- | |||
- | Usage: | ||
- | fdisk [options] < | ||
- | fdisk [options] -l [< | ||
- | |||
- | Display or manipulate a disk partition table. | ||
- | |||
- | Options: | ||
- | -b, --sector-size < | ||
- | -B, --protect-boot | ||
- | -c, --compatibility[=< | ||
- | -L, --color[=< | ||
- | | ||
- | -l, --list | ||
- | -o, --output < | ||
- | -t, --type < | ||
- | -u, --units[=< | ||
- | -s, --getsz | ||
- | | ||
- | -w, --wipe < | ||
- | -W, --wipe-partitions < | ||
- | |||
- | -C, --cylinders < | ||
- | -H, --heads < | ||
- | -S, --sectors < | ||
- | |||
- | -h, --help | ||
- | -V, --version | ||
- | |||
- | Available output columns: | ||
- | gpt: Device Start End Sectors Size Type Type-UUID Attrs Name UUID | ||
- | dos: Device Start End Sectors Cylinders Size Type Id Attrs Boot End-C/H/S Start-C/H/S | ||
- | bsd: Slice Start End Sectors Cylinders Size Type Bsize Cpg Fsize | ||
- | sgi: Device Start End Sectors Cylinders Size Type Id Attrs | ||
- | sun: Device Start End Sectors Cylinders Size Type Id Flags | ||
- | |||
- | For more details see fdisk(8). | ||
- | </ | ||
- | |||
- | =====Logical Volume Manager (LVM)===== | ||
- | |||
- | ====LAB #3 - Volumes Logiques Linéaires==== | ||
- | |||
- | Afin de mettre en place le LVM, vous avez besoin du paquet **lvm2** et du paquet **device-mapper**. | ||
- | |||
- | Nous allons travailler sous RHEL/CentOS 8 avec les partitions suivantes : | ||
- | |||
- | < | ||
- | / | ||
- | / | ||
- | / | ||
- | </ | ||
- | |||
- | Pour initialiser le LVM saississez la commande suivante : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# vgscan | ||
- | Found volume group " | ||
- | </ | ||
- | |||
- | Les options de la commande **vgscan** sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# vgscan --longhelp | ||
- | vgscan - Search for all volume groups | ||
- | |||
- | vgscan | ||
- | [ --ignorelockingfailure ] | ||
- | [ --mknodes ] | ||
- | [ --notifydbus ] | ||
- | [ --reportformat basic|json ] | ||
- | [ COMMON_OPTIONS ] | ||
- | |||
- | Common options for lvm: | ||
- | [ -d|--debug ] | ||
- | [ -h|--help ] | ||
- | [ -q|--quiet ] | ||
- | [ -v|--verbose ] | ||
- | [ -y|--yes ] | ||
- | [ -t|--test ] | ||
- | [ --commandprofile String ] | ||
- | [ --config String ] | ||
- | [ --driverloaded y|n ] | ||
- | [ --nolocking ] | ||
- | [ --lockopt String ] | ||
- | [ --longhelp ] | ||
- | [ --profile String ] | ||
- | [ --version ] | ||
- | |||
- | Common variables for lvm: | ||
- | Variables in option or position args are capitalized, | ||
- | e.g. PV, VG, LV, Size, Number, String, Tag. | ||
- | |||
- | PV | ||
- | Physical Volume name, a device path under /dev. | ||
- | For commands managing physical extents, a PV positional arg | ||
- | generally accepts a suffix indicating a range (or multiple ranges) | ||
- | of PEs. When the first PE is omitted, it defaults to the start of | ||
- | the device, and when the last PE is omitted it defaults to the end. | ||
- | PV[: | ||
- | PV[: | ||
- | |||
- | 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 _< | ||
- | required. (raid represents raid< | ||
- | 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, | ||
- | 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.) | ||
- | </ | ||
- | |||
- | ===Physical Volume (PV)=== | ||
- | |||
- | Pour créer le **PV** il convient d' | ||
- | |||
- | < | ||
- | [root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
- | Physical volume "/ | ||
- | Physical volume "/ | ||
- | Physical volume "/ | ||
- | </ | ||
- | |||
- | Les options de la commande **pvcreate** sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# pvcreate --longhelp | ||
- | pvcreate - Initialize physical volume(s) for use by LVM | ||
- | |||
- | pvcreate PV ... | ||
- | [ -f|--force ] | ||
- | [ -M|--metadatatype lvm2 ] | ||
- | [ -u|--uuid String ] | ||
- | [ -Z|--zero y|n ] | ||
- | [ --dataalignment Size[k|UNIT] ] | ||
- | [ --dataalignmentoffset Size[k|UNIT] ] | ||
- | [ --bootloaderareasize Size[m|UNIT] ] | ||
- | [ --labelsector Number ] | ||
- | [ --pvmetadatacopies 0|1|2 ] | ||
- | [ --metadatasize Size[m|UNIT] ] | ||
- | [ --metadataignore y|n ] | ||
- | [ --norestorefile ] | ||
- | [ --setphysicalvolumesize Size[m|UNIT] ] | ||
- | [ --reportformat basic|json ] | ||
- | [ --restorefile String ] | ||
- | [ COMMON_OPTIONS ] | ||
- | |||
- | Common options for lvm: | ||
- | [ -d|--debug ] | ||
- | [ -h|--help ] | ||
- | [ -q|--quiet ] | ||
- | [ -v|--verbose ] | ||
- | [ -y|--yes ] | ||
- | [ -t|--test ] | ||
- | [ --commandprofile String ] | ||
- | [ --config String ] | ||
- | [ --driverloaded y|n ] | ||
- | [ --nolocking ] | ||
- | [ --lockopt String ] | ||
- | [ --longhelp ] | ||
- | [ --profile String ] | ||
- | [ --version ] | ||
- | |||
- | Common variables for lvm: | ||
- | Variables in option or position args are capitalized, | ||
- | e.g. PV, VG, LV, Size, Number, String, Tag. | ||
- | |||
- | PV | ||
- | Physical Volume name, a device path under /dev. | ||
- | For commands managing physical extents, a PV positional arg | ||
- | generally accepts a suffix indicating a range (or multiple ranges) | ||
- | of PEs. When the first PE is omitted, it defaults to the start of | ||
- | the device, and when the last PE is omitted it defaults to the end. | ||
- | PV[: | ||
- | PV[: | ||
- | |||
- | 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 _< | ||
- | required. (raid represents raid< | ||
- | 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, | ||
- | 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.) | ||
- | </ | ||
- | |||
- | Pour visualiser le PV il convient d' | ||
- | |||
- | < | ||
- | [root@centos8 ~]# pvdisplay /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
- | "/ | ||
- | --- NEW Physical volume --- | ||
- | PV Name / | ||
- | VG Name | ||
- | PV Size | ||
- | Allocatable | ||
- | PE Size | ||
- | Total PE 0 | ||
- | Free PE 0 | ||
- | Allocated PE 0 | ||
- | PV UUID | ||
- | |||
- | "/ | ||
- | --- NEW Physical volume --- | ||
- | PV Name / | ||
- | VG Name | ||
- | PV Size | ||
- | Allocatable | ||
- | PE Size | ||
- | Total PE 0 | ||
- | Free PE 0 | ||
- | Allocated PE 0 | ||
- | PV UUID | ||
- | |||
- | "/ | ||
- | --- NEW Physical volume --- | ||
- | PV Name / | ||
- | VG Name | ||
- | PV Size | ||
- | Allocatable | ||
- | PE Size | ||
- | Total PE 0 | ||
- | Free PE 0 | ||
- | Allocated PE 0 | ||
- | PV UUID | ||
- | </ | ||
- | |||
- | Les options de la commande **pvdisplay** sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# pvdisplay --longhelp | ||
- | pvdisplay - Display various attributes of physical volume(s) | ||
- | |||
- | pvdisplay | ||
- | [ -a|--all ] | ||
- | [ -c|--colon ] | ||
- | [ -C|--columns ] | ||
- | [ -m|--maps ] | ||
- | [ -o|--options String ] | ||
- | [ -S|--select String ] | ||
- | [ -s|--short ] | ||
- | [ -O|--sort String ] | ||
- | [ --aligned ] | ||
- | [ --binary ] | ||
- | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
- | [ --foreign ] | ||
- | [ --ignorelockingfailure ] | ||
- | [ --logonly ] | ||
- | [ --noheadings ] | ||
- | [ --nosuffix ] | ||
- | [ --readonly ] | ||
- | [ --reportformat basic|json ] | ||
- | [ --separator String ] | ||
- | [ --shared ] | ||
- | [ --unbuffered ] | ||
- | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
- | [ COMMON_OPTIONS ] | ||
- | [ PV|Tag ... ] | ||
- | |||
- | Common options for lvm: | ||
- | [ -d|--debug ] | ||
- | [ -h|--help ] | ||
- | [ -q|--quiet ] | ||
- | [ -v|--verbose ] | ||
- | [ -y|--yes ] | ||
- | [ -t|--test ] | ||
- | [ --commandprofile String ] | ||
- | [ --config String ] | ||
- | [ --driverloaded y|n ] | ||
- | [ --nolocking ] | ||
- | [ --lockopt String ] | ||
- | [ --longhelp ] | ||
- | [ --profile String ] | ||
- | [ --version ] | ||
- | |||
- | Common variables for lvm: | ||
- | Variables in option or position args are capitalized, | ||
- | e.g. PV, VG, LV, Size, Number, String, Tag. | ||
- | |||
- | PV | ||
- | Physical Volume name, a device path under /dev. | ||
- | For commands managing physical extents, a PV positional arg | ||
- | generally accepts a suffix indicating a range (or multiple ranges) | ||
- | of PEs. When the first PE is omitted, it defaults to the start of | ||
- | the device, and when the last PE is omitted it defaults to the end. | ||
- | PV[: | ||
- | PV[: | ||
- | |||
- | 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 _< | ||
- | required. (raid represents raid< | ||
- | 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, | ||
- | 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.) | ||
- | </ | ||
- | |||
- | ===Volume Group (VG) et Physical Extent (PE)=== | ||
- | |||
- | Pour créer un Volume Group dénommé **vg0**, il convient d' | ||
- | |||
- | < | ||
- | [root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
- | Volume group " | ||
- | </ | ||
- | |||
- | Les options de la commande **vgcreate** sont : | ||
- | |||
- | < | ||
- | [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. | ||
- | </ | ||
- | |||
- | Pour afficher les informations concernant **vg0**, il convient d' | ||
- | |||
- | < | ||
- | [root@centos8 ~]# vgdisplay vg0 | ||
- | --- Volume group --- | ||
- | VG Name vg0 | ||
- | System ID | ||
- | Format | ||
- | Metadata Areas 3 | ||
- | Metadata Sequence No 1 | ||
- | VG Access | ||
- | VG Status | ||
- | MAX LV 0 | ||
- | Cur LV 0 | ||
- | Open LV 0 | ||
- | Max PV 0 | ||
- | Cur PV 3 | ||
- | Act PV 3 | ||
- | VG Size | ||
- | PE Size 8.00 MiB | ||
- | Total PE 110 | ||
- | Alloc PE / Size 0 / 0 | ||
- | Free PE / Size 110 / 880.00 MiB | ||
- | VG UUID | ||
- | </ | ||
- | |||
- | Les options de la commande **vgdisplay** sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# vgdisplay --help | ||
- | vgdisplay - Display volume group information | ||
- | |||
- | vgdisplay | ||
- | [ -A|--activevolumegroups ] | ||
- | [ -c|--colon ] | ||
- | [ -C|--columns ] | ||
- | [ -o|--options String ] | ||
- | [ -S|--select String ] | ||
- | [ -s|--short ] | ||
- | [ -O|--sort String ] | ||
- | [ --aligned ] | ||
- | [ --binary ] | ||
- | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
- | [ --foreign ] | ||
- | [ --ignorelockingfailure ] | ||
- | [ --logonly ] | ||
- | [ --noheadings ] | ||
- | [ --nosuffix ] | ||
- | [ --readonly ] | ||
- | [ --reportformat basic|json ] | ||
- | [ --shared ] | ||
- | [ --separator String ] | ||
- | [ --unbuffered ] | ||
- | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
- | [ COMMON_OPTIONS ] | ||
- | [ VG|Tag ... ] | ||
- | |||
- | Common options for lvm: | ||
- | [ -d|--debug ] | ||
- | [ -h|--help ] | ||
- | [ -q|--quiet ] | ||
- | [ -v|--verbose ] | ||
- | [ -y|--yes ] | ||
- | [ -t|--test ] | ||
- | [ --commandprofile String ] | ||
- | [ --config String ] | ||
- | [ --driverloaded y|n ] | ||
- | [ --nolocking ] | ||
- | [ --lockopt String ] | ||
- | [ --longhelp ] | ||
- | [ --profile String ] | ||
- | [ --version ] | ||
- | |||
- | Use --longhelp to show all options and advanced commands. | ||
- | </ | ||
- | |||
- | ===Logical Volumes (LV)=== | ||
- | |||
- | Pour créer un **Logical Volume** dénommé **lv0** dans le **Volume Group** **vg0**, il convient d' | ||
- | |||
- | < | ||
- | [root@centos8 ~]# lvcreate -L 350 -n lv0 vg0 | ||
- | Rounding up size to full physical extent 352.00 MiB | ||
- | Logical volume " | ||
- | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** -Notez que la taille du LV est un multiple du PE. | + | **Important** |
</ | </ | ||
- | Les options de la commande **lvcreate** sont : | + | ====Autres Systèmes==== |
- | < | + | Les systèmes utilisant des processeurs autre qu'un x86 ou x86-64 utilisent un logiciel tel **[[http:// |
- | [root@centos8 ~]# lvcreate --help | + | |
- | lvcreate - Create a logical volume | + | |
- | Create a linear LV. | + | =====Gestionnaires de Démarrage===== |
- | lvcreate -L|--size Size[m|UNIT] VG | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ --type linear ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a striped LV (infers --type striped). | + | ====GRUB 2==== |
- | lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a raid1 or mirror LV (infers | + | GRUB 2 est une ré-écriture complète de GRUB Legacy. Il apporte des améliorations, |
- | lvcreate -m|--mirrors Number -L|--size Size[m|UNIT] VG | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ --mirrorlog core|disk ] | + | |
- | [ --minrecoveryrate Size[k|UNIT] ] | + | |
- | [ --maxrecoveryrate Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a raid LV (a specific raid level must be used, e.g. raid1). | + | Le lancement de GRUB 2 se fait en trois étapes : |
- | lvcreate --type raid -L|--size Size[m|UNIT] VG | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -m|--mirrors Number ] | + | |
- | [ -i|--stripes Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ --minrecoveryrate Size[k|UNIT] ] | + | |
- | [ --maxrecoveryrate Size[k|UNIT] ] | + | |
- | [ --raidintegrity y|n ] | + | |
- | [ --raidintegritymode String ] | + | |
- | [ --raidintegrityblocksize Number ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | | + | |
- | lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG | + | * Etape 1.5 : Le **core.img**, d'une taille approximative de 25 Ko et stocké dans les secteurs 1 à 62, est lance. Son travail est de charger des pilotes qui supportent de multiples systèmes de fichiers puis de lancer l' |
- | [ -l|--extents Number[PERCENT] ] | + | * Etape 2 : Contenu dans le répertoire **/ |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ --minrecoveryrate Size[k|UNIT] ] | + | |
- | [ --maxrecoveryrate Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a COW snapshot LV of an origin LV. | + | Dans le cas où le Charger de Démarrage **GRUB 2** n'est pas installé, il convient de saisir la commande suivante : |
- | lvcreate -s|--snapshot -L|--size Size[m|UNIT] LV | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -i|--stripes Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ --type snapshot ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | | + | |
- | lvcreate | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ -i|--stripes Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ --thinpool LV_new ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --discards passdown|nopassdown|ignore ] | + | |
- | [ --errorwhenfull y|n ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a cache pool. | + | où **périphérique** est le nom du périphérique ou l' |
- | lvcreate --type cache-pool -L|--size Size[m|UNIT] VG | + | |
- | [ -l|--extents Number[PERCENT] ] | + | |
- | [ -H|--cache ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --cachemode writethrough|writeback|passthrough ] | + | |
- | [ --cachepolicy String ] | + | |
- | [ --cachesettings String ] | + | |
- | [ --cachemetadataformat auto|1|2 ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Create a thin LV in a thin pool (infers --type thin). | + | **GRUB |
- | 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. | + | |
- | </ | + | |
- | + | ||
- | Créez maintenant un répertoire dans /mnt pour monter lv0 : | + | |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
- | </code> | + | # |
+ | # DO NOT EDIT THIS FILE | ||
+ | # | ||
+ | # It is automatically generated by grub2-mkconfig using templates | ||
+ | # from /etc/grub.d and settings from / | ||
+ | # | ||
- | Créez un système de fichiers en **ext3** sur /dev/vg0/lv0 : | + | ### BEGIN /etc/grub.d/00_header ### |
+ | set pager=1 | ||
- | < | + | if [ -f ${config_directory}/ |
- | [root@centos8 ~]# mke2fs | + | load_env |
- | mke2fs 1.45.6 (20-Mar-2020) | + | elif [ -s $prefix/ |
- | Creating filesystem with 360448 1k blocks and 90112 inodes | + | |
- | Filesystem UUID: 87b6d526-d379-4e0c-8984-94811f1cee33 | + | fi |
- | Superblock backups stored on blocks: | + | if [ " |
- | 8193, 24577, 40961, 57345, 73729, 204801, 221185 | + | set default=" |
+ | set next_entry= | ||
+ | | ||
+ | set boot_once=true | ||
+ | else | ||
+ | set default=" | ||
+ | fi | ||
- | Allocating group tables: done | + | if [ x" |
- | Writing inode tables: done | + | |
- | Creating journal (8192 blocks): done | + | else |
- | Writing superblocks and filesystem accounting information: | + | |
- | </ | + | fi |
- | Montez votre lv0 : | + | export menuentry_id_option |
- | < | + | if [ " |
- | [root@centos8 ~]# mount -t ext3 / | + | set saved_entry=" |
- | </ | + | save_env saved_entry |
+ | set prev_saved_entry= | ||
+ | save_env prev_saved_entry | ||
+ | set boot_once=true | ||
+ | fi | ||
- | Vous allez maintenant copier le contenu de votre répertoire /home vers /mnt/lvm. | + | function savedefault { |
+ | if [ -z " | ||
+ | saved_entry=" | ||
+ | save_env saved_entry | ||
+ | fi | ||
+ | } | ||
- | Saisissez donc la commande pour copier le contenu de /home : | + | function load_video { |
+ | if [ x$feature_all_video_module = xy ]; then | ||
+ | insmod all_video | ||
+ | else | ||
+ | insmod efi_gop | ||
+ | insmod efi_uga | ||
+ | insmod ieee1275_fb | ||
+ | insmod vbe | ||
+ | insmod vga | ||
+ | insmod video_bochs | ||
+ | insmod video_cirrus | ||
+ | fi | ||
+ | } | ||
- | < | + | terminal_output console |
- | [root@centos8 ~]# cp -a /home /mnt/lvm | + | 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 ### | ||
- | Constatez ensuite le contenu de /mnt/lvm : | + | ### BEGIN /etc/grub.d/ |
+ | set tuned_params="" | ||
+ | set tuned_initrd="" | ||
+ | ### END / | ||
- | < | + | ### BEGIN /etc/grub.d/ |
- | [root@centos8 ~]# ls -l /mnt/lvm | + | if [ -f ${prefix}/ |
- | total 14 | + | source ${prefix}/ |
- | drwxr-xr-x. 5 root root 1024 Apr 20 14:35 home | + | if [ -n " |
- | drwx------. 2 root root 12288 May 26 17:00 lost+found | + | set superusers=" |
- | </code> | + | export superusers |
+ | password_pbkdf2 | ||
+ | fi | ||
+ | fi | ||
+ | ### END /etc/ | ||
- | Une particularité du volume logique est la capacité de d'être aggrandi ou réduit sans pertes de données. Commencez par constater la taille totale du volume : | + | ### BEGIN /etc/grub.d/ |
+ | insmod increment | ||
+ | # Check if boot_counter exists and boot_success=0 to activate this behaviour. | ||
+ | if [ -n " | ||
+ | # if countdown has ended, choose to boot rollback deployment, | ||
+ | # i.e. default=1 on OSTree-based systems. | ||
+ | if [ " | ||
+ | set default=1 | ||
+ | set boot_counter=-1 | ||
+ | # otherwise decrement boot_counter | ||
+ | else | ||
+ | decrement boot_counter | ||
+ | fi | ||
+ | save_env boot_counter | ||
+ | fi | ||
+ | ### END / | ||
- | < | + | ### BEGIN / |
- | [root@centos8 ~]# df -h /mnt/lvm | + | insmod part_msdos |
- | Filesystem | + | insmod xfs |
- | / | + | set root=' |
- | </ | + | if [ x$feature_platform_search_hint = xy ]; then |
+ | search | ||
+ | else | ||
+ | | ||
+ | fi | ||
+ | insmod part_msdos | ||
+ | insmod xfs | ||
+ | set boot=' | ||
+ | if [ x$feature_platform_search_hint = xy ]; then | ||
+ | search | ||
+ | else | ||
+ | search --no-floppy --fs-uuid --set=boot 6f6c5bb9-30be-4734-bc23-03fed8541616 | ||
+ | fi | ||
- | Dans la cas de notre exemple, la taille est de **333 Mo** avec **17 Mo** occupé. | + | # This section was generated by a script. Do not modify the generated file - all changes |
+ | # will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files. | ||
+ | # | ||
+ | # The blscfg command parses the BootLoaderSpec files stored in / | ||
+ | # populates the boot menu. Please refer to the Boot Loader Specification documentation | ||
+ | # for the files format: https:// | ||
- | ====LAB #4 - Etendre un Volume Logique à Chaud==== | + | # The kernelopts variable should be defined in the grubenv file. But to ensure that menu |
+ | # entries populated from BootLoaderSpec files that use this variable work correctly even | ||
+ | # without a grubenv file, define a fallback kernelopts variable if this has not been set. | ||
+ | # | ||
+ | # The kernelopts variable in the grubenv file can be modified using the grubby tool or by | ||
+ | # executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX | ||
+ | # and GRUB_CMDLINE_LINUX_DEFAULT options from / | ||
+ | # the kernelopts variable in the grubenv file and the fallback kernelopts variable. | ||
+ | if [ -z " | ||
+ | set kernelopts="root=/ | ||
+ | fi | ||
- | Pour agrandir un volume logique, le paquet **lvm2** contient les commandes **lvextend** et **resize2fs** : | + | insmod blscfg |
+ | blscfg | ||
+ | ### END / | ||
- | < | + | ### BEGIN /etc/grub.d/10_reset_boot_success ### |
- | [root@centos8 ~]# lvextend -L +100M /dev/vg0/lv0 | + | # Hiding the menu is ok if last boot was ok or if this is a first boot attempt |
- | | + | if [ " |
- | | + | |
- | | + | else |
- | </code> | + | set menu_hide_ok=0 |
+ | fi | ||
+ | # Reset boot_indeterminate after a successful boot | ||
+ | if [ " | ||
+ | set boot_indeterminate=0 | ||
+ | # Avoid boot_indeterminate causing the menu to be hidden more than once | ||
+ | elif [ " | ||
+ | | ||
+ | fi | ||
+ | # Reset boot_success for current boot | ||
+ | set boot_success=0 | ||
+ | save_env boot_success boot_indeterminate | ||
+ | ### END /etc/grub.d/10_reset_boot_success ### | ||
- | <WRAP center round important | + | ### BEGIN / |
- | **Important** | + | if [ x$feature_timeout_style = xy ] ; then |
- | </WRAP> | + | if [ " |
+ | unset menu_show_once | ||
+ | save_env menu_show_once | ||
+ | set timeout_style=menu | ||
+ | set timeout=60 | ||
+ | elif [ " | ||
+ | set orig_timeout_style=${timeout_style} | ||
+ | set orig_timeout=${timeout} | ||
+ | if [ " | ||
+ | # timeout_style=menu + timeout=0 avoids the countdown code keypress check | ||
+ | set timeout_style=menu | ||
+ | set timeout=0 | ||
+ | else | ||
+ | set timeout_style=hidden | ||
+ | set timeout=1 | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | ### END /etc/grub.d/12_menu_auto_hide ### | ||
- | Les options de la commande **lvextend** sont : | + | ### BEGIN / |
+ | if [ x$feature_timeout_style = xy ]; then | ||
+ | if [ " | ||
+ | set timeout_style=menu | ||
+ | set timeout=" | ||
+ | unset menu_show_once_timeout | ||
+ | save_env menu_show_once_timeout | ||
+ | fi | ||
+ | fi | ||
+ | ### END / | ||
- | < | + | ### BEGIN / |
- | [root@centos8 ~]# lvextend --help | + | ### END / |
- | | + | |
- | Extend an LV by a specified size. | + | ### BEGIN /etc/grub.d/ |
- | | + | ### END /etc/grub.d/ |
- | [ -l|--extents [+]Number[PERCENT] ] | + | |
- | [ -r|--resizefs ] | + | |
- | [ -i|--stripes Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ --poolmetadatasize [+]Size[m|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Extend an LV by specified PV extents. | + | ### BEGIN /etc/grub.d/ |
- | | + | ### END /etc/grub.d/30_os-prober ### |
- | [ -r|--resizefs ] | + | |
- | [ -i|--stripes Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | Extend a pool metadata SubLV by a specified size. | + | ### BEGIN /etc/grub.d/30_uefi-firmware ### |
- | lvextend | + | if [ " |
- | [ -i|--stripes Number | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | } |
- | [ PV ... ] | + | fi |
+ | ### END /etc/grub.d/ | ||
- | Extend an LV according to a predefined policy. | + | ### BEGIN /etc/grub.d/35_fwupd ### |
- | | + | ### END /etc/grub.d/35_fwupd ### |
- | [ -r|--resizefs ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Common options for command: | + | ### BEGIN / |
- | [ -A|--autobackup y|n ] | + | # This file provides an easy way to add custom menu entries. |
- | [ -f|--force ] | + | # menu entries you want to add after this comment. |
- | [ -m|--mirrors Number ] | + | # the 'exec tail' line above. |
- | [ -n|--nofsck ] | + | ### END / |
- | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | + | |
- | [ --nosync ] | + | |
- | [ --noudevsync ] | + | |
- | [ --reportformat basic|json ] | + | |
- | [ --type linear|striped|snapshot|mirror|raid|thin|cache|vdo|thin-pool|cache-pool|vdo-pool ] | + | |
- | Common options for lvm: | + | ### BEGIN /etc/grub.d/41_custom ### |
- | [ -d|--debug ] | + | if [ -f ${config_directory}/ |
- | [ -h|--help | + | |
- | [ -q|--quiet ] | + | elif [ -z " |
- | [ -v|--verbose | + | |
- | [ -y|--yes ] | + | fi |
- | [ -t|--test ] | + | ### END /etc/grub.d/41_custom ### |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version ] | + | |
- | + | ||
- | Use --longhelp to show all options and advanced commands. | + | |
</ | </ | ||
- | Le volume ayant été agrandi, il est necessaire maintenant d'agrandir le filesystem qui s'y trouve | + | Notez que ce fichier ne doit pas être modifié manuellement. En effet, il est généré par la commande **grub2-mkconfig**. La commande grub2-mkconfig prend en argument l'emplacement du fichier grub.cfg, par exemple |
- | < | + | * grub2-mkconfig -o /boot/grub2/grub.cfg, ou |
- | [root@centos8 ~]# resize2fs | + | * grub2-mkconfig |
- | resize2fs 1.45.6 (20-Mar-2020) | + | |
- | Filesystem at /dev/vg0/lv0 is mounted on /mnt/lvm; on-line resizing required | + | |
- | old_desc_blocks = 2, new_desc_blocks = 2 | + | |
- | The filesystem on / | + | |
- | </ | + | |
- | Constatez maintenant la modification | + | Lors de l' |
- | < | + | ===Le fichier |
- | [root@centos8 ~]# df -h /mnt/lvm | + | |
- | Filesystem | + | |
- | /dev/ | + | |
- | </ | + | |
- | + | ||
- | Vous noterez que la taille a augmentée mais que les données sont toujours présentes. | + | |
- | + | ||
- | ====LAB #5 - Snapshots==== | + | |
- | + | ||
- | Un snapshot est un instantané d'un système de fichiers. Dans cet exemple, vous allez créer un snapshot de votre lv0 : | + | |
- | + | ||
- | Avant de commencer, créez un fichier de 10Mo dans le volume : | + | |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
- | 10+0 records in | + | # this device map was generated by anaconda |
- | 10+0 records out | + | (hd0) /dev/sda |
- | 10485760 bytes (10 MB, 10 MiB) copied, 0.0281282 s, 373 MB/s | + | |
</ | </ | ||
- | Créez maintenant un snapshot : | + | ===Le fichier |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# lvcreate -s -L 18M -n testsnap | + | |
- | Rounding up size to full physical extent 24.00 MiB | + | |
- | Logical volume " | + | |
- | </ | + | |
- | Pour avoir une confirmation | + | Ce fichier contient la configuration par défaut des paramètres |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
- | | + | GRUB_TIMEOUT=5 |
- | | + | GRUB_DISTRIBUTOR=" |
- | swap | + | GRUB_DEFAULT=saved |
- | | + | GRUB_DISABLE_SUBMENU=true |
- | | + | GRUB_TERMINAL_OUTPUT=" |
+ | GRUB_CMDLINE_LINUX=" | ||
+ | GRUB_DISABLE_RECOVERY=" | ||
+ | GRUB_ENABLE_BLSCFG=true | ||
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** | + | **Important** |
</ | </ | ||
- | Les options de la commande **lvs** | + | Dans ce fichier les directives |
- | < | + | ^ Directive |
- | [root@centos8 ~]# lvs --help | + | | GRUB_TIMEOUT | Durée de l' |
- | | + | | GRUB_DISTRIBUTOR | Ligne de commande qui génère le texte de l' |
+ | | 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' | ||
- | lvs | + | ===Les fichiers du répertoire /etc/grub.d=== |
- | [ -H|--history ] | + | |
- | [ -a|--all ] | + | |
- | [ -o|--options String ] | + | |
- | [ -S|--select String ] | + | |
- | [ -O|--sort String ] | + | |
- | [ --segments ] | + | |
- | [ --aligned ] | + | |
- | [ --binary ] | + | |
- | [ --configreport log|vg|lv|pv|pvseg|seg ] | + | |
- | [ --foreign ] | + | |
- | [ --ignorelockingfailure ] | + | |
- | [ --logonly ] | + | |
- | [ --nameprefixes ] | + | |
- | [ --noheadings ] | + | |
- | [ --nosuffix ] | + | |
- | [ --readonly ] | + | |
- | [ --reportformat basic|json ] | + | |
- | [ --rows ] | + | |
- | [ --separator String ] | + | |
- | [ --shared ] | + | |
- | [ --unbuffered ] | + | |
- | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | + | |
- | [ --unquoted ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ VG|LV|Tag | + | |
- | + | ||
- | Common options for lvm: | + | |
- | [ -d|--debug ] | + | |
- | [ -h|--help ] | + | |
- | [ -q|--quiet ] | + | |
- | [ -v|--verbose ] | + | |
- | [ -y|--yes ] | + | |
- | [ -t|--test ] | + | |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version ] | + | |
- | + | ||
- | Use --longhelp to show all options and advanced commands. | + | |
- | </ | + | |
- | Créez maintenant un répertoire | + | Les fichiers de ce répertoire |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
+ | total 108 | ||
+ | -rwxr-xr-x. 1 root root 9346 Jun 27 12:12 00_header | ||
+ | -rwxr-xr-x. 1 root root 1046 Feb 22 2024 00_tuned | ||
+ | -rwxr-xr-x. 1 root root 236 Jun 27 12:12 01_users | ||
+ | -rwxr-xr-x. 1 root root 835 Jun 27 12:12 08_fallback_counting | ||
+ | -rwxr-xr-x. 1 root root 19665 Jun 27 12:12 10_linux | ||
+ | -rwxr-xr-x. 1 root root 833 Jun 27 12:12 10_reset_boot_success | ||
+ | -rwxr-xr-x. 1 root root 892 Jun 27 12:12 12_menu_auto_hide | ||
+ | -rwxr-xr-x. 1 root root 410 Jun 27 12:12 14_menu_show_once | ||
+ | -rwxr-xr-x. 1 root root 13613 Jun 27 12:12 20_linux_xen | ||
+ | -rwxr-xr-x. 1 root root 2562 Jun 27 12:12 20_ppc_terminfo | ||
+ | -rwxr-xr-x. 1 root root 10869 Jun 27 12:12 30_os-prober | ||
+ | -rwxr-xr-x. 1 root root 1122 Jun 27 12:12 30_uefi-firmware | ||
+ | -rwxr-xr-x. 1 root root 725 Feb 19 2024 35_fwupd | ||
+ | -rwxr-xr-x. 1 root root 218 Jun 27 12:12 40_custom | ||
+ | -rwxr-xr-x. 1 root root 219 Jun 27 12:12 41_custom | ||
+ | -rw-r--r--. 1 root root 483 Jun 27 12:12 README | ||
</ | </ | ||
- | Montez le snapshot : | + | * **Le fichier / |
+ | * Le fichier **10_Linux** contient des boucles pour rechercher des noyaux Linux, | ||
+ | * **Le fichier / | ||
+ | * Ce fichier recherche des éventuels systèmes d' | ||
+ | * **Les fichiers / | ||
+ | * Ces deux fichiers sont fournis en tant que modèles à personnaliser. | ||
- | < | + | ===Le Fichier |
- | [root@centos8 ~]# mount /dev/vg0/testsnap / | + | |
- | </ | + | |
- | Comparez le volume d'origine et le snapshot | + | Le fichier **/ |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
- | total 10296 | + | # GRUB Environment Block |
- | -rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M | + | # WARNING: Do not edit this file by tools other than grub-editenv!!! |
- | drwxr-xr-x. 3 root root 1024 Jun 16 06:39 home | + | saved_entry=5a35a3eb625c45cea1d33535723e791f-5.14.0-427.37.1.el9_4.x86_64 |
- | drwx------. 2 root root 12288 Jun 24 04:20 lost+found | + | menu_auto_hide=1 |
- | [root@centos8 | + | boot_success=1 |
- | total 10296 | + | boot_indeterminate=0 |
- | -rw-r--r--. 1 root root 10485760 Jun 24 04:41 10M | + | ################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### |
- | drwxr-xr-x. 3 root root 1024 Jun 16 06:39 home | + | |
- | drwx------. 2 root root 12288 Jun 24 04:20 lost+found | + | |
</ | </ | ||
- | Supprimez maintenant le fichier **10M** | + | ===Modifier la Configuration |
- | < | + | Lors du démarrage de GRUB 2, trois actions sont possibles à partir du menu : |
- | [root@centos8 ~]# rm / | + | |
- | rm: remove regular file '/ | + | |
- | </ | + | |
- | Constatez | + | * Lancer un système d' |
+ | * Lancer l' | ||
+ | * Lancer l’interface | ||
- | < | + | En mode édition notez l' |
- | [root@centos8 ~]# df -Ph /mnt/lvm | + | |
- | Filesystem | + | |
- | / | + | |
- | [root@centos8 ~]# df -Ph / | + | * **flèches** : se déplacer dans l' |
- | Filesystem | + | |
- | / | + | |
- | [root@centos8 ~]# lvs | + | ====Chargeurs de Démarrages Alternatifs==== |
- | LV | + | |
- | root | + | |
- | swap | + | |
- | lv0 vg0 owi-aos--- 456.00m | + | |
- | testsnap vg0 swi-aos--- | + | |
- | </ | + | |
- | <WRAP center round todo 60%> | + | ===Systemd-boot=== |
- | **A Faire** | + | |
- | </ | + | |
- | ====LAB #6 - Suppression des Volumes==== | + | Un Chargeur de Démarrage étroitement lié à Systemd ( voir plus bas ), celui-ci connaît actuellement un gain de popularité. |
- | La suppression d'un volume logique se fait grace à la commande **lvremove** : | + | ===U-boot=== |
- | < | + | Un Chargeur de Démarrage qui peut booter |
- | [root@centos8 ~]# umount / | + | |
- | [root@centos8 ~]# lvremove / | + | |
- | Do you really want to remove active logical volume vg0/ | + | |
- | Logical volume " | + | |
- | [root@centos8 ~]# umount /mnt/lvm | + | |
- | [root@centos8 ~]# lvremove / | + | |
- | Do you really want to remove active logical volume vg0/lv0? [y/n]: y | + | |
- | Logical volume " | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | ===Le Projet Syslinux=== |
- | **Important** - Notez que cette opération necéssite à ce que le volume logique soit démonté. | + | |
- | </ | + | |
- | Les options de la commande **lvremove** sont : | + | ==SYSLINUX== |
- | < | + | Un Chargeur de Démarrage pour les systèmes qui utilisent le système de fichier FAT. Par exemple le systèmes sur clefs USB. |
- | [root@centos8 ~]# lvremove --help | + | |
- | lvremove - Remove logical volume(s) from the system | + | |
- | lvremove VG|LV|Tag|Select ... | + | ==EXTLINUX== |
- | [ -A|--autobackup y|n ] | + | |
- | [ -f|--force ] | + | |
- | [ -S|--select String ] | + | |
- | [ --nohistory ] | + | |
- | [ --noudevsync ] | + | |
- | [ --reportformat basic|json ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | Common options for lvm: | + | Un Chargeur de Démarrage de petite taille qui sait booter des systèmes de fichier, EXT2, EXT3, EXT4 et BRTFS. |
- | [ -d|--debug ] | + | |
- | [ -h|--help ] | + | |
- | [ -q|--quiet ] | + | |
- | [ -v|--verbose ] | + | |
- | [ -y|--yes ] | + | |
- | [ -t|--test ] | + | |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version ] | + | |
- | Use --longhelp to show all options and advanced commands | + | ==ISOLINUX== |
- | </ | + | |
- | Le Volume Group peut aussi être supprimé | + | Un Chargeur de Démarrage pour booter des LiveCD et LiveDVD. Dans le cas d' |
- | < | + | * **isolinux.bin** qui contient l' |
- | [root@centos8 ~]# vgremove vg0 | + | |
- | | + | |
- | </ | + | |
- | Les options | + | ==PXELINUX== |
+ | |||
+ | Un Chargeur | ||
- | < | + | * **DHCP** pour attribuer une adresse IP à la machine et |
- | [root@centos8 ~]# vgremove --help | + | * **BOOTP** pour charger l' |
- | vgremove - Remove volume group(s) | + | |
- | vgremove VG|Tag|Select ... | + | ===Isodhpfx=== |
- | [ -f|--force ] | + | |
- | [ -S|--select String ] | + | |
- | [ --noudevsync ] | + | |
- | [ --reportformat basic|json ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | Common options for lvm: | + | Un Chargeur de Démarrage hybride, appelé **isodhpfx.bin**, |
- | [ -d|--debug ] | + | |
- | [ -h|--help ] | + | |
- | [ -q|--quiet ] | + | |
- | [ -v|--verbose ] | + | |
- | [ -y|--yes ] | + | |
- | [ -t|--test ] | + | |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version ] | + | |
- | Use --longhelp to show all options and advanced commands. | + | ====Initramfs==== |
- | </ | + | |
- | Ainsi que le volume physique | + | Le fichier Initramfs //%%INITial Ram File System%%// est une archive au format cpio : |
< | < | ||
- | [root@centos8 | + | [root@redhat9 |
- | Labels on physical volume "/ | + | |
- | Labels on physical volume "/dev/sdb7" successfully wiped. | + | |
- | Labels on physical volume "/ | + | |
- | </ | + | |
- | + | ||
- | Les options de la commande **pvremove** sont : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# pvremove --help | + | |
- | pvremove - Remove LVM label(s) from physical volume(s) | + | |
- | + | ||
- | pvremove PV ... | + | |
- | [ -f|--force ] | + | |
- | [ --reportformat basic|json ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | Common options for lvm: | + | [root@redhat9 ~]# cd /tmp |
- | [ -d|--debug ] | + | |
- | [ -h|--help ] | + | |
- | [ -q|--quiet ] | + | |
- | [ -v|--verbose ] | + | |
- | [ -y|--yes ] | + | |
- | [ -t|--test ] | + | |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version | + | |
- | Use --longhelp to show all options and advanced commands. | + | [root@redhat9 tmp]# ls custom |
+ | custom | ||
</ | </ | ||
- | ====LAB #7 - Volumes Logiques en Miroir==== | + | ===Examiner l' |
- | Re-créez maintenant votre Volume Group : | + | Pour examiner une image initramfs archivée, il convient d' |
< | < | ||
- | [root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 | + | [root@redhat9 tmp]# lsinitrd custom | more |
- | | + | Image: custom: 54M |
- | | + | ======================================================================== |
- | | + | Early CPIO image |
+ | ======================================================================== | ||
+ | drwxr-xr-x | ||
+ | -rw-r--r-- | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | -rw-r--r-- | ||
+ | ======================================================================== | ||
+ | Version: dracut-057-53.git20240104.el9 | ||
- | [root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 | + | Arguments: |
- | Volume group " | + | |
- | </ | + | |
- | Créez maintenant un Logical Volume en miroir grâce à l' | + | dracut modules: |
- | + | bash | |
- | < | + | systemd |
- | [root@centos8 ~]# lvcreate | + | systemd-initrd |
- | | + | systemd-sysusers |
- | | + | nss-softokn |
+ | dbus-broker | ||
+ | dbus | ||
+ | i18n | ||
+ | network-manager | ||
+ | network | ||
+ | ifcfg | ||
+ | drm | ||
+ | plymouth | ||
+ | prefixdevname | ||
+ | dm | ||
+ | kernel-modules | ||
+ | kernel-modules-extra | ||
+ | kernel-network-modules | ||
+ | lvm | ||
+ | qemu | ||
+ | qemu-net | ||
+ | resume | ||
+ | rootfs-block | ||
+ | terminfo | ||
+ | udev-rules | ||
+ | virtiofs | ||
+ | dracut-systemd | ||
+ | usrmount | ||
+ | base | ||
+ | fs-lib | ||
+ | microcode_ctl-fw_dir_override | ||
+ | shutdown | ||
+ | ======================================================================== | ||
+ | drwxr-xr-x | ||
+ | crw-r--r-- | ||
+ | crw-r--r-- 1 root | ||
+ | crw-r--r-- | ||
+ | crw-r--r-- | ||
+ | crw-r--r-- | ||
+ | --More-- | ||
</ | </ | ||
- | Constatez maintenant la présence du miroir : | + | ===Le script init=== |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# lvdisplay -m / | + | |
- | --- Logical volume --- | + | |
- | LV Path / | + | |
- | LV Name lv1 | + | |
- | VG Name vg0 | + | |
- | LV UUID lJQQWs-n05T-pxzi-Zq2R-UzRI-kYZf-hsNPYQ | + | |
- | LV Write Access | + | |
- | LV Creation host, time centos8.ittraining.loc, | + | |
- | LV Status | + | |
- | # open 0 | + | |
- | LV Size 104.00 MiB | + | |
- | Current LE 13 | + | |
- | Mirrored volumes | + | |
- | Segments | + | |
- | Allocation | + | |
- | Read ahead sectors | + | |
- | - currently set to | + | |
- | Block device | + | |
- | + | ||
- | --- 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 | + | |
- | </ | + | |
- | Le miroir s' | + | Red Hat 9 utilise le système de démarrage **systemd**. Pour cette raison le script init est un lien symbolique vers **/ |
< | < | ||
- | [root@centos8 ~]# pvdisplay -m /dev/sdb6 /dev/sdb7 /dev/sdb9 | + | [root@redhat9 tmp]# lsinitrd custom | grep usr/lib/systemd/systemd | grep init |
- | --- Physical volume --- | + | lrwxrwxrwx |
- | PV Name / | + | |
- | VG Name vg0 | + | |
- | PV Size | + | |
- | Allocatable | + | |
- | PE Size 8.00 MiB | + | |
- | Total PE 24 | + | |
- | Free PE 10 | + | |
- | Allocated PE 14 | + | |
- | PV UUID | + | |
- | + | ||
- | --- Physical Segments --- | + | |
- | Physical extent 0 to 0: | + | |
- | Logical volume / | + | |
- | Logical extents 0 to 0 | + | |
- | Physical extent | + | |
- | Logical volume / | + | |
- | Logical extents 0 to 12 | + | |
- | Physical extent 14 to 23: | + | |
- | FREE | + | |
- | + | ||
- | --- Physical volume --- | + | |
- | PV Name / | + | |
- | VG Name vg0 | + | |
- | PV Size | + | |
- | Allocatable | + | |
- | PE Size 8.00 MiB | + | |
- | Total PE 37 | + | |
- | Free PE 23 | + | |
- | Allocated PE 14 | + | |
- | PV UUID | + | |
- | + | ||
- | --- 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 / | + | |
- | Logical extents 0 to 12 | + | |
- | Physical extent 14 to 36: | + | |
- | FREE | + | |
- | + | ||
- | --- Physical volume --- | + | |
- | PV Name / | + | |
- | VG Name vg0 | + | |
- | PV Size | + | |
- | Allocatable | + | |
- | PE Size 8.00 MiB | + | |
- | Total PE 49 | + | |
- | Free PE 49 | + | |
- | Allocated PE 0 | + | |
- | PV UUID | + | |
- | + | ||
- | --- Physical Segments --- | + | |
- | Physical extent 0 to 48: | + | |
- | FREE | + | |
</ | </ | ||
- | La suppression du miroir se fait en utilisant la commande **lvconvert** en indiquant quel volume physique doit être vidé de son contenu | + | ===Consulter le contenu |
- | < | + | Pour consulter le contenu d'un fichier inclus dans l' |
- | [root@centos8 ~]# lvconvert -m 0 / | + | |
- | Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y | + | |
- | Logical volume vg0/lv1 successfully converted. | + | |
- | </ | + | |
- | + | ||
- | De même, il est possible | + | |
< | < | ||
- | [root@centos8 ~]# lvconvert -m 1 /dev/vg0/lv1 | + | [root@redhat9 tmp]# lsinitrd |
- | Are you sure you want to convert linear LV vg0/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y | + | include ld.so.conf.d/*.conf |
- | | + | |
</ | </ | ||
- | Supprimez | + | ====Processus |
- | < | + | Le processus de démarrage du Noyau Linux peut être divisé en 6 étapes |
- | [root@centos8 ~]# lvconvert -m 0 / | + | |
- | Are you sure you want to convert raid1 LV vg0/lv1 to type linear losing all resilience? [y/n]: y | + | |
- | Logical volume vg0/lv1 successfully converted. | + | |
- | </ | + | |
- | Les options | + | ^ Etape ^ Description ^ |
+ | | Chargement, configuration et exécution du chargeur du noyau | Le fichier **bootsect.s** est chargé en mémoire par le BIOS. Une fois configuré celui-ci charge le reste du noyau en mémoire | | ||
+ | | Configuration des paramètres et bascule vers le mode 32 bits | Le fichier **boot.s** met en place un **[[http:// | ||
+ | | Décompression du Noyau | Le fichier **head.s** décompresse le noyau | | ||
+ | | Initialisation du noyau et de la mémoire | Le fichier | ||
+ | | Configuration du noyau | Le fichier **main.c** met en place les contraintes de mémoire et configure la mémoire virtuelle | | ||
+ | | Création du processus Init | Le fichier **main.c** crée le processus init | | ||
- | < | + | La fonction **init_post()** essaie ensuite d' |
- | [root@centos8 ~]# lvconvert --help | + | |
- | lvconvert - Change logical volume layout | + | |
- | | + | |
- | | + | |
- | [ COMMON_OPTIONS ] | + | * /bin/init |
- | [ PV ... ] | + | * /bin/sh ==> /bin/bash ==> / |
- | Convert LV to striped. | + | Dans le cas d'un échec à ce stade le message **Kernel Panic** sera affiché. |
- | lvconvert --type striped LV | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ -i|--interval Number ] | + | |
- | [ --stripes Number ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Convert LV to type mirror (also see type raid1), | + | =====Systemd===== |
- | lvconvert --type mirror LV | + | |
- | [ -m|--mirrors [+|-]Number ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ -i|--interval Number ] | + | |
- | [ --stripes Number ] | + | |
- | [ --mirrorlog core|disk ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Convert LV to raid or change raid layout | + | Les systèmes de démarrage antérieurs à Systemd, **SysVinit** et **Upstart**, |
- | (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. | + | **Systemd** essaie, par contre, de démarrer autant de services en parallèle que possible. Ceci est rendu possible car la majorité d' |
- | lvconvert | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ -i|--interval Number ] | + | |
- | [ --mirrorlog core|disk ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | Convert raid LV to change number of stripe images. | + | Au lieu de parler de scripts de démarrage et de niveaux d' |
- | lvconvert --stripes Number LV_raid | + | |
- | [ -i|--interval Number ] | + | |
- | [ -R|--regionsize Size[m|UNIT] ] | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | | + | |
- | | + | |
- | [ -i|--interval Number ] | + | * **.mount** |
- | [ -R|--regionsize Size[m|UNIT] ] | + | * **.path** |
- | [ COMMON_OPTIONS ] | + | * **.service** |
+ | * **.scope** | ||
+ | * **.slice** | ||
+ | * **.snapshot** | ||
+ | * **.socket** | ||
+ | * **.swap** - encapsule une périphérique ou un fichier swap. | ||
+ | * **.timer** - déclenche l' | ||
+ | * **.target** - regroupe des Unités multiples afin qu' | ||
- | Split images from a raid1 or mirror LV and use them to create a new LV. | + | Une Cible est en quelque sorte une **grande étape** dans le démarrage du système : |
- | lvconvert --splitmirrors Number -n|--name LV_new LV_cache_mirror_raid1 | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | | + | |
- | | + | |
- | [ COMMON_OPTIONS ] | + | * **shutdown.target** |
- | [ PV ... ] | + | * **rescue.target** |
+ | * **emergency.target** - démarre le système en mode single-user (seul root peut s'y connecter). Uniquement le système de fichiers racine est monté en mode lecture seule. Le réseau n'est pas démarré. | ||
+ | * **multi-user.target** - démarre le système en mode multi-utilisateur avec tous les systèmes de fichiers montés et le service network démarré. | ||
+ | * **graphical.target** - démarre le système en multi-user.target puis démarre l' | ||
+ | * **hibernate.target** - sauvegarde l' | ||
+ | * **reboot.target** - redémarre le système. | ||
- | Merge LV images that were split from a raid1 LV. | + | **Systemd** utilise des Cibles |
- | lvconvert --mergemirrors VG|LV_linear_raid|Tag ... | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Convert LV to a thin LV, using the original LV as an external origin. | + | |
- | lvconvert --type thin --thinpool LV LV_linear_striped_thin_cache_raid | + | |
- | [ -T|--thin ] | + | |
- | [ -r|--readahead auto|none|Number ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ --originname LV_new ] | + | |
- | [ --poolmetadata LV ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --metadataprofile String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Attach a cache pool to an LV, converts the LV to type cache. | + | |
- | lvconvert --type cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid | + | |
- | [ -H|--cache ] | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ -r|--readahead auto|none|Number ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ --cachemetadataformat auto|1|2 ] | + | |
- | [ --cachemode writethrough|writeback|passthrough ] | + | |
- | [ --cachepolicy String ] | + | |
- | [ --cachesettings String ] | + | |
- | [ --poolmetadata LV ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --metadataprofile String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Attach a writecache to an LV, converts the LV to type writecache. | + | |
- | lvconvert --type writecache --cachevol LV LV_linear_striped_raid | + | |
- | [ --cachesettings String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Attach a cache to an LV, converts the LV to type cache. | + | |
- | lvconvert --type cache --cachevol LV LV_linear_striped_thinpool_raid | + | |
- | [ -H|--cache ] | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ --cachemetadataformat auto|1|2 ] | + | |
- | [ --cachemode writethrough|writeback|passthrough ] | + | |
- | [ --cachepolicy String ] | + | |
- | [ --cachesettings String ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Add a writecache to an LV, using a specified cache device. | + | |
- | lvconvert --type writecache --cachedevice PV LV_linear_striped_raid | + | |
- | [ --cachesize Size[m|UNIT] ] | + | |
- | [ --cachesettings String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Add a cache to an LV, using a specified cache device. | + | |
- | lvconvert --type cache --cachedevice PV LV_linear_striped_thinpool_raid | + | |
- | [ --cachesize Size[m|UNIT] ] | + | |
- | [ --cachesettings String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Convert LV to type thin-pool. | + | |
- | lvconvert --type thin-pool LV_linear_striped_cache_raid | + | |
- | [ -I|--stripesize Size[k|UNIT] ] | + | |
- | [ -r|--readahead auto|none|Number ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ --stripes Number ] | + | |
- | [ --discards passdown|nopassdown|ignore ] | + | |
- | [ --poolmetadata LV ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --metadataprofile String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | + | ||
- | Convert LV to type cache-pool. | + | |
- | lvconvert --type cache-pool LV_linear_striped_raid | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ -r|--readahead auto|none|Number ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ --cachemetadataformat auto|1|2 ] | + | |
- | [ --cachemode writethrough|writeback|passthrough ] | + | |
- | [ --cachepolicy String ] | + | |
- | [ --cachesettings String ] | + | |
- | [ --poolmetadata LV ] | + | |
- | [ --poolmetadatasize Size[m|UNIT] ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ --metadataprofile String ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | + | ||
- | Convert LV to type vdopool. | + | |
- | lvconvert --type vdo-pool LV_linear_striped_cache_raid | + | |
- | [ -n|--name LV_new ] | + | |
- | [ -V|--virtualsize Size[m|UNIT] ] | + | |
- | [ --compression y|n ] | + | |
- | [ --deduplication y|n ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Detach a cache from an LV. | + | |
- | lvconvert --splitcache LV_thinpool_cache_cachepool_vdopool_writecache | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Merge thin LV into its origin LV. | + | |
- | lvconvert --mergethin LV_thin ... | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Merge COW snapshot LV into its origin. | + | |
- | lvconvert --mergesnapshot LV_snapshot ... | + | |
- | [ -i|--interval Number ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Combine a former COW snapshot (second arg) with a former | + | |
- | origin LV (first arg) to reverse a splitsnapshot command. | + | |
- | lvconvert --type snapshot LV LV_linear_striped | + | |
- | [ -s|--snapshot ] | + | |
- | [ -c|--chunksize Size[k|UNIT] ] | + | |
- | [ -Z|--zero y|n ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Replace failed PVs in a raid or mirror LV. | + | |
- | Repair a thin pool. | + | |
- | Repair a cache pool. | + | |
- | lvconvert --repair LV_thinpool_cache_cachepool_mirror_raid | + | |
- | [ -i|--interval Number ] | + | |
- | [ --usepolicies ] | + | |
- | [ --poolmetadataspare y|n ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | + | ||
- | Replace specific PV(s) in a raid LV with another PV. | + | |
- | lvconvert --replace PV LV_raid | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | + | ||
- | Poll LV to continue conversion. | + | |
- | lvconvert --startpoll LV_mirror_raid | + | |
- | [ COMMON_OPTIONS ] | + | |
- | + | ||
- | Add or remove data integrity checksums to raid images. | + | |
- | lvconvert --raidintegrity y|n LV_raid | + | |
- | [ --raidintegritymode String ] | + | |
- | [ --raidintegrityblocksize Number ] | + | |
- | [ COMMON_OPTIONS ] | + | |
- | [ PV ... ] | + | |
- | + | ||
- | Common options for command: | + | |
- | [ -b|--background ] | + | |
- | [ -f|--force ] | + | |
- | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | + | |
- | [ --noudevsync ] | + | |
- | + | ||
- | Common options for lvm: | + | |
- | [ -d|--debug ] | + | |
- | [ -h|--help ] | + | |
- | [ -q|--quiet ] | + | |
- | [ -v|--verbose ] | + | |
- | [ -y|--yes ] | + | |
- | [ -t|--test ] | + | |
- | [ --commandprofile String ] | + | |
- | [ --config String ] | + | |
- | [ --driverloaded y|n ] | + | |
- | [ --nolocking ] | + | |
- | [ --lockopt String ] | + | |
- | [ --longhelp ] | + | |
- | [ --profile String ] | + | |
- | [ --version ] | + | |
- | + | ||
- | Use --longhelp to show all options and advanced commands. | + | |
- | </ | + | |
- | + | ||
- | ====LAB #8 - Modifier les Attributs LVM==== | + | |
- | + | ||
- | En cas de présence | + | |
< | < | ||
- | [root@centos8 ~]# lvs | + | [root@redhat9 tmp]# ls -l / |
- | | + | lrwxrwxrwx. 1 root root 15 Jul 18 13:00 / |
- | root cl_centos8 | + | lrwxrwxrwx. 1 root root 13 Jul 18 13:00 / |
- | swap cl_centos8 -wi-ao---- 3.20g | + | lrwxrwxrwx. 1 root root 17 Jul 18 13:00 / |
- | | + | lrwxrwxrwx. 1 root root 17 Jul 18 13:00 / |
- | </code> | + | lrwxrwxrwx. 1 root root 17 Jul 18 13:00 / |
+ | lrwxrwxrwx. 1 root root 16 Jul 18 13:00 / | ||
+ | lrwxrwxrwx. 1 root root 13 Jul 18 13:00 /usr/ | ||
- | <WRAP center round important 60%> | + | /usr/lib/systemd/system/runlevel1.target.wants: |
- | Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs. | + | total 0 |
- | </ | + | |
- | La commande equivalente pour les Volume Groups est **vgs** | + | / |
+ | total 0 | ||
- | < | + | / |
- | [root@centos8 ~]# vgs | + | total 0 |
- | VG #PV #LV #SN Attr | + | |
- | cl_centos8 | + | |
- | | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | /usr/lib/systemd/system/runlevel4.target.wants: |
- | Consultez **[[http://www.unixarena.com/2013/08/redhat-linux-lvm-volume-attributes.html|cette page]]** pour comprendre les attributs. | + | total 0 |
- | </ | + | |
- | La commande equivalente pour les Physical Volumes est **pvs** : | + | /usr/lib/systemd/system/runlevel5.target.wants: |
- | + | total 0 | |
- | < | + | |
- | [root@centos8 ~]# pvs | + | |
- | PV | + | |
- | | + | |
- | | + | |
- | | + | |
- | / | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | ====LAB #1 - La Commande systemctl==== |
- | Consultez **[[http:// | + | |
- | </ | + | |
- | + | ||
- | Les commandes **lvchange**, | + | |
- | Par exemple, pour rendre inutilisable un Logical Volume, il convient d'enlever | + | Pour visualiser la liste des Unités, il convient d'utiliser la commande **systemctl** avec l'option |
< | < | ||
- | [root@centos8 ~]# lvchange | + | [root@redhat9 tmp]# systemctl list-units |
+ | UNIT | ||
+ | proc-sys-fs-binfmt_misc.automount | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-pci0000: | ||
+ | sys-devices-platform-serial8250-tty-ttyS0.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS1.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS2.device | ||
+ | sys-devices-platform-serial8250-tty-ttyS3.device | ||
+ | sys-devices-virtual-block-dm\x2d0.device | ||
+ | sys-devices-virtual-block-dm\x2d1.device | ||
+ | sys-devices-virtual-block-dm\x2d2.device | ||
+ | sys-devices-virtual-block-dm\x2d3.device | ||
+ | sys-devices-virtual-block-md1.device | ||
+ | sys-devices-virtual-misc-rfkill.device | ||
+ | sys-module-configfs.device | ||
+ | sys-module-fuse.device | ||
+ | sys-subsystem-net-devices-ens18.device | ||
+ | -.mount | ||
+ | boot.mount | ||
+ | | ||
+ | dev-mqueue.mount | ||
+ | run-credentials-systemd\x2dsysctl.service.mount | ||
+ | run-credentials-systemd\x2dtmpfiles\x2dsetup.service.mount | ||
+ | run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount | ||
+ | run-user-1000.mount | ||
+ | run-user-42.mount | ||
+ | sys-fs-fuse-connections.mount | ||
+ | sys-kernel-config.mount | ||
+ | sys-kernel-debug.mount | ||
+ | sys-kernel-tracing.mount | ||
+ | cups.path | ||
+ | systemd-ask-password-wall.path | ||
+ | init.scope | ||
+ | session-4.scope | ||
+ | session-c1.scope | ||
+ | accounts-daemon.service | ||
+ | atd.service | ||
+ | lines 1-55 | ||
</ | </ | ||
- | Pour faire l' | + | Pour consulter la liste des Unités inactifs, utilisez |
< | < | ||
- | [root@centos8 ~]# lvchange | + | [root@redhat9 tmp]# systemctl list-units --all | grep inactive | more |
+ | ● boot.automount | ||
+ | dev-mapper-sdb12.device | ||
+ | ● home.mount | ||
+ | mnt-sdb12.mount | ||
+ | proc-sys-fs-binfmt_misc.mount | ||
+ | ● sysroot.mount | ||
+ | tmp.mount | ||
+ | ● var.mount | ||
+ | systemd-ask-password-console.path | ||
+ | systemd-ask-password-plymouth.path | ||
+ | alsa-restore.service | ||
+ | alsa-state.service | ||
+ | ● auto-cpufreq.service | ||
+ | ● autofs.service | ||
+ | blk-availability.service | ||
+ | cpupower.service | ||
+ | dm-event.service | ||
+ | dnf-makecache.service | ||
+ | dracut-cmdline.service | ||
+ | dracut-initqueue.service | ||
+ | dracut-mount.service | ||
+ | dracut-pre-mount.service | ||
+ | dracut-pre-pivot.service | ||
+ | dracut-pre-trigger.service | ||
+ | dracut-pre-udev.service | ||
+ | dracut-shutdown-onfailure.service | ||
+ | ● ebtables.service | ||
+ | emergency.service | ||
+ | ● fcoe.service | ||
+ | getty@tty1.service | ||
+ | ● httpd-init.service | ||
+ | initrd-cleanup.service | ||
+ | initrd-parse-etc.service | ||
+ | initrd-switch-root.service | ||
+ | initrd-udevadm-cleanup-db.service | ||
+ | insights-client-boot.service | ||
+ | ● ip6tables.service | ||
+ | ● ipset.service | ||
+ | ● iptables.service | ||
+ | iscsi-init.service | ||
+ | iscsi-onboot.service | ||
+ | iscsi-shutdown.service | ||
+ | iscsi-starter.service | ||
+ | iscsid.service | ||
+ | iscsiuio.service | ||
+ | ldconfig.service | ||
+ | logrotate.service | ||
+ | low-memory-monitor.service | ||
+ | ● lvm2-activation-early.service | ||
+ | lvm2-lvmpolld.service | ||
+ | mdadm-last-resort@md1.service | ||
+ | microcode.service | ||
+ | mlocate-updatedb.service | ||
+ | modprobe@configfs.service | ||
+ | modprobe@drm.service | ||
+ | --More-- | ||
</ | </ | ||
- | Les options | + | Les points noirs au début |
< | < | ||
- | [root@centos8 ~]# lvchange --help | + | [root@redhat9 tmp]# systemctl status ip6tables |
- | | + | Unit ip6tables.service could not be found. |
- | + | ||
- | Change a general LV attribute. | + | |
- | For options listed in parentheses, | + | |
- | 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, | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | 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 ' | + | |
- | 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. | + | |
</ | </ | ||
- | ====LAB #9 - Volumes Logiques en Bandes==== | + | Pour consulter |
- | + | ||
- | Un volume logique en bandes est créé pour augmenter, comme dans le cas du RAID, les performances des entrées et sorties. | + | |
- | + | ||
- | * **-i** - indique le nombre de volumes de bandes, | + | |
- | * **-I** - indique la taille en Ko de chaque bande. | + | |
- | + | ||
- | Saisissez donc la commande suivante : | + | |
< | < | ||
- | [root@centos8 ~]# lvcreate | + | [root@redhat9 tmp]# systemctl list-unit-files | more |
- | | + | UNIT FILE STATE |
- | | + | proc-sys-fs-binfmt_misc.automount |
- | | + | -.mount |
+ | boot.mount | ||
+ | dev-hugepages.mount | ||
+ | dev-mqueue.mount | ||
+ | mnt-sdb12.mount generated | ||
+ | proc-sys-fs-binfmt_misc.mount disabled | ||
+ | run-vmblock\x2dfuse.mount disabled | ||
+ | sys-fs-fuse-connections.mount static | ||
+ | sys-kernel-config.mount | ||
+ | sys-kernel-debug.mount | ||
+ | sys-kernel-tracing.mount | ||
+ | tmp.mount | ||
+ | cups.path | ||
+ | insights-client-results.path | ||
+ | ostree-finalize-staged.path | ||
+ | systemd-ask-password-console.path | ||
+ | systemd-ask-password-plymouth.path | ||
+ | systemd-ask-password-wall.path | ||
+ | session-4.scope | ||
+ | session-c1.scope | ||
+ | accounts-daemon.service | ||
+ | alsa-restore.service | ||
+ | alsa-state.service | ||
+ | arp-ethers.service | ||
+ | atd.service | ||
+ | auditd.service | ||
+ | autovt@.service | ||
+ | avahi-daemon.service | ||
+ | bar.service | ||
+ | blk-availability.service | ||
+ | bluetooth.service | ||
+ | bolt.service | ||
+ | brltty.service | ||
+ | canberra-system-bootup.service | ||
+ | canberra-system-shutdown-reboot.service | ||
+ | canberra-system-shutdown.service | ||
+ | chrony-wait.service | ||
+ | chronyd-restricted.service | ||
+ | chronyd.service | ||
+ | cni-dhcp.service | ||
+ | cockpit-motd.service | ||
+ | cockpit-wsinstance-http.service | ||
+ | cockpit-wsinstance-https-factory@.service | ||
+ | cockpit-wsinstance-https@.service | ||
+ | cockpit.service | ||
+ | colord.service | ||
+ | configure-printer@.service | ||
+ | console-getty.service | ||
+ | container-getty@.service | ||
+ | cpupower.service | ||
+ | crond.service | ||
+ | cups-browsed.service | ||
+ | cups.service | ||
+ | --More-- | ||
</ | </ | ||
- | Constatez la présence de vos bandes sur /dev/sda7 et sur / | + | Pour visualiser les Unités d'un type spécifique, |
< | < | ||
- | [root@centos8 ~]# lvdisplay | + | [root@redhat9 tmp]# systemctl list-unit-files -t mount |
- | --- Logical volume --- | + | UNIT FILE |
- | LV Path /dev/vg0/lv2 | + | -.mount |
- | LV Name lv2 | + | boot.mount |
- | VG Name vg0 | + | dev-hugepages.mount |
- | LV UUID MmXbPt-ZF8u-rnIv-3YU9-m64J-RCz2-6NzAuG | + | dev-mqueue.mount |
- | LV Write Access | + | mnt-sdb12.mount |
- | LV Creation host, time centos8.ittraining.loc, | + | proc-sys-fs-binfmt_misc.mount disabled |
- | LV Status | + | run-vmblock\x2dfuse.mount |
- | # open 0 | + | sys-fs-fuse-connections.mount static |
- | LV Size 112.00 MiB | + | sys-kernel-config.mount |
- | Current LE 14 | + | sys-kernel-debug.mount |
- | | + | sys-kernel-tracing.mount static |
- | Allocation | + | tmp.mount |
- | Read ahead sectors | + | |
- | | + | |
- | Block device | + | |
- | + | ||
- | | + | |
- | Logical extents 0 to 13: | + | |
- | Type striped | + | |
- | | + | |
- | | + | |
- | Stripe 0: | + | |
- | Physical volume / | + | |
- | Physical extents 0 to 6 | + | |
- | Stripe 1: | + | |
- | | + | |
- | Physical extents 0 to 6 | + | |
+ | 12 unit files listed. | ||
</ | </ | ||
- | Utilisez maintenant | + | Dans la colonne STATE on voit les mots **static** et **generated**. |
- | < | + | |
- | [root@centos8 ~]# lvs -o +devices | + | * Ceci implique que l' |
- | LV | + | |
- | root cl_centos8 -wi-ao---- | + | |
- | swap cl_centos8 -wi-ao---- | + | |
- | lv1 vg0 -wi-a----- 104.00m | + | |
- | lv2 vg0 -wi-a----- 112.00m | + | |
- | </ | + | |
- | ====LAB #10 - Gérer les Métadonnées==== | + | * STATE = generated |
- | + | * Ceci implique que le fichier | |
- | Les métadonnées pour chaque Volume Group sont stockés dans un fichier | + | |
< | < | ||
- | [root@centos8 ~]# cat /etc/lvm/backup/vg0 | + | [root@redhat9 tmp]# ls -l /lib/systemd/system-generators/systemd-fstab-generator |
- | # Generated by LVM2 version 2.03.09(2)-RHEL8 (2020-05-28): Wed Jun 2 07:47:38 2021 | + | -rwxr-xr-x. 1 root root 57696 Jul 18 13:01 /lib/systemd/system-generators/systemd-fstab-generator |
- | + | ||
- | contents = "Text Format Volume Group" | + | |
- | version = 1 | + | |
- | + | ||
- | description = " | + | |
- | + | ||
- | creation_host = " | + | |
- | creation_time = 1622634458 # | + | |
- | + | ||
- | vg0 { | + | |
- | id = " | + | |
- | seqno = 11 | + | |
- | format = " | + | |
- | status = [" | + | |
- | flags = [] | + | |
- | extent_size = 16384 # 8 Megabytes | + | |
- | max_lv = 0 | + | |
- | max_pv = 0 | + | |
- | metadata_copies = 0 | + | |
- | + | ||
- | physical_volumes { | + | |
- | + | ||
- | pv0 { | + | |
- | id = " | + | |
- | device = "/dev/sdb6" | + | |
- | + | ||
- | status = [" | + | |
- | flags = [] | + | |
- | dev_size = 409600 # 200 Megabytes | + | |
- | pe_start = 2048 | + | |
- | pe_count = 24 # 192 Megabytes | + | |
- | } | + | |
- | + | ||
- | pv1 { | + | |
- | id = " | + | |
- | device = "/dev/ | + | |
- | + | ||
- | status = [" | + | |
- | flags = [] | + | |
- | dev_size = 614400 # 300 Megabytes | + | |
- | pe_start = 2048 | + | |
- | pe_count = 37 # 296 Megabytes | + | |
- | } | + | |
- | + | ||
- | pv2 { | + | |
- | id = " | + | |
- | device = "/dev/ | + | |
- | + | ||
- | status = [" | + | |
- | flags = [] | + | |
- | dev_size = 819200 # 400 Megabytes | + | |
- | pe_start = 2048 | + | |
- | pe_count = 49 # 392 Megabytes | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | logical_volumes { | + | |
- | + | ||
- | lv1 { | + | |
- | id = " | + | |
- | status = [" | + | |
- | flags = [] | + | |
- | creation_time = 1622633848 # | + | |
- | creation_host = " | + | |
- | segment_count = 1 | + | |
- | + | ||
- | segment1 { | + | |
- | start_extent = 0 | + | |
- | extent_count = 13 # 104 Megabytes | + | |
- | + | ||
- | type = " | + | |
- | stripe_count = 1 # linear | + | |
- | + | ||
- | stripes = [ | + | |
- | " | + | |
- | ] | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | lv2 { | + | |
- | id = " | + | |
- | status = [" | + | |
- | flags = [] | + | |
- | creation_time = 1622634458 # | + | |
- | creation_host = " | + | |
- | segment_count = 1 | + | |
- | + | ||
- | segment1 { | + | |
- | start_extent = 0 | + | |
- | extent_count = 14 # 112 Megabytes | + | |
- | + | ||
- | type = " | + | |
- | stripe_count = 2 | + | |
- | stripe_size = 128 # 64 Kilobytes | + | |
- | + | ||
- | stripes = [ | + | |
- | " | + | |
- | " | + | |
- | ] | + | |
- | } | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | } | + | |
</ | </ | ||
- | Des archives sont créées lors de chaque modification | + | Il existe aussi d'autres exécutables responsables |
< | < | ||
- | [root@centos8 ~]# ls /etc/lvm/archive/ | + | [root@redhat9 tmp]# ls -l /lib/systemd/system-generators |
- | vg0_00000-427117660.vg | + | total 396 |
- | vg0_00001-1993147316.vg vg0_00003-1757437978.vg vg0_00005-116946854.vg vg0_00007-1006758937.vg vg0_00009-1054420117.vg vg0_00011-973084311.vg | + | -rwxr-xr-x. 1 root root |
+ | -rwxr-xr-x. 1 root root 15832 May 17 18:27 ostree-system-generator | ||
+ | lrwxrwxrwx. 1 root root 31 Aug 8 10:54 podman-system-generator -> ../ | ||
+ | -rwxr-xr-x. 1 root root 1005 Feb 19 2024 selinux-autorelabel-generator.sh | ||
+ | -rwxr-xr-x. 1 root root 15624 Jul 18 13:01 systemd-bless-boot-generator | ||
+ | -rwxr-xr-x. 1 root root 40920 Jul 18 13:01 systemd-cryptsetup-generator | ||
+ | -rwxr-xr-x. 1 root root 24312 Jul 18 13:01 systemd-debug-generator | ||
+ | -rwxr-xr-x. 1 root root 57696 Jul 18 13:01 systemd-fstab-generator | ||
+ | -rwxr-xr-x. 1 root root 24096 Jul 18 13:01 systemd-getty-generator | ||
+ | -rwxr-xr-x. 1 root root 36496 Jul 18 13:01 systemd-gpt-auto-generator | ||
+ | -rwxr-xr-x. 1 root root 16096 Jul 18 13:01 systemd-hibernate-resume-generator | ||
+ | -rwxr-xr-x. 1 root root 24240 Jul 18 13:01 systemd-integritysetup-generator | ||
+ | -rwxr-xr-x. 1 root root 15632 Jul 18 13:01 systemd-rc-local-generator | ||
+ | -rwxr-xr-x. 1 root root 24296 Jul 18 13:01 systemd-run-generator | ||
+ | -rwxr-xr-x. 1 root root 15824 Jul 18 13:01 systemd-system-update-generator | ||
+ | -rwxr-xr-x. 1 root root 36424 Jul 18 13:01 systemd-sysv-generator | ||
+ | -rwxr-xr-x. 1 root root 36872 Jul 18 13:01 systemd-veritysetup-generator | ||
</ | </ | ||
- | La commande **vgcfgbackup** est utilisée pour sauvegarder les métadonnées manuellement dans le fichier **/ | + | Les options de la commande **systemctl** sont : |
- | + | ||
- | La commande **vgcfgrestore** permet de restaurer une sauvegarde. Sans l' | + | |
< | < | ||
- | [root@centos8 ~]# vgcfgbackup vg0 | + | [root@redhat9 tmp]# systemctl --help |
- | | + | systemctl [OPTIONS...] COMMAND ... |
- | </ | + | |
- | Il est aussi possible de modifier l' | + | Query or send control commands to the system manager. |
- | < | + | Unit Commands: |
- | [root@centos8 ~]# vgcfgbackup | + | |
- | | + | list-automounts [PATTERN...] |
+ | ordered by path | ||
+ | list-sockets [PATTERN...] | ||
+ | ordered by address | ||
+ | list-timers [PATTERN...] | ||
+ | ordered by next elapse | ||
+ | is-active PATTERN... | ||
+ | is-failed PATTERN... | ||
+ | status [PATTERN...|PID...] | ||
+ | show [PATTERN...|JOB...] | ||
+ | units/jobs or the manager | ||
+ | cat PATTERN... | ||
+ | help PATTERN...|PID... | ||
+ | list-dependencies [UNIT...] | ||
+ | or wanted by the units or by which those | ||
+ | units are required or wanted | ||
+ | start UNIT... | ||
+ | stop UNIT... | ||
+ | reload UNIT... | ||
+ | restart UNIT... | ||
+ | try-restart UNIT... | ||
+ | reload-or-restart UNIT... | ||
+ | otherwise start or restart | ||
+ | try-reload-or-restart UNIT... | ||
+ | if supported, otherwise restart | ||
+ | isolate UNIT Start one unit and stop all others | ||
+ | kill UNIT... | ||
+ | clean UNIT... | ||
+ | configuration of unit | ||
+ | freeze PATTERN... | ||
+ | thaw PATTERN... | ||
+ | set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit | ||
+ | bind UNIT PATH [PATH] | ||
+ | unit's namespace | ||
+ | mount-image UNIT PATH [PATH [OPTS]] Mount an image from the host into a | ||
+ | unit's namespace | ||
+ | service-log-level SERVICE [LEVEL] | ||
+ | | ||
+ | reset-failed [PATTERN...] Reset failed state for all, one, or more | ||
+ | units | ||
+ | Unit File Commands: | ||
+ | list-unit-files [PATTERN...] | ||
+ | enable [UNIT...|PATH...] | ||
+ | disable UNIT... | ||
+ | reenable UNIT... | ||
+ | preset UNIT... | ||
+ | based on preset configuration | ||
+ | preset-all | ||
+ | preset configuration | ||
+ | lines 1-55 | ||
</ | </ | ||
- | Par contre, toute sauvegarde en dehors des répertoires par défaut n'est pas visible dans la sortie | + | ====LAB #2 - Fichiers |
- | < | + | ===2.1 - Fichiers de Configuration par Défaut=== |
- | [root@centos8 ~]# vgcfgrestore --list vg0 | + | |
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 10:43:14 2021 | + | |
- | + | Les fichiers de configuration | |
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 16:56:31 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 22:12:15 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 22:19:25 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 22:38:37 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 22:42:18 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed May 26 22:43:49 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:37:07 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:37:28 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:41:04 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:41:53 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:42:23 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:47:38 2021 | + | |
- | + | ||
- | + | ||
- | File: | + | |
- | VG name: vg0 | + | |
- | Description: | + | |
- | Backup Time: Wed Jun 2 07:50:57 2021 | + | |
- | </ | + | |
- | + | ||
- | =====Systèmes de Fichiers Journalisés===== | + | |
- | + | ||
- | ====Présentation==== | + | |
- | + | ||
- | Un journal est la partie d'un système de fichiers | + | |
- | + | ||
- | L' | + | |
- | + | ||
- | Sans un tel fichier journal, un outil de récupération de données après un arrêt brutal doit parcourir l' | + | |
- | + | ||
- | 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:// | + | |
- | | **[[http:// | + | |
- | | **[[http:// | + | |
- | | **[[http:// | + | |
- | | **[[http:// | + | |
- | | **[[https:// | + | |
- | + | ||
- | <WRAP center round todo 60%> | + | |
- | **A faire** : Pour comparer ces six systèmes de fichier, veuillez consulter **[[http:// | + | |
- | </ | + | |
- | + | ||
- | ====Ext3==== | + | |
- | + | ||
- | Ext3 est une évolution de Ext2 et a pour principale différence d' | + | |
- | + | ||
- | * être utilisé à partir d'une partition Ext2, sans avoir à sauvegarder et à restaurer | + | |
- | * utiliser tous les utilitaires de maintenance pour les systèmes de fichiers ext2, comme fsck, | + | |
- | * utiliser | + | |
- | + | ||
- | Pour plus d' | + | |
- | + | ||
- | ===Gestion d' | + | |
- | + | ||
- | Notez maintenant le numéro de la dernière partition que vous avez précédemment créée | + | |
< | < | ||
- | [root@centos8 ~]# fdisk -l | + | [root@redhat9 tmp]# pkg-config systemd |
- | Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors | + | /usr/lib/systemd/system |
- | Units: sectors of 1 * 512 = 512 bytes | + | |
- | Sector size (logical/ | + | |
- | I/O size (minimum/ | + | |
- | Disklabel type: dos | + | |
- | Disk identifier: 0xb0dacb39 | + | |
- | + | ||
- | Device | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | + | ||
- | + | ||
- | Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors | + | |
- | Units: sectors of 1 * 512 = 512 bytes | + | |
- | Sector size (logical/ | + | |
- | I/O size (minimum/ | + | |
- | Disklabel type: dos | + | |
- | Disk identifier: 0x70b17285 | + | |
- | + | ||
- | Device | + | |
- | / | + | |
- | / | + | |
- | / | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | Disk / | + | |
- | Units: sectors of 1 * 512 = 512 bytes | + | |
- | Sector size (logical/ | + | |
- | I/O size (minimum/ | + | |
- | + | ||
- | + | ||
- | Disk / | + | |
- | Units: sectors of 1 * 512 = 512 bytes | + | |
- | Sector size (logical/physical): 512 bytes / 512 bytes | + | |
- | I/O size (minimum/optimal): 65536 bytes / 131072 bytes | + | |
</ | </ | ||
- | |||
- | Créez un filesystem Ext3 sur /dev/sdb12 en utilisant la commande **mke2fs -j** : | ||
< | < | ||
- | [root@centos8 ~]# mke2fs | + | [root@redhat9 tmp]# ls -l /usr/lib/ |
- | mke2fs | + | total 1640 |
- | Creating filesystem with 204800 1k blocks and 51200 inodes | + | -rw-r--r--. |
- | Filesystem UUID: a2515f45-a32a-4e87-b7e6-170448f3f803 | + | -rw-r--r--. 1 root root 480 Jan 16 2024 alsa-restore.service |
- | Superblock backups stored on blocks: | + | -rw-r--r--. 1 root root 465 Jan 16 2024 alsa-state.service |
- | 8193, 24577, 40961, 57345, 73729 | + | -rw-r--r--. 1 root root 275 Aug 10 2021 arp-ethers.service |
- | + | -rw-r--r--. 1 root root 274 Apr 4 2022 atd.service | |
- | Allocating group tables: done | + | -rw-r--r--. 1 root root 1771 Nov 8 2023 auditd.service |
- | Writing inode tables: done | + | lrwxrwxrwx. 1 root root 14 Jul 18 13:00 autovt@.service -> getty@.service |
- | Creating journal (4096 blocks): done | + | -rw-r--r--. 1 root root 1044 Nov 8 2023 avahi-daemon.service |
- | Writing superblocks and filesystem accounting information: done | + | -rw-r--r--. 1 root root 870 Nov 8 2023 avahi-daemon.socket |
+ | -rw-r--r--. 1 root root 224 Oct 23 14:00 bar.service | ||
+ | -rw-r--r--. 1 root root 964 Jul 18 13:00 basic.target | ||
+ | drwxr-xr-x. 2 root root | ||
+ | -r--r--r--. 1 root root 384 Feb 3 2024 blk-availability.service | ||
+ | -rw-r--r--. 1 root root 449 Oct 31 2022 blockdev@.target | ||
+ | -rw-r--r--. 1 root root 707 Jun 14 2022 bluetooth.service | ||
+ | -rw-r--r--. 1 root root 435 Oct 31 2022 bluetooth.target | ||
+ | -rw-r--r--. 1 root root 642 Jan 16 2023 bolt.service | ||
+ | -rw-r--r--. 1 root root 463 Oct 31 2022 boot-complete.target | ||
+ | -rw-r--r--. 1 root root 217 Aug 9 2021 brltty.service | ||
+ | -rw-r--r--. 1 root root 491 Jul 13 2023 canberra-system-bootup.service | ||
+ | -rw-r--r--. 1 root root 509 Jul 13 2023 canberra-system-shutdown-reboot.service | ||
+ | -rw-r--r--. 1 root root 466 Jul 13 2023 canberra-system-shutdown.service | ||
+ | -rw-r--r--. 1 root root 1811 Jan 23 2024 chronyd-restricted.service | ||
+ | -rw-r--r--. 1 root root 1468 Jan 23 2024 chronyd.service | ||
+ | -rw-r--r--. 1 root root 1082 Jan 23 2024 chrony-wait.service | ||
+ | -rw-r--r--. 1 root root 277 Jul 23 09:37 cni-dhcp.service | ||
+ | -rw-r--r--. 1 root root 302 Dec 4 2023 cni-dhcp.socket | ||
+ | -rw-r--r--. 1 root root 222 Apr 2 2024 cockpit-motd.service | ||
+ | -rw-r--r--. 1 root root 720 Apr 2 2024 cockpit.service | ||
+ | -rw-r--r--. 1 root root 349 Apr 2 2024 cockpit.socket | ||
+ | -rw-r--r--. 1 root root 221 Apr 2 2024 cockpit-wsinstance-http.service | ||
+ | -rw-r--r--. 1 root root 165 Apr 2 2024 cockpit-wsinstance-https-factory@.service | ||
+ | -rw-r--r--. 1 root root 244 Apr 2 2024 cockpit-wsinstance-https-factory.socket | ||
+ | -rw-r--r--. 1 root root 215 Apr 2 2024 cockpit-wsinstance-http.socket | ||
+ | -rw-r--r--. 1 root root 264 Apr 2 2024 cockpit-wsinstance-https@.service | ||
+ | -rw-r--r--. 1 root root 478 Apr 2 2024 cockpit-wsinstance-https@.socket | ||
+ | -rw-r--r--. 1 root root 295 Aug 9 2021 colord.service | ||
+ | -rw-r--r--. 1 root root 154 Aug 11 2021 configure-printer@.service | ||
+ | -rw-r--r--. 1 root root 1102 Jul 18 13:00 console-getty.service | ||
+ | -rw-r--r--. 1 root root 1254 Jul 18 13:00 container-getty@.service | ||
+ | -rw-r--r--. 1 root root 294 Sep 13 18:49 cpupower.service | ||
+ | -rw-r--r--. 1 root root 371 Nov 30 2023 crond.service | ||
+ | -rw-r--r--. 1 root root 473 Oct 31 2022 cryptsetup-pre.target | ||
+ | -rw-r--r--. 1 root root 420 Oct 31 2022 cryptsetup.target | ||
+ | lrwxrwxrwx. 1 root root 13 Jul 18 13:00 ctrl-alt-del.target -> reboot.target | ||
+ | -rw-r--r--. 1 root root 234 Jan 7 2021 cups-browsed.service | ||
+ | -rw-r--r--. 1 root root 142 Jun 19 11:00 cups.path | ||
+ | -rw-r--r--. 1 root root 298 Jun 19 11:00 cups.service | ||
+ | drwxr-xr-x. 2 root root 25 Sep 25 12:03 cups.service.d | ||
+ | -rw-r--r--. 1 root root 148 Jun 19 11:00 cups.socket | ||
+ | -rw-r--r--. 1 root root 529 Aug 23 2022 dbus-broker.service | ||
+ | -rw-r--r--. 1 root root 560 Jun 12 2023 dbus-daemon.service | ||
+ | lrwxrwxrwx. 1 root root 25 Jul 18 13:00 dbus-org.freedesktop.hostname1.service -> systemd-hostnamed.service | ||
+ | lrwxrwxrwx. 1 root root 23 Jul 18 13:00 dbus-org.freedesktop.locale1.service -> systemd-localed.service | ||
+ | --More-- | ||
</ | </ | ||
- | Les options | + | Certains fichiers |
< | < | ||
- | [root@centos8 ~]# mke2fs --help | + | [root@redhat9 tmp]# ls -l / |
- | mke2fs: invalid option -- ' | + | total 0 |
- | Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size] | + | |
- | [-i bytes-per-inode] [-I inode-size] [-J journal-options] | + | |
- | [-G flex-group-size] [-N number-of-inodes] [-d root-directory] | + | |
- | [-m reserved-blocks-percentage] [-o creator-os] | + | |
- | [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] | + | |
- | [-O feature[, | + | |
- | [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] | + | |
- | [-jnqvDFSV] device [blocks-count] | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | Les fichiers |
- | **Important** : Lors de la mise en place d'un filesystem ext2/ | + | |
- | </WRAP> | + | |
- | + | ||
- | ===LAB #11 - Convertir un Système de Fichiers Ext3 en Ext2=== | + | |
- | + | ||
- | Pour vérifier si un système de fichiers Ext2 est journalisé, | + | |
< | < | ||
- | [root@centos8 ~]# dumpe2fs | + | [root@redhat9 tmp]# pkg-config systemd |
- | dumpe2fs 1.45.6 (20-Mar-2020) | + | /usr/ |
- | Filesystem volume name: < | + | |
- | Last mounted on: <not available> | + | |
- | Filesystem UUID: a2515f45-a32a-4e87-b7e6-170448f3f803 | + | |
- | Filesystem magic number: | + | |
- | Filesystem revision #: 1 (dynamic) | + | |
- | Filesystem features: | + | |
- | Filesystem flags: | + | |
- | Default mount options: | + | |
- | Filesystem state: | + | |
- | Errors behavior: | + | |
- | Filesystem OS type: | + | |
- | Inode count: | + | |
- | Block count: | + | |
- | Reserved block count: | + | |
- | Free blocks: | + | |
- | Free inodes: | + | |
- | First block: | + | |
- | Block size: | + | |
- | Fragment size: 1024 | + | |
- | Reserved GDT blocks: | + | |
- | Blocks per group: | + | |
- | Fragments per group: | + | |
- | Inodes per group: | + | |
- | Inode blocks per group: | + | |
- | Filesystem created: | + | |
- | Last mount time: n/a | + | |
- | Last write time: Wed Jun 2 07:55:24 2021 | + | |
- | Mount count: | + | |
- | Maximum mount count: | + | |
- | Last checked: | + | |
- | Check interval: | + | |
- | Reserved blocks uid: 0 (user root) | + | |
- | Reserved blocks gid: 0 (group root) | + | |
- | First inode: | + | |
- | Inode size: | + | |
- | Journal inode: | + | |
- | Default directory hash: | + | |
- | Directory Hash Seed: faee0b81-0538-4c06-8d86-468bc0c760ac | + | |
- | Journal backup: | + | |
- | Journal features: | + | |
- | Journal size: | + | |
- | Journal length: | + | |
- | Journal sequence: | + | |
- | Journal start: | + | |
</ | </ | ||
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** : Le drapeau | + | **Important** : De cette façon les fichiers dans **/ |
</ | </ | ||
- | Les options de cette commande sont : | + | Prenons le cas du service **sshd** qui est configuré par le fichier **/ |
< | < | ||
- | [root@centos8 ~]# dumpe2fs --help | + | [root@redhat9 tmp]# cat / |
- | dumpe2fs 1.45.6 | + | [Unit] |
- | dumpe2fs: invalid option | + | Description=OpenSSH server daemon |
- | Usage: dumpe2fs [-bfghimxV] [-o superblock=< | + | Documentation=man: |
- | </ | + | After=network.target sshd-keygen.target |
+ | Wants=sshd-keygen.target | ||
- | Pour supprimer le journal du système de fichier Ext3 sur cette partition, il convient d' | + | [Service] |
+ | Type=notify | ||
+ | EnvironmentFile=-/ | ||
+ | ExecStart=/ | ||
+ | ExecReload=/ | ||
+ | KillMode=process | ||
+ | Restart=on-failure | ||
+ | RestartSec=42s | ||
- | < | + | [Install] |
- | [root@centos8 ~]# tune2fs | + | WantedBy=multi-user.target |
- | tune2fs 1.45.6 (20-Mar-2020) | + | |
</ | </ | ||
- | Les options de cette commande sont : | + | Dans le fichier on peut noter la présence des lignes suivantes dans la section **[Unit]** |
- | < | + | * **Description=OpenSSH server daemon**, |
- | [root@centos8 ~]# tune2fs --help | + | * Cette directive est utilisée pour donner une courte description des fonctionnalités de l' |
- | tune2fs 1.45.6 | + | * **Documentation=man: |
- | tune2fs: invalid option -- '-' | + | * Cette directive stipule les chapitres des manuels et les URLs contenant de l'information en relation avec l'Unité, |
- | Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group] | + | * **After=network.target sshd-keygen.target**, |
- | [-i interval[d|m|w]] [-j] [-J journal_options] [-l] | + | * Cette directive indique les cibles qui devraient être atteintes et les Unités qui devraient être démarrées avant l' |
- | [-m reserved_blocks_percent] [-o [^]mount_options[,...]] | + | * **Wants=sshd-keygen.target**, |
- | [-r reserved_blocks_count] [-u user] [-C mount_count] | + | * Cette directive stipule une dépendance douce. Autrement dit, Systemd essayera de démarrer l' |
- | [-L volume_label] [-M last_mounted_dir] | + | |
- | [-O [^]feature[, | + | |
- | [-E extended-option[,...]] [-T last_check_time] [-U UUID] | + | |
- | [-I new_inode_size] [-z undo_file] device | + | |
- | </ | + | |
- | Constatez | + | Dans le fichier on peut aussi noter la présence des lignes suivantes dans la section **[Service]** |
- | < | + | * **Type=notify**, |
- | [root@centos8 ~]# dumpe2fs -h /dev/sdb12 | + | * Cette directive indique que le service informera Systemd quand son démarrage a terminé, |
- | dumpe2fs 1.45.6 (20-Mar-2020) | + | * **ExecStart=/usr/sbin/ |
- | Filesystem volume name: < | + | * Cette directive définit l' |
- | Last mounted on: <not available> | + | * **ExecReload=/ |
- | Filesystem UUID: a2515f45-a32a-4e87-b7e6-170448f3f803 | + | |
- | Filesystem magic number: | + | * **KillMode=process**, |
- | Filesystem revision #: 1 (dynamic) | + | |
- | Filesystem features: | + | |
- | Filesystem flags: | + | * Cette ligne indique que le service doit être re-démarré en cas d' |
- | Default mount options: | + | * **RestartSec=42s**, |
- | Filesystem state: | + | * Cette directive stipule le temps d' |
- | Errors behavior: | + | |
- | Filesystem OS type: | + | |
- | Inode count: | + | |
- | Block count: | + | |
- | Reserved block count: | + | |
- | Free blocks: | + | |
- | Free inodes: | + | |
- | First block: | + | |
- | Block size: | + | |
- | Fragment size: 1024 | + | |
- | Reserved GDT blocks: | + | |
- | Blocks per group: | + | |
- | Fragments per group: | + | |
- | Inodes per group: | + | |
- | Inode blocks per group: | + | |
- | Filesystem created: | + | |
- | Last mount time: n/a | + | |
- | Last write time: Wed Jun 2 07:59:01 2021 | + | |
- | Mount count: | + | |
- | Maximum mount count: | + | |
- | Last checked: | + | |
- | Check interval: | + | |
- | Reserved blocks uid: 0 (user root) | + | |
- | Reserved blocks gid: 0 (group root) | + | |
- | First inode: | + | |
- | Inode size: | + | |
- | Default directory hash: | + | |
- | Directory Hash Seed: faee0b81-0538-4c06-8d86-468bc0c760ac | + | |
- | Journal backup: | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | Dernièrement on note la présence de la ligne suivante dans la section |
- | **Important** : Notez que le drapeau **Filesystem features: | + | |
- | </ | + | |
- | Supprimez maintenant l' | + | * **WantedBy=multi-user.target**, |
- | + | * Cette directive indique la Cible dans laquelle le service doit être démarré. La présence de cette directive crée un lien symbolique dans le répertoire **/etc/systemd/system/multi-user.target.wants** qui pointe vers ce fichier. | |
- | < | + | |
- | [root@centos8 ~]# fsck / | + | |
- | fsck from util-linux 2.32.1 | + | |
- | e2fsck 1.45.6 (20-Mar-2020) | + | |
- | /dev/sdb12: clean, 11/51200 files, 8013/204800 blocks | + | |
- | </ | + | |
- | Créez maintenant un point de montage pour / | + | Pour consulter **l' |
< | < | ||
- | [root@centos8 ~]# mkdir /mnt/sdb12 | + | [root@redhat9 tmp]# systemctl show sshd |
+ | Type=notify | ||
+ | ExitType=main | ||
+ | Restart=on-failure | ||
+ | NotifyAccess=main | ||
+ | RestartUSec=42s | ||
+ | TimeoutStartUSec=1min 30s | ||
+ | TimeoutStopUSec=1min 30s | ||
+ | TimeoutAbortUSec=1min 30s | ||
+ | TimeoutStartFailureMode=terminate | ||
+ | TimeoutStopFailureMode=terminate | ||
+ | RuntimeMaxUSec=infinity | ||
+ | RuntimeRandomizedExtraUSec=0 | ||
+ | WatchdogUSec=0 | ||
+ | WatchdogTimestampMonotonic=0 | ||
+ | RootDirectoryStartOnly=no | ||
+ | RemainAfterExit=no | ||
+ | GuessMainPID=yes | ||
+ | MainPID=1175 | ||
+ | ControlPID=0 | ||
+ | FileDescriptorStoreMax=0 | ||
+ | NFileDescriptorStore=0 | ||
+ | StatusErrno=0 | ||
+ | Result=success | ||
+ | ReloadResult=success | ||
+ | CleanResult=success | ||
+ | UID=[not set] | ||
+ | GID=[not set] | ||
+ | NRestarts=0 | ||
+ | OOMPolicy=stop | ||
+ | ReloadSignal=1 | ||
+ | ExecMainStartTimestamp=Thu 2024-10-24 09:29:16 CEST | ||
+ | ExecMainStartTimestampMonotonic=38779836 | ||
+ | ExecMainExitTimestampMonotonic=0 | ||
+ | ExecMainPID=1175 | ||
+ | ExecMainCode=0 | ||
+ | ExecMainStatus=0 | ||
+ | ExecStart={ path=/usr/sbin/sshd ; argv[]=/ | ||
+ | ExecStartEx={ path=/ | ||
+ | ExecReload={ path=/ | ||
+ | ExecReloadEx={ path=/ | ||
+ | Slice=system.slice | ||
+ | ControlGroup=/ | ||
+ | ControlGroupId=4041 | ||
+ | MemoryCurrent=5337088 | ||
+ | MemoryAvailable=infinity | ||
+ | CPUUsageNSec=63348000 | ||
+ | TasksCurrent=1 | ||
+ | IPIngressBytes=[no data] | ||
+ | IPIngressPackets=[no data] | ||
+ | IPEgressBytes=[no data] | ||
+ | IPEgressPackets=[no data] | ||
+ | IOReadBytes=18446744073709551615 | ||
+ | IOReadOperations=18446744073709551615 | ||
+ | IOWriteBytes=18446744073709551615 | ||
+ | IOWriteOperations=18446744073709551615 | ||
+ | lines 1-55 | ||
</ | </ | ||
- | Essayez de monter /dev/sdb12 en tant que système de fichiers Ext3. Vous obtiendrez un résultat similaire à celui-ci : | + | Pour consulter la liste des dépendances d'une Unité, il convient d' |
< | < | ||
- | [root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 | + | [root@redhat9 tmp]# systemctl list-dependencies sshd.service |
- | mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error. | + | sshd.service |
+ | ● ├─system.slice | ||
+ | ● ├─sshd-keygen.target | ||
+ | ○ │ ├─sshd-keygen@ecdsa.service | ||
+ | ○ │ ├─sshd-keygen@ed25519.service | ||
+ | ○ │ └─sshd-keygen@rsa.service | ||
+ | ● └─sysinit.target | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ○ | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ○ | ||
+ | ○ | ||
+ | ● | ||
+ | ○ | ||
+ | ○ | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ○ | ||
+ | ○ | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ● | ||
+ | ○ | ||
+ | ● | ||
+ | ● | ||
+ | ● │ └─systemd-cryptsetup@sdb12.service | ||
+ | ● | ||
+ | ● | ||
+ | lines 1-55 | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | ===2.2 - Surchargement des Fichiers de Configuration par Défaut=== |
- | **Important** : Notez l' | + | |
- | </ | + | |
- | Montez maintenant le système | + | Les fichiers |
< | < | ||
- | [root@centos8 ~]# mount -t ext2 /dev/sdb12 /mnt/sdb12 | + | [root@redhat9 tmp]# pkg-config systemd --variable=systemdsystemunitpath |
+ | / | ||
</ | </ | ||
- | |||
- | ===LAB #12 - Convertir un Système de Fichiers Ext2 en Ext3=== | ||
- | |||
- | Pour replacer le journal sur /dev/sdb12, il convient d' | ||
< | < | ||
- | [root@centos8 ~]# umount | + | [root@redhat9 tmp]# ls -l /etc/systemd/system |
- | + | total 8 | |
- | [root@centos8 ~]# tune2fs | + | drwxr-xr-x. 2 root root 65 Oct 19 2023 basic.target.wants |
- | tune2fs | + | drwxr-xr-x. 2 root root 31 Oct 19 2023 bluetooth.target.wants |
- | Creating journal inode: done | + | lrwxrwxrwx. 1 root root 37 Oct 19 2023 ctrl-alt-del.target -> /usr/lib/ |
+ | lrwxrwxrwx. | ||
+ | lrwxrwxrwx. 1 root root 41 Oct 19 2023 dbus-org.fedoraproject.FirewallD1.service -> / | ||
+ | lrwxrwxrwx. 1 root root 44 Oct 19 2023 dbus-org.freedesktop.Avahi.service -> / | ||
+ | lrwxrwxrwx. 1 root root 44 Oct 19 2023 dbus-org.freedesktop.ModemManager1.service -> / | ||
+ | lrwxrwxrwx. 1 root root 57 Oct 19 2023 dbus-org.freedesktop.nm-dispatcher.service -> / | ||
+ | lrwxrwxrwx. 1 root root 43 Oct 19 2023 dbus.service -> / | ||
+ | lrwxrwxrwx. 1 root root 40 Oct 19 2023 default.target -> / | ||
+ | drwxr-xr-x. 2 root root 45 Oct 19 2023 default.target.wants | ||
+ | drwxr-xr-x. 2 root root 38 Oct 19 2023 ' | ||
+ | lrwxrwxrwx. 1 root root 35 Oct 19 2023 display-manager.service -> / | ||
+ | drwxr-xr-x. 2 root root 32 Oct 19 2023 getty.target.wants | ||
+ | drwxr-xr-x. 2 root root 181 Oct 19 2023 graphical.target.wants | ||
+ | drwxr-xr-x. 2 root root 36 Oct 19 2023 local-fs.target.wants | ||
+ | drwxr-xr-x. 2 root root 4096 Oct 24 08:02 multi-user.target.wants | ||
+ | drwxr-xr-x. 2 root root 48 Oct 19 2023 network-online.target.wants | ||
+ | drwxr-xr-x. 2 root root 26 Oct 19 2023 printer.target.wants | ||
+ | drwxr-xr-x. 2 root root 27 Oct 19 2023 remote-fs.target.wants | ||
+ | drwxr-xr-x. 2 root root 186 Oct 19 2023 sockets.target.wants | ||
+ | drwxr-xr-x. 2 root root 4096 Sep 25 12:08 sysinit.target.wants | ||
+ | drwxr-xr-x. 2 root root 27 Oct 23 13:09 sysstat-collect.timer.d | ||
+ | drwxr-xr-x. 2 root root 64 Oct 23 12:58 sysstat.service.wants | ||
+ | drwxr-xr-x. 2 root root 27 Oct 21 16:32 systemd-tmpfiles-clean.timer.d | ||
+ | drwxr-xr-x. 2 root root 86 Oct 19 2023 timers.target.wants | ||
+ | drwxr-xr-x. 2 root root 29 Oct 19 2023 vmtoolsd.service.requires | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | ====LAB #3 - La Commande systemd-analyze==== |
- | **Important** : Notez que vous avez du démonter la partition avant d' | + | |
- | </ | + | |
- | ===LAB #13 - Placer le Journal sur un autre Partition=== | + | Pour avoir une évaluation du temps de démarrage, il convient |
- | + | ||
- | Le journal | + | |
- | + | ||
- | Créez un système de fichiers sur / | + | |
< | < | ||
- | [root@centos8 ~]# mke2fs | + | [root@redhat9 tmp]# systemd-analyze |
- | mke2fs | + | Startup finished in 1.361s (kernel) + 4.348s (initrd) + 1min 21.082s (userspace) = 1min 26.792s |
- | Creating filesystem with 512000 1k blocks and 0 inodes | + | graphical.target reached after 53.162s in userspace. |
- | Filesystem UUID: 23327281-e88a-4da0-bafa-50ee10c52937 | + | |
- | Superblock backups stored on blocks: | + | |
- | + | ||
- | Zeroing journal device: | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | L' |
- | **Important** : Notez l' | + | |
- | </ | + | |
- | + | ||
- | Créez maintenant un système | + | |
< | < | ||
- | [root@centos8 ~]# mke2fs | + | [root@redhat9 tmp]# systemd-analyze blame |
- | mke2fs 1.45.6 (20-Mar-2020) | + | 44.601s kdump.service |
- | Using journal | + | 18.590s systemd-cryptsetup@sdb12.service |
- | /dev/sdb12 contains a ext3 file system | + | 16.592s plymouth-quit-wait.service |
- | last mounted on Wed Jun 2 08:03:11 2021 | + | |
- | Proceed anyway? (y,N) y | + | |
- | Creating filesystem with 204800 1k blocks and 51200 inodes | + | |
- | Filesystem UUID: 0e783411-6407-4cba-8db5-0e2729000c9e | + | |
- | Superblock backups stored on blocks: | + | 9.801s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart8.device |
- | 8193, 24577, 40961, 57345, 73729 | + | |
- | + | 9.800s sys-devices-pci0000: | |
- | Allocating group tables: done | + | |
- | Writing inode tables: done | + | 9.800s |
- | Adding journal to device | + | 9.800s dev-disk-by\x2dpath-pci\x2d0000:00:07.0\x2data\x2d1\x2dpart10.device |
- | Writing superblocks and filesystem accounting information: done | + | 9.800s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart10.device |
+ | 9.800s dev-disk-by\x2dpartuuid-23a56c2e\x2d0a.device | ||
+ | 9.800s sys-devices-pci0000:00-0000: | ||
+ | 9.800s dev-sdb5.device | ||
+ | | ||
+ | 9.800s dev-disk-by\x2did-ata\x2dQEMU_HARDDISK_QM00005\x2dpart5.device | ||
+ | 9.800s dev-disk-by\x2dpath-pci\x2d0000: | ||
+ | 9.799s dev-disk-by\x2dpartuuid-23a56c2e\x2d05.device | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 9.717s sys-subsystem-net-devices-ens18.device | ||
+ | | ||
+ | | ||
+ | | ||
+ | 9.680s dev-disk-by\x2dpartuuid-23a56c2e\x2d06.device | ||
+ | | ||
+ | 9.680s dev-sdb6.device | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | lines 1-55 | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | L' |
- | **Important** : Notez que le journal a été placé sur /dev/sdb11 graĉe à l' | + | |
- | </ | + | |
- | + | ||
- | ===LAB #14 - Modifier la Fréquence | + | |
- | + | ||
- | Pour modifier | + | |
< | < | ||
- | [root@centos8 ~]# tune2fs | + | [root@redhat9 tmp]# systemd-analyze critical-chain sshd.service |
- | tune2fs 1.45.6 (20-Mar-2020) | + | The time when unit became active or started is printed after the " |
- | Setting interval between checks | + | The time the unit took to start is printed after the " |
- | </ | + | |
- | Dernièrement, | + | sshd.service +348ms |
- | + | └─network.target @33.014s | |
- | < | + | |
- | [root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID | + | |
- | dumpe2fs | + | |
- | Filesystem UUID: 0e783411-6407-4cba-8db5-0e2729000c9e | + | └─dbus.socket @26.682s |
- | Journal UUID: | + | └─sysinit.target @26.678s |
+ | └─systemd-update-utmp.service @26.658s +19ms | ||
+ | | ||
+ | └─systemd-tmpfiles-setup.service @25.954s +313ms | ||
+ | └─local-fs.target @25.942s | ||
+ | └─run-user-1000.mount @1min 19.309s | ||
+ | | ||
+ | └─systemd-tmpfiles-setup-dev.service @3.994s +1.040s | ||
+ | └─kmod-static-nodes.service @3.795s +53ms | ||
+ | └─systemd-journald.socket | ||
+ | └─system.slice | ||
+ | └─-.slice | ||
</ | </ | ||
- | ====Ext4==== | + | Les options |
- | + | ||
- | 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' | + | |
- | * l' | + | |
- | + | ||
- | L' | + | |
- | + | ||
- | 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' | + | |
- | + | ||
- | Pour plus d' | + | |
- | + | ||
- | ===LAB #15 - Créer un Système de Fichiers Ext4=== | + | |
- | + | ||
- | Créez un système de fichiers Ext4 sur **/ | + | |
< | < | ||
- | [root@centos8 ~]# mkfs.ext4 / | + | [root@redhat9 tmp]# systemd-analyze |
- | mke2fs 1.45.6 (20-Mar-2020) | + | systemd-analyze [OPTIONS...] COMMAND ... |
- | /dev/sdb11 contains a jbd file system | + | |
- | Proceed anyway? (y,N) y | + | |
- | Creating filesystem with 512000 1k blocks and 128016 inodes | + | |
- | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | + | |
- | Superblock backups stored on blocks: | + | |
- | 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 | + | |
- | Allocating group tables: done | + | Profile systemd, show unit dependencies, |
- | Writing inode tables: done | + | |
- | Creating journal (8192 blocks): done | + | |
- | Writing superblocks and filesystem accounting information: | + | |
- | </ | + | |
- | Les options de cette commande sont : | + | Commands: |
+ | [time] | ||
+ | blame Print list of running units ordered by | ||
+ | time to init | ||
+ | critical-chain [UNIT...] | ||
+ | of units | ||
+ | plot | ||
+ | | ||
+ | dot [UNIT...] | ||
+ | dump [PATTERN...] | ||
+ | | ||
+ | cat-config | ||
+ | unit-files | ||
+ | unit-paths | ||
+ | exit-status [STATUS...] | ||
+ | capability [CAP...] | ||
+ | syscall-filter [NAME...] | ||
+ | filesystems [NAME...] | ||
+ | condition CONDITION... | ||
+ | compare-versions VERSION1 [OP] VERSION2 | ||
+ | | ||
+ | verify FILE... | ||
+ | calendar SPEC... | ||
+ | | ||
+ | timestamp TIMESTAMP... | ||
+ | timespan SPAN... | ||
+ | security [UNIT...] | ||
+ | inspect-elf FILE... | ||
- | < | + | Options: |
- | [root@centos8 ~]# mkfs.ext4 | + | |
- | 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] | + | --security-policy=PATH |
- | [-m reserved-blocks-percentage] [-o creator-os] | + | of built-in one |
- | [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] | + | |
- | [-O feature[, | + | |
- | [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] | + | --no-pager Do not pipe output into a pager |
- | [-jnqvDFSV] device [blocks-count] | + | |
- | </ | + | with either |
- | + | --system | |
- | Consultez maintenant les caractéristiques du système de fichier : | + | --user Operate on user systemd instance |
- | + | | |
- | < | + | |
- | [root@centos8 ~]# dumpe2fs /dev/sdb11 | more | + | -M --machine=CONTAINER |
- | dumpe2fs 1.45.6 (20-Mar-2020) | + | --order Show only order in the graph |
- | Filesystem volume name: < | + | --require |
- | Last mounted on: <not available> | + | |
- | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | + | |
- | Filesystem magic number: | + | --fuzz=SECONDS |
- | Filesystem revision #: 1 (dynamic) | + | lines 1-55 |
- | Filesystem features: | + | |
- | xtent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize meta | + | |
- | data_csum | + | |
- | Filesystem flags: | + | |
- | Default mount options: | + | |
- | Filesystem state: | + | |
- | Errors behavior: | + | |
- | Filesystem OS type: | + | |
- | Inode count: | + | |
- | Block count: | + | |
- | Reserved block count: | + | |
- | Free blocks: | + | |
- | Free inodes: | + | |
- | First block: | + | |
- | Block size: | + | |
- | Fragment size: 1024 | + | |
- | Group descriptor size: 64 | + | |
- | Reserved GDT blocks: | + | |
- | --More-- | + | |
</ | </ | ||
- | ===LAB #16 - Ajouter une Etiquette au Système de Fichiers Ext4=== | + | ====LAB #4 - Les Cibles Systemd==== |
- | Utilisez la commande **e2label** pour associer une étiquette au système | + | Chaque Cible est décrite par un fichier |
< | < | ||
- | [root@centos8 ~]# e2label | + | [root@redhat9 tmp]# cat /usr/lib/systemd/system/ |
- | [root@centos8 ~]# dumpe2fs | + | # SPDX-License-Identifier: LGPL-2.1-or-later |
- | dumpe2fs 1.45.6 (20-Mar-2020) | + | # |
- | Filesystem volume name: | + | # This file is part of systemd. |
- | Last mounted on: <not available> | + | # |
- | Filesystem UUID: | + | # systemd is free software; you can redistribute it and/or modify it |
- | Filesystem magic number: | + | # under the terms of the GNU Lesser General Public License as published by |
- | Filesystem revision | + | # the Free Software Foundation; either version 2.1 of the License, or |
- | Filesystem features: | + | # (at your option) any later version. |
- | xtent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize meta | + | |
- | data_csum | + | |
- | Filesystem flags: | + | |
- | Default mount options: | + | |
- | Filesystem state: | + | |
- | Errors behavior: | + | |
- | Filesystem OS type: | + | |
- | Inode count: | + | |
- | Block count: | + | |
- | Reserved block count: | + | |
- | Free blocks: | + | |
- | Free inodes: | + | |
- | First block: | + | |
- | Block size: | + | |
- | Fragment size: 1024 | + | |
- | Group descriptor size: 64 | + | |
- | Reserved GDT blocks: | + | |
- | --More-- | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | [Unit] |
- | **Important** - Notez que l' | + | Description=Graphical Interface |
- | </ | + | Documentation=man:systemd.special(7) |
- | + | Requires=multi-user.target | |
- | Créez un point de montage dans **/mnt** et essayez de monter **/ | + | Wants=display-manager.service |
- | + | Conflicts=rescue.service rescue.target | |
- | < | + | After=multi-user.target rescue.service rescue.target display-manager.service |
- | [root@centos8 ~]# mkdir /mnt/sdb11 | + | AllowIsolate=yes |
- | + | ||
- | [root@centos8 ~]# mount -t ext3 /dev/sdb11 / | + | |
- | mount: /mnt/sdb11: wrong fs type, bad option, bad superblock on /dev/sdb11, missing codepage or helper program, or other error.. | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | Dans ce fichier on peut noter la présence des lignes suivantes : |
- | **Important** - Notez l' | + | |
- | </ | + | |
- | Montez de nouveau la partition | + | |
+ | * 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' | ||
+ | * **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é. | ||
- | < | + | ===4.1 - Contrôler les dépendances d'une Cible=== |
- | [root@centos8 ~]# mount /dev/sdb11 /mnt/sdb11 | + | |
- | [root@centos8 ~]# mount | grep sdb11 | + | Les dépendances d'une Cible peuvent être consultées en utilisant la commande |
- | /dev/sdb11 on /mnt/sdb11 type ext4 (rw, | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | **Important** - Constatez que la partition a été monté en tant qu' | + | |
- | </ | + | |
- | + | ||
- | ===LAB #17 - Convertir un Système de Fichiers Ext3 en Ext4=== | + | |
- | + | ||
- | Créez un système de fichiers ext3 sur / | + | |
< | < | ||
- | [root@centos8 ~]# mkfs.ext3 /dev/sdb12 | + | [root@redhat9 tmp]# systemctl list-dependencies multi-user.target |
- | mke2fs 1.45.6 (20-Mar-2020) | + | multi-user.target |
- | /dev/sdb12 contains a ext3 file system | + | ● ├─atd.service |
- | created on Wed Jun 2 08:10:40 2021 | + | ● ├─auditd.service |
- | Proceed anyway? (y,N) y | + | ● ├─avahi-daemon.service |
- | Creating filesystem with 204800 1k blocks and 51200 inodes | + | ● ├─bar.service |
- | Filesystem UUID: b73322d4-f2e4-43bc-96ae-422d4584f3de | + | ● ├─crond.service |
- | Superblock backups stored on blocks: | + | ● ├─cups.path |
- | 8193, 24577, 40961, 57345, 73729 | + | ● ├─cups.service |
- | + | ● ├─firewalld.service | |
- | Allocating group tables: done | + | ● ├─foo.service |
- | Writing inode tables: done | + | ● ├─httpd.service |
- | Creating journal (4096 blocks): done | + | ○ ├─insights-client-boot.service |
- | Writing superblocks and filesystem accounting information: | + | ● ├─irqbalance.service |
+ | ● ├─kdump.service | ||
+ | ● ├─libstoragemgmt.service | ||
+ | ● ├─mcelog.service | ||
+ | ● ├─mdmonitor.service | ||
+ | ● ├─ModemManager.service | ||
+ | ● ├─NetworkManager.service | ||
+ | ○ ├─ostree-readonly-sysroot-migration.service | ||
+ | ● ├─plymouth-quit-wait.service | ||
+ | ○ ├─plymouth-quit.service | ||
+ | ● ├─psacct.service | ||
+ | ● ├─rhsmcertd.service | ||
+ | ● ├─rsyslog.service | ||
+ | ○ ├─smartd.service | ||
+ | ● ├─sshd.service | ||
+ | ○ ├─sssd.service | ||
+ | ● ├─sysstat.service | ||
+ | ● ├─systemd-ask-password-wall.path | ||
+ | ● ├─systemd-logind.service | ||
+ | ○ ├─systemd-update-utmp-runlevel.service | ||
+ | ● ├─systemd-user-sessions.service | ||
+ | ○ ├─vmtoolsd.service | ||
+ | ● ├─basic.target | ||
+ | ● │ ├─-.mount | ||
+ | ○ │ ├─low-memory-monitor.service | ||
+ | ○ │ ├─microcode.service | ||
+ | ● │ ├─paths.target | ||
+ | ● │ ├─slices.target | ||
+ | ● │ │ ├─-.slice | ||
+ | ● │ │ └─system.slice | ||
+ | ● │ ├─sockets.target | ||
+ | ● │ │ ├─avahi-daemon.socket | ||
+ | ● │ │ ├─cups.socket | ||
+ | ● │ │ ├─dbus.socket | ||
+ | ● │ │ ├─dm-event.socket | ||
+ | ● │ │ ├─iscsid.socket | ||
+ | ● │ │ ├─iscsiuio.socket | ||
+ | ○ │ │ ├─multipathd.socket | ||
+ | ● │ │ ├─sssd-kcm.socket | ||
+ | ● │ │ ├─systemd-coredump.socket | ||
+ | ● │ │ ├─systemd-initctl.socket | ||
+ | ● │ │ ├─systemd-journald-dev-log.socket | ||
+ | ● │ │ ├─systemd-journald.socket | ||
+ | lines 1-55 | ||
</ | </ | ||
- | Montez maintenant **/ | + | Les points noirs au début de chaque ligne dans la sortie ci-dessus peuvent être de trois couleurs différentes |
- | < | + | * **Vert** implique que le service, la cible ou l' |
- | [root@centos8 ~]# mount /dev/sdb12 / | + | * **Blanc** implique le service, la cible ou l' |
- | + | * **Rouge** implique que le service, la cible ou l' | |
- | [root@centos8 ~]# ls -l / | + | |
- | total 12 | + | |
- | drwx------. 2 root root 12288 Jun 2 08:42 lost+found | + | |
- | </ | + | |
- | Créez le fichier | + | Pour visualiser les Unités en état d' |
< | < | ||
- | [root@centos8 ~]# touch / | + | [root@redhat9 tmp]# systemctl --failed |
+ | UNIT LOAD ACTIVE SUB DESCRIPTION | ||
+ | 0 loaded units listed. | ||
</ | </ | ||
- | Injectez | + | Les dépendances sont créés sous la forme de liens symboliques dans les répertoires |
< | < | ||
- | [root@centos8 ~]# echo "check file" | + | [root@redhat9 tmp]# ls -l / |
+ | total 0 | ||
+ | lrwxrwxrwx. 1 root root 35 Oct 19 2023 atd.service -> /usr/ | ||
+ | lrwxrwxrwx. 1 root root 38 Oct 19 2023 auditd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 44 Oct 19 2023 avahi-daemon.service -> / | ||
+ | lrwxrwxrwx. 1 root root 35 Oct 23 14:01 bar.service -> / | ||
+ | lrwxrwxrwx. 1 root root 37 Oct 19 2023 crond.service -> / | ||
+ | lrwxrwxrwx. 1 root root 33 Oct 19 2023 cups.path -> / | ||
+ | lrwxrwxrwx. 1 root root 36 Oct 19 2023 cups.service -> / | ||
+ | lrwxrwxrwx. 1 root root 41 Oct 19 2023 firewalld.service -> / | ||
+ | lrwxrwxrwx. 1 root root 35 Oct 23 13:59 foo.service -> / | ||
+ | lrwxrwxrwx. 1 root root 37 Oct 22 10:15 httpd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 52 Oct 19 2023 insights-client-boot.service -> / | ||
+ | lrwxrwxrwx. 1 root root 42 Oct 19 2023 irqbalance.service -> / | ||
+ | lrwxrwxrwx. 1 root root 37 Oct 19 2023 kdump.service -> / | ||
+ | lrwxrwxrwx. 1 root root 46 Oct 19 2023 libstoragemgmt.service -> / | ||
+ | lrwxrwxrwx. 1 root root 38 Oct 19 2023 mcelog.service -> / | ||
+ | lrwxrwxrwx. 1 root root 41 Oct 19 2023 mdmonitor.service -> / | ||
+ | lrwxrwxrwx. 1 root root 44 Oct 19 2023 ModemManager.service -> / | ||
+ | lrwxrwxrwx. 1 root root 46 Oct 19 2023 NetworkManager.service -> / | ||
+ | lrwxrwxrwx. 1 root root 38 Oct 22 15:41 psacct.service -> / | ||
+ | lrwxrwxrwx. 1 root root 40 Oct 19 2023 remote-fs.target -> / | ||
+ | lrwxrwxrwx. 1 root root 41 Oct 19 2023 rhsmcertd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 39 Oct 19 2023 rsyslog.service -> / | ||
+ | lrwxrwxrwx. 1 root root 38 Oct 19 2023 smartd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 36 Oct 19 2023 sshd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 36 Oct 19 2023 sssd.service -> / | ||
+ | lrwxrwxrwx. 1 root root 39 Oct 23 12:58 sysstat.service -> / | ||
+ | lrwxrwxrwx. 1 root root 40 Oct 19 2023 vmtoolsd.service -> / | ||
- | [root@centos8 ~]# umount | + | [root@redhat9 tmp]# ls -l /usr/lib/ |
+ | total 0 | ||
+ | lrwxrwxrwx. 1 root root 15 Jul 18 13:00 getty.target -> ../ | ||
+ | lrwxrwxrwx. 1 root root 44 May 17 18:27 ostree-readonly-sysroot-migration.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 24 Jul 14 2023 plymouth-quit.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 29 Jul 14 2023 plymouth-quit-wait.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 33 Jul 18 13:00 systemd-ask-password-wall.path -> ../ | ||
+ | lrwxrwxrwx. 1 root root 25 Jul 18 13:00 systemd-logind.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 39 Jul 18 13:00 systemd-update-utmp-runlevel.service -> ../ | ||
+ | lrwxrwxrwx. 1 root root 32 Jul 18 13:00 systemd-user-sessions.service -> ../ | ||
</ | </ | ||
- | Exécutez e2fsck sur /dev/sda12 : | + | ===4.2 - La Cible par Défaut=== |
- | < | + | ==Consulter la Cible par Défaut== |
- | [root@centos8 ~]# e2fsck / | + | |
- | e2fsck 1.45.6 (20-Mar-2020) | + | |
- | /dev/sdb12: clean, 12/51200 files, 12128/ | + | |
- | </ | + | |
- | Convertissez /dev/sdb12 en Ext4 : | + | Pour consulter la cible par défaut, il convient d' |
< | < | ||
- | [root@centos8 ~]# tune2fs | + | [root@redhat9 tmp]# systemctl get-default |
- | tune2fs 1.45.6 (20-Mar-2020) | + | graphical.target |
</ | </ | ||
- | Optimisez | + | La Cible par défaut est représentée par le lien symbolique **/ |
< | < | ||
- | [root@centos8 ~]# e2fsck | + | [root@redhat9 tmp]# ls -l /etc/systemd/ |
- | e2fsck | + | lrwxrwxrwx. |
- | 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), | + | |
</ | </ | ||
- | Essayez de monter **/ | + | ==Modifier la Cible par Défaut== |
- | < | + | Pour modifier la Cible par défaut avec une prise en compte lors du **prochain** démarrage, il convient d' |
- | [root@centos8 ~]# mount -t ext3 /dev/sdb12 / | + | |
- | mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error. | + | |
- | </ | + | |
- | + | ||
- | Montez /dev/sdb12 sans spécifier le type de fichiers Ext3 et vérifiez le contenu | + | |
< | < | ||
- | [root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12 | + | [root@redhat9 tmp]# systemctl get-default |
+ | graphical.target | ||
- | [root@centos8 ~]# ls -l /mnt/sdb12 | + | [root@redhat9 tmp]# ls -l /etc/systemd/ |
- | total 14 | + | lrwxrwxrwx. 1 root root 40 Oct 19 2023 / |
- | -rw-r--r--. 1 root root 11 Jun 2 08:45 check_file | + | |
- | drwx------. 2 root root 12288 Jun 2 08:42 lost+found | + | |
- | [root@centos8 ~]# cat /mnt/sdb12/check_file | + | [root@redhat9 tmp]# systemctl set-default multi-user.target |
- | check file | + | Removed "/etc/systemd/system/ |
- | </code> | + | Created symlink / |
- | Dernièrement, | + | [root@redhat9 tmp]# systemctl get-default |
+ | multi-user.target | ||
- | < | + | [root@redhat9 tmp]# ls -l /etc/systemd/ |
- | [root@centos8 ~]# dumpe2fs | + | lrwxrwxrwx. |
- | dumpe2fs | + | |
- | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | + | |
- | [root@centos8 ~]# dumpe2fs | + | [root@redhat9 tmp]# systemctl set-default graphical.target |
- | dumpe2fs 1.45.6 (20-Mar-2020) | + | Removed "/etc/systemd/ |
- | Filesystem UUID: b73322d4-f2e4-43bc-96ae-422d4584f3de | + | Created symlink |
- | </code> | + | |
- | ====XFS==== | + | [root@redhat9 tmp]# systemctl get-default |
+ | graphical.target | ||
- | XFS est un système de fichiers 64-bit journalisé de haute performance crée par SGI pour son système d' | + | [root@redhat9 tmp]# ls -l /etc/ |
- | + | lrwxrwxrwx. 1 root root 40 Oct 24 11:47 /etc/systemd/system/default.target | |
- | <WRAP center round important 60%> | + | |
- | **Important** : Le système de fichiers XFS permet l' | + | |
- | </ | + | |
- | + | ||
- | Pour plus d' | + | |
- | + | ||
- | ===LAB #18 - Créer un Système de Fichiers XFS=== | + | |
- | + | ||
- | Démontez **/dev/sdb12** : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# umount | + | |
</ | </ | ||
- | Créez un système de fichiers XFS sur la partition **/ | + | ==Modifier |
- | < | + | Il est possible |
- | [root@centos8 ~]# mkfs.xfs -f / | + | |
- | meta-data=/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | data | + | |
- | | + | |
- | naming | + | |
- | log =internal log | + | |
- | | + | |
- | realtime =none | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | **Important** - Notez l' | + | |
- | </ | + | |
- | + | ||
- | Les options de cette commande sont : | + | |
< | < | ||
- | [root@centos8 ~]# mkfs.xfs --help | + | [root@redhat9 tmp]# systemctl isolate rescue |
- | mkfs.xfs: invalid option -- ' | + | |
- | unknown option -- | + | |
- | Usage: mkfs.xfs | + | |
- | /* blocksize */ [-b size=num] | + | |
- | /* metadata */ [-m crc=0|1, | + | |
- | /* data subvol */ [-d agcount=n, | + | |
- | (sunit=value, | + | |
- | sectsize=num | + | |
- | /* force overwrite */ [-f] | + | |
- | /* inode size */ [-i log=n|perblock=n|size=num, | + | |
- | projid32bit=0|1, | + | |
- | /* no discard */ [-K] | + | |
- | /* log subvol */ [-l agnum=n, | + | |
- | sunit=value|su=num, | + | |
- | /* label */ [-L label (maximum 12 characters)] | + | |
- | /* naming */ [-n size=num, | + | |
- | /* no-op info only */ [-N] | + | |
- | /* prototype file */ [-p fname] | + | |
- | /* quiet */ [-q] | + | |
- | /* realtime subvol */ [-r extsize=num, | + | |
- | /* sectorsize */ [-s size=num] | + | |
- | /* version */ [-V] | + | |
- | devicename | + | |
- | < | + | |
- | <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). | + | |
- | < | + | |
- | </ | + | |
- | Consultez maintenant les caractéristiques du système de fichier : | + | [root@redhat9 tmp]# systemctl list-units --type target | egrep " |
+ | rescue.target | ||
- | < | + | [root@redhat9 tmp]# runlevel |
- | [root@centos8 ~]# xfs_info /dev/sdb12 | + | 5 1 |
- | meta-data=/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | data | + | |
- | | + | |
- | naming | + | |
- | log =internal log | + | |
- | | + | |
- | realtime =none | + | |
- | </ | + | |
- | Les options de cette commande sont : | + | [root@redhat9 tmp]# who -r |
- | + | run-level 1 2024-10-24 11:48 | |
- | < | + | |
- | [root@centos8 ~]# xfs_info | + | |
- | / | + | |
- | Usage: xfs_info [-V] [-t mtab] [mountpoint|device|file] | + | |
</ | </ | ||
- | |||
- | ===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 : | ||
< | < | ||
- | [root@centos8 ~]# xfs_admin -L my_xfs / | + | [root@redhat9 tmp]# systemctl isolate graphical |
- | xfs_admin: /dev/sdb12 contains a mounted filesystem | + | |
- | fatal error -- couldn' | + | [root@redhat9 tmp]# systemctl list-units --type target | egrep " |
+ | graphical.target | ||
- | [root@centos8 ~]# umount /dev/sdb12 | + | [root@redhat9 tmp]# runlevel |
+ | 1 5 | ||
- | [root@centos8 ~]# xfs_admin | + | [root@redhat9 tmp]# who -r |
- | writing all SBs | + | run-level 5 2024-10-24 11:50 last=1 |
- | new label = " | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | =====Arrêt du Système===== |
- | **Important** - Notez que la partition XFS doit être démonté pour pouvoir utiliser la commande **xfs_admin**. | + | |
- | </ | + | |
- | Pour voir l' | + | Sous Red Hat 9 les commandes **halt**, **poweroff**, |
< | < | ||
- | [root@centos8 ~]# xfs_admin | + | [root@redhat9 tmp]# ls -l /usr/sbin/ |
- | label = " | + | lrwxrwxrwx. 1 root root 16 Jul 18 13:00 / |
+ | lrwxrwxrwx. 1 root root 16 Jul 18 13:00 / | ||
+ | lrwxrwxrwx. 1 root root 16 Jul 18 13:00 / | ||
+ | lrwxrwxrwx. 1 root root 16 Jul 18 13:00 / | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | La manière recommendée d'utiliser ces commandes est donc : |
- | **Important** - Notez que l'étiquette doit être de 12 caractères maximum. | + | |
- | </ | + | |
- | Les options de cette commande sont : | + | * systemctl halt |
+ | * systemctl poweroff | ||
+ | * systemctl reboot | ||
+ | * systemctl shutdown | ||
- | < | + | Il est cependant toujours possibles d' |
- | [root@centos8 ~]# xfs_admin --help | + | |
- | / | + | |
- | Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device | + | |
- | </ | + | |
- | Dernièrement, | + | ====La Commande shutdown==== |
- | < | + | Lors de l' |
- | [root@centos8 ~]# xfs_admin -u / | + | |
- | UUID = 15db1b62-0866-4aa4-9ac1-3ac325a4e20f | + | |
- | </ | + | |
- | <WRAP center round important 60%> | + | * Il previent les utilisateurs, |
- | **Important** - La commande **xfs_metadump** est utilisée pour sauvegarder | + | * Il arrête tous les services, |
- | </ | + | |
+ | | ||
- | =====Autres Systèmes de Fichiers===== | + | La commande utilisée pour arrêter le système est la commande **shutdown** : |
- | <WRAP center round important 60%> | + | shutdown [-t sec] [-HPrhkc] heure [message] |
- | **Important** | + | |
- | </ | + | |
- | ====ReiserFS==== | + | ===Options de la commande=== |
- | %%ReiserFS%% permet : | + | Les options |
- | + | ||
- | * de meilleurs temps d' | + | |
- | * une plus grande efficacité pour ce qui concerne le stockage des fichiers moins de quelques ko. Le gain d' | + | |
- | + | ||
- | Pour plus d' | + | |
- | + | ||
- | ====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' | + | |
- | + | ||
- | ====Btrfs==== | + | |
- | + | ||
- | **[[https:// | + | |
- | + | ||
- | A noter sont les points suivants : | + | |
- | + | ||
- | * Btrfs utilise des extents, | + | |
- | * Btrfs stocke les données des très petits fichiers directement dans l' | + | |
- | * 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, | + | |
- | | 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' | + | |
< | < | ||
- | [root@centos8 ~]# cd /tmp | + | [root@redhat9 |
- | [root@centos8 | + | shutdown [OPTIONS...] [TIME] [WALL...] |
- | I: -input-charset not specified, using utf-8 (detected in locale settings) | + | |
- | Total translation table size: 1827 | + | |
- | Total rockridge attributes bytes: 1976 | + | |
- | Total directory bytes: 14336 | + | |
- | Path table size(bytes): | + | |
- | Max brk space used 1c000 | + | |
- | 186 extents written (0 MB) | + | |
- | </ | + | |
- | Le fichier ISO peut être monter en utilisant un périphérique de type **loop** : | + | Shut down the system. |
- | < | ||
- | [root@centos8 tmp]# mount tmp.iso /mnt -o loop | ||
- | mount: /mnt: WARNING: device write-protected, | ||
- | [root@centos8 tmp]# ls /mnt | ||
- | systemd-private-192104a9224f499286f5adb5754e9e04-chronyd.service-FI2YXs | ||
- | [root@centos8 tmp]# ls | ||
- | systemd-private-192104a9224f499286f5adb5754e9e04-chronyd.service-FI2YXs | ||
- | </ | ||
- | |||
- | Démontez maintenant le fichier ISO : | ||
- | |||
- | < | ||
- | [root@centos8 tmp]# cd ~ | ||
- | [root@centos8 ~]# umount / | ||
- | </ | ||
- | |||
- | ====Options de la Commande mkisofs==== | ||
- | |||
- | Les options de cette commande sont : | ||
- | |||
- | < | ||
- | [root@centos8 ~]# mkisofs --help | ||
- | Usage: genisoimage [options] file... | ||
Options: | Options: | ||
- | | + | --help Show this help |
- | | + | -H --halt Halt the machine |
- | -abstract FILE Set Abstract filename | + | -P --poweroff |
- | -A ID, -appid ID Set Application ID | + | -r --reboot |
- | -biblio FILE Set Bibliographic filename | + | -h |
- | -cache-inodes | + | -k Don' |
- | -no-cache-inodes | + | |
- | -check-oldnames | + | -c |
- | -check-session FILE Check all ISO9660 names from previous session | + | |
- | -copyright FILE Set Copyright filename | + | |
- | -debug | + | |
- | -b FILE, -eltorito-boot FILE | + | |
- | Set El Torito boot image name | + | |
- | -e FILE, -efi-boot FILE Set EFI boot image name | + | |
- | -eltorito-alt-boot | + | |
- | -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 | + | |
- | -dir-mode mode Make the mode of all directories | + | |
- | -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 | + | |
- | -gid gid Make the group owner of all files this gid. | + | |
- | -graft-points | + | |
- | -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 | + | |
- | -hide GLOBFILE | + | |
- | | + | |
- | -hidden GLOBFILE | + | |
- | -hidden-list FILE File with list of ISO9660 files with hidden attribute | + | |
- | -hide-joliet GLOBFILE | + | |
- | -hide-joliet-list FILE File with list of Joliet files to hide | + | |
- | -hide-joliet-trans-tbl | + | |
- | -hide-rr-moved | + | |
- | -gui Switch behaviour for GUI | + | |
- | -i ADD_FILES | + | |
- | -input-charset CHARSET | + | |
- | -output-charset CHARSET | + | |
- | -iso-level LEVEL Set ISO9660 conformance level (1..3) or 4 for ISO9660 version 2 | + | |
- | -J, -joliet | + | |
- | -joliet-long | + | |
- | -jcharset CHARSET | + | |
- | -l, -full-iso9660-filenames Allow full 31 character filenames for ISO9660 names | + | |
- | -max-iso9660-filenames | + | |
- | -allow-limited-size | + | |
- | -allow-leading-dots | + | |
- | -ldots | + | |
- | -L, -allow-leading-dots | + | |
- | -log-file 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 | + | |
- | -M FILE, -prev-session FILE Set path to previous session to merge | + | |
- | -dev SCSIdev | + | |
- | -N, -omit-version-number | + | |
- | -new-dir-mode mode Mode used when creating new directories. | + | |
- | -force-rr | + | |
- | -no-rr | + | |
- | -no-split-symlink-components | + | |
- | Inhibit splitting symlink components | + | |
- | -no-split-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 | + | |
- | -publisher PUB Set Volume publisher | + | |
- | -P PUB, -publisher PUB Set Volume publisher | + | |
- | | + | |
- | -r, -rational-rock | + | |
- | -R, -rock | + | |
- | -s TYPE, -sectype TYPE Set output sector type to e.g. data/ | + | |
- | -alpha-boot FILE Set alpha boot image name (relative to image root) | + | |
- | -hppa-cmdline CMDLINE | + | |
- | -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 | + | |
- | -jigdo-template FILE Produce a jigdo .template file as well as the .iso | + | |
- | | + | |
- | -jigdo-force-md5 PATTERN | + | |
- | -jigdo-exclude PATTERN | + | |
- | -jigdo-map PATTERN1=PATTERN2 | + | |
- | Pattern(s) | + | |
- | | + | |
- | -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 | + | |
- | | + | |
- | Specify the checksum types desired for the output jigdo template | + | |
- | | + | |
- | -split-output | + | |
- | -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 | + | |
- | | + | |
- | -ucs-level LEVEL Set Joliet UCS level (1..3) | + | |
- | -udf Generate UDF file system | + | |
- | -dvd-video | + | |
- | -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 | + | |
- | -use-fileversion LEVEL Use file version # from filesystem | + | |
- | -v, -verbose | + | |
- | -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 | + | |
- | -no-emul-boot | + | |
- | -no-boot | + | |
- | -boot-load-seg # Set load segment for boot image | + | |
- | -boot-load-size # Set numbers of load sectors | + | |
- | -boot-info-table | + | |
- | -XA | + | |
- | -xa | + | |
- | -z, -transparent-compression | + | |
- | Enable transparent compression of files | + | |
- | -hfs-type TYPE Set HFS default TYPE | + | |
- | -hfs-creator CREATOR | + | |
- | -g, -apple | + | |
- | -h, -hfs Create ISO9660/HFS hybrid | + | |
- | | + | |
- | -H MAPPING_FILE, | + | |
- | Map file extensions to HFS TYPE/ | + | |
- | -magic FILE Magic file for HFS TYPE/ | + | |
- | -probe | + | |
- | -mac-name | + | |
- | -no-mac-files | + | |
- | -boot-hfs-file FILE Set HFS boot image name | + | |
- | -part | + | |
- | -cluster-size SIZE Cluster size for PC Exchange Macintosh files | + | |
- | -auto FILE Set HFS AutoStart file name | + | |
- | -no-desktop | + | |
- | -hide-hfs GLOBFILE | + | |
- | -hide-hfs-list FILE List of HFS files to hide | + | |
- | -hfs-volid HFS_VOLID | + | |
- | -icon-position | + | |
- | -root-info FILE | + | |
- | -input-hfs-charset CHARSET | + | |
- | -output-hfs-charset CHARSET Output charset for HFS file name conversion | + | |
- | -hfs-unlock | + | |
- | -hfs-bless FOLDER_NAME | + | |
- | -hfs-parms PARAMETERS | + | |
- | -prep-boot FILE PReP boot image file -- up to 4 are allowed | + | |
- | -chrp-boot | + | |
- | --cap Look for AUFS CAP Macintosh files | + | |
- | --netatalk | + | |
- | --double | + | |
- | --ethershare | + | |
- | --exchange | + | |
- | --sgi Look for SGI Macintosh files | + | |
- | --macbin | + | |
- | --single | + | |
- | --ushare | + | |
- | --xinet | + | |
- | --dave | + | |
- | --sfm Look for SFM Macintosh files | + | |
- | --osx-double | + | |
- | --osx-hfs | + | |
- | Report problems to debburn-devel@lists.alioth.debian.org. | + | See the shutdown(8) man page for details. |
</ | </ | ||
- | =====Systèmes de Fichiers Chiffrés sous RHEL/CentOS 8===== | + | L' |
- | ====LAB #21 - Créer un Système de Fichiers Chiffré avec LUKS sous RHEL/CentOS 8===== | + | ^ Valeur ^ Description ^ |
- | + | | hh:mm | L' | |
- | ===Présentation=== | + | | +m | Nombre |
- | + | | now | L' | |
- | **LUKS** ( Linux Unified Key Setup ) permet de chiffrer | + | |
- | + | ||
- | ===Mise en Place=== | + | |
- | + | ||
- | Remplissez | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# shred -v --iterations=1 /dev/sdb12 | + | |
- | shred: /dev/sdb12: pass 1/1 (random)... | + | |
- | </ | + | |
<WRAP center round important 60%> | <WRAP center round important 60%> | ||
- | **Important** : L'étape ci-dessus | + | **Important** : Si l'opération |
</ | </ | ||
- | Initialisez la partition avec LUKS : | + | L' |
< | < | ||
- | [root@centos8 ~]# cryptsetup | + | [root@redhat9 tmp]# date && shutdown |
- | + | Thu Oct 24 11:53:34 AM CEST 2024 | |
- | WARNING! | + | Shutdown scheduled |
- | ======== | + | |
- | This will overwrite data on /dev/sdb12 irrevocably. | + | |
- | + | ||
- | Are you sure? (Type ' | + | |
- | Enter passphrase | + | |
- | Verify passphrase: fenestros123456789 | + | |
- | Key slot 0 created. | + | |
- | Command successful. | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | ==== La Commande reboot==== |
- | **Important** : La passphrase ne sera pas en claire. Elle l'est ici pour vous montrer un mot de passe acceptable pour LUKS. | + | |
- | </ | + | |
- | Ouvrez la partition LUKS en lui donnant | + | Cette commande redémarre |
- | < | + | ===Options de la commande=== |
- | [root@centos8 ~]# cryptsetup luksOpen /dev/sdb12 sdb12 | + | |
- | Enter passphrase for /dev/sdb12: fenestros123456789 | + | |
- | </ | + | |
- | Vérifiez que le système voit la partition | + | Les options de cette commande sont : |
< | < | ||
- | [root@centos8 ~]# ls -l /dev/mapper | grep sdb12 | + | [root@redhat9 tmp]# reboot |
- | lrwxrwxrwx. 1 root root 7 Jun 2 10:03 sdb12 -> ../dm-2 | + | reboot [OPTIONS...] [ARG] |
- | </ | + | |
- | Créez maintenant un système de fichiers sur **/ | + | Reboot the system. |
- | < | + | Options: |
- | [root@centos8 ~]# mkfs.xfs / | + | --help |
- | meta-data=/ | + | |
- | = | + | -p --poweroff |
- | = | + | --reboot |
- | = | + | -f --force |
- | data | + | -w --wtmp-only Don't halt/ |
- | = | + | -d --no-wtmp |
- | naming | + | |
- | log =internal log | + | |
- | = | + | |
- | realtime =none | + | |
- | </code> | + | |
- | Montez la partition LUKS : | + | See the halt(8) man page for details. |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# mount / | + | |
</ | </ | ||
- | Vérifiez la présence du montage : | + | ==== La Commande halt==== |
- | < | + | Cette commande arrête le système. |
- | [root@centos8 ~]# df -h | grep sdb12 | + | |
- | / | + | |
- | </ | + | |
- | Editez le fichier **/ | + | ===Options de la commande=== |
- | < | + | Les options de cette commande sont : |
- | [root@centos8 ~]# vi / | + | |
- | [root@centos8 ~]# cat / | + | |
- | sdb12 /dev/sdb12 none | + | |
- | </ | + | |
- | + | ||
- | Modifiez le fichier **/ | + | |
< | < | ||
- | [root@centos8 ~]# vi / | + | [root@redhat9 tmp]# halt --help |
- | [root@centos8 ~]# cat / | + | halt [OPTIONS...] |
- | + | ||
- | # | + | |
- | # / | + | |
- | # Created by anaconda on Fri May 8 07:35:23 2020 | + | |
- | # | + | |
- | # Accessible filesystems, | + | |
- | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. | + | |
- | # | + | |
- | # After editing this file, run ' | + | |
- | # units generated from this file. | + | |
- | # | + | |
- | UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c / | + | |
- | UUID=2ae4c035-9244-458c-82c5-a49ae169cdb6 /boot | + | |
- | UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 swap swap defaults | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Restaurer les SC par défaut de SELinux : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# / | + | |
- | Relabeled /mnt/sdb12 from system_u: | + | |
- | </ | + | |
- | + | ||
- | Redémarrez votre machine virtuelle : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# shutdown -r now | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | **Important** : Lors du démarrage de la machine virtuelle, le système devrait vous demander d' | + | |
- | </ | + | |
- | + | ||
- | ===Ajouter une deuxième Passphrase=== | + | |
- | + | ||
- | Pour ajouter une deuxième passphrase, utilisez la commande cryptsetup avec la sous-commande **luksAddKey** : | + | |
- | + | ||
- | < | + | |
- | [trainee@centos8 ~]$ su - | + | |
- | Password: fenestros | + | |
- | [root@centos8 ~]# cryptsetup luksAddKey / | + | |
- | Enter any existing passphrase: fenestros123456789 | + | |
- | Enter new passphrase for key slot: redhat123456789 | + | |
- | Verify passphrase: redhat123456789 | + | |
- | </ | + | |
- | + | ||
- | <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. | + | |
- | </ | + | |
- | + | ||
- | ===Supprimer une Passphrase=== | + | |
- | + | ||
- | Pour supprimer une passphrase, utilisez la commande cryptsetup avec la sous-commande **luksRemoveKey** : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# cryptsetup luksRemoveKey / | + | |
- | Enter passphrase to be deleted: redhat123456789 | + | |
- | </ | + | |
- | + | ||
- | Avant de poursuivre, éditez les fichiers **/ | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# vi / | + | |
- | [root@centos8 ~]# cat / | + | |
- | + | ||
- | # | + | |
- | # / | + | |
- | # Created by anaconda on Fri May 8 07:35:23 2020 | + | |
- | # | + | |
- | # Accessible filesystems, | + | |
- | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. | + | |
- | # | + | |
- | # After editing this file, run ' | + | |
- | # units generated from this file. | + | |
- | # | + | |
- | UUID=4c0cc28c-0d59-45be-bd73-d292b80be33c / | + | |
- | UUID=2ae4c035-9244-458c-82c5-a49ae169cdb6 /boot | + | |
- | UUID=c8bb3f47-d67f-4b21-b781-766899dc83d4 swap swap defaults | + | |
- | + | ||
- | [root@centos8 ~]# vi / | + | |
- | [root@centos8 ~]# cat / | + | |
- | [root@centos8 ~]# | + | |
- | </ | + | |
- | + | ||
- | =====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' | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# swapon -s | + | |
- | Filename Type Size Used Priority | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | <WRAP center round important 60%> | + | |
- | **Important** : Vous noterez que dans l' | + | |
- | </ | + | |
- | + | ||
- | ===Options de la Commande=== | + | |
- | + | ||
- | Les options de la commande swapon sont : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# swapon --help | + | |
- | + | ||
- | Usage: | + | |
- | | + | |
- | Enable devices and files for paging and swapping. | + | Halt the system. |
Options: | Options: | ||
- | -a, --all enable all swaps from /etc/fstab | + | --help Show this help |
- | -d, --discard[=< | + | |
- | -e, --ifexists | + | -p --poweroff |
- | -f, --fixpgsz | + | --reboot |
- | -o, --options < | + | -f --force |
- | -p, --priority < | + | -w --wtmp-only Don' |
- | -s, --summary | + | -d --no-wtmp |
- | --show[=< | + | --no-wall |
- | | + | |
- | | + | |
- | --bytes display swap size in bytes in --show output | + | |
- | -v, --verbose | + | |
- | -h, --help | + | See the halt(8) man page for details. |
- | -V, --version | + | |
- | + | ||
- | The < | + | |
- | -L < | + | |
- | -U < | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | < | + | |
- | < | + | |
- | + | ||
- | Available discard policy types (for --discard): | + | |
- | | + | |
- | | + | |
- | If no policy is selected, both discard types are enabled (default). | + | |
- | + | ||
- | Available output columns: | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | + | ||
- | For more details see swapon(8). | + | |
</ | </ | ||
- | <WRAP center round important 60%> | + | ==== La Commande poweroff==== |
- | **Important** : L' | + | |
- | </ | + | |
- | ====La Commande swapoff==== | + | Cette commande arrête le système et coupe l' |
- | Dans le cas de notre exemple, la partition de swap se trouve sur **/ | + | ===Options |
- | < | + | Les options |
- | [root@centos8 ~]# swapoff /dev/dm-1 | + | |
- | [root@centos8 ~]# swapon -s | + | |
- | [root@centos8 ~]# | + | |
- | </ | + | |
- | + | ||
- | ===Options | + | |
< | < | ||
- | [root@centos8 ~]# swapoff | + | [root@redhat9 tmp]# poweroff |
+ | poweroff [OPTIONS...] | ||
- | Usage: | + | Power off the system. |
- | | + | |
- | + | ||
- | Disable devices and files for paging and swapping. | + | |
Options: | Options: | ||
- | -a, --all disable all swaps from /proc/swaps | + | |
- | -v, --verbose | + | |
+ | -p --poweroff | ||
+ | | ||
+ | -f --force | ||
+ | -w --wtmp-only Don't halt/ | ||
+ | | ||
+ | | ||
- | -h, --help | + | See the halt(8) man page for details. |
- | -V, --version | + | |
- | + | ||
- | The < | + | |
- | -L < | + | |
- | -U < | + | |
- | | + | |
- | | + | |
- | < | + | |
- | < | + | |
- | + | ||
- | For more details see swapoff(8). | + | |
- | </ | + | |
- | + | ||
- | ====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' | + | |
- | + | ||
- | * **count** | + | |
- | * le nombre | + | |
- | * **bs** | + | |
- | * la taille du bloc à copier | + | |
- | + | ||
- | Dans le cas du fichier swap il convient d' | + | |
- | + | ||
- | Pour créer votre fichier de swap de 268Mo, appelé **swap**, saisissez la commande suivante : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# dd if=/ | + | |
- | 256+0 records in | + | |
- | 256+0 records out | + | |
- | 268435456 bytes (268 MB, 256 MiB) copied, 0.103048 s, 2.6 GB/s | + | |
- | </ | + | |
- | + | ||
- | Pour préparer le fichier en tant qu' | + | |
- | + | ||
- | < | + | |
- | [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 | + | |
- | </ | + | |
- | + | ||
- | Pour activer le fichier avec une priorité de **1**, saisissez la commande suivante : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# swapon -p1 /swap | + | |
- | swapon: /swap: insecure permissions 0644, 0600 suggested. | + | |
- | </ | + | |
- | + | ||
- | Pour visualiser les éspaces swap, saisissez la commande suivante : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# swapon -s | + | |
- | Filename Type Size Used Priority | + | |
- | /swap file 262140 0 1 | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | <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 center round important 60%> | + | |
- | **Important** : Pour activer le fichier swap d'une manière permanente, il convient d' | + | |
- | </ | + | |
- | + | ||
- | Désactivez maintenant le fichier swap : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# swapoff /swap | + | |
- | [root@centos8 ~]# swapon -s | + | |
- | Filename Type Size Used Priority | + | |
- | / | + | |
- | </ | + | |
- | + | ||
- | Supprimez maintenant le fichier de swap : | + | |
- | + | ||
- | < | + | |
- | [root@centos8 ~]# rm /swap | + | |
- | rm: remove regular file '/ | + | |
</ | </ | ||
----- | ----- | ||
Copyright © 2024 Hugh Norris. | Copyright © 2024 Hugh Norris. |