Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:centos:8:junior:l121 [2021/12/18 09:54] – removed admin | elearning:workbooks:centos:8:junior:l121 [2024/10/01 08:01] (Version actuelle) – created admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ~~PDF: | ||
+ | Version : **2024.01** | ||
+ | |||
+ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
+ | |||
+ | ======LCF601 - Gestion des Disques, des Systèmes de Fichiers et du Swap====== | ||
+ | |||
+ | =====Contenu du Module===== | ||
+ | |||
+ | * **LCF601 - Gestion des Disques, des Systèmes de Fichiers et du Swap** | ||
+ | * Contenu du Module | ||
+ | * Périphériques de stockage | ||
+ | * Partitions | ||
+ | * Partitionnement | ||
+ | * LAB #1 - Partitionnement de votre Disque avec fdisk | ||
+ | * LAB #2 - Modifier les Drapeaux des Partitions avec fdisk | ||
+ | * Logical Volume Manager (LVM) | ||
+ | * LAB #3 - Volumes Logiques Linéaires | ||
+ | * Physical Volume (PV) | ||
+ | * Volume Group (VG) et Physical Extent (PE) | ||
+ | * Logical Volumes (LV) | ||
+ | * LAB #4 - Étendre un Volume Logique à Chaud | ||
+ | * LAB #5 - Snapshots | ||
+ | * LAB #6 - Suppression des Volumes | ||
+ | * LAB #7 - Volumes Logiques en Miroir | ||
+ | * LAB #8 - Modifier les Attributs LVM | ||
+ | * LAB #9 - Volumes Logiques en Bandes | ||
+ | * LAB #10 - Gérer les Métadonnées | ||
+ | * Systèmes de Fichiers Journalisés | ||
+ | * Présentation | ||
+ | * Ext3 | ||
+ | * Gestion d'Ext3 | ||
+ | * LAB #11 - Convertir un Système de Fichiers Ext3 en Ext2 | ||
+ | * LAB #12 - Convertir un Système de Fichiers Ext2 en Ext3 | ||
+ | * LAB #13 - Placer le Journal sur un autre Partition | ||
+ | * LAB #14 - Modifier la Fréquence de Vérification du Système de Fichiers Ext3 | ||
+ | * Ext4 | ||
+ | * LAB #15 - Créer un Système de Fichiers Ext4 | ||
+ | * LAB #16 - Ajouter une Étiquette au Système de Fichiers Ext4 | ||
+ | * LAB #17 - Convertir un Système de Fichiers Ext3 en Ext4 | ||
+ | * XFS | ||
+ | * LAB #18 - Créer un Système de Fichiers XFS | ||
+ | * LAB #19 - Ajouter une Étiquette au Système de Fichiers XFS | ||
+ | * Autres Systèmes de Fichiers | ||
+ | * ReiserFS | ||
+ | * JFS | ||
+ | * Btrfs | ||
+ | * Comparaison des Commandes par Système de Fichiers | ||
+ | * LAB #20 - Créer un Système de Fichiers ISO | ||
+ | * La Commande mkisofs | ||
+ | * Systèmes de Fichiers Chiffrés | ||
+ | * LAB #21 - Créer un Système de Fichiers Chiffré avec LUKS | ||
+ | * Présentation | ||
+ | * Mise en Place | ||
+ | * Ajouter une deuxième Passphrase | ||
+ | * Supprimer une Passphrase | ||
+ | * Raid Logiciel | ||
+ | * LAB #22 - Mise en Place du RAID 5 Logiciel | ||
+ | * 22.1 - Préparer le disque | ||
+ | * 22.2 - Créer une Unité RAID | ||
+ | * 22.3 - Remplacer une Unité Défaillante | ||
+ | * Le Swap | ||
+ | * Taille du swap | ||
+ | * Partitions de swap | ||
+ | * La Commande swapon | ||
+ | * La Commande swapoff | ||
+ | * LAB #23 - Créer un Fichier de Swap | ||
+ | |||
+ | =====Périphériques de stockage===== | ||
+ | |||
+ | Les unités de stockage sous Linux sont référencées par un des fichiers se trouvant dans le répertoire **/dev** : | ||
+ | |||
+ | * hd[a-d] | ||
+ | * Les disques IDE et les lecteurs ATAPI | ||
+ | * sd[a-z] | ||
+ | * Les disques SCSI et SATA | ||
+ | * mmcblk[0-7] | ||
+ | * Les cartes SD/MMC | ||
+ | * scd[0-7] | ||
+ | * Les CDRoms SCSI | ||
+ | * xd[a-d] | ||
+ | * Les premiers disques sur IBM XT | ||
+ | * fd[0-7] | ||
+ | * Les lecteurs de disquettes | ||
+ | * st[0-7] | ||
+ | * Les lecteurs de bandes SCSI/SATA qui **supportent** le rembobinage | ||
+ | * nst[0-7] | ||
+ | * Les lecteurs de bandes SCSI/SATA qui ne supportent **pas** le rembobinage | ||
+ | * ht[0-7] | ||
+ | * Les lecteurs de bandes PATA qui **supportent** le rembobinage | ||
+ | * nht[0-7] | ||
+ | * Les lecteurs de bandes PATA qui ne supportent **pas** le rembobinage | ||
+ | * rmt8, rmt16, tape-d, tape-reset | ||
+ | * Les lecteurs QIC-80 | ||
+ | * ram[0-15] | ||
+ | * Les disques virtuels. Ils sont supprimés à l' | ||
+ | * Périphériques **loop** | ||
+ | * Il existe 16 unités loop qui sont utilisés pour accèder en mode bloc à un système de fichiers contenu dans un fichier, par exemple, une image **iso** | ||
+ | * md[x] | ||
+ | * Un volume **RAID** logiciel | ||
+ | * vg[x] | ||
+ | * Un groupe de volumes | ||
+ | * lv[x] | ||
+ | * Un volume logique | ||
+ | |||
+ | =====Partitions===== | ||
+ | |||
+ | Un PC comportent en règle générale 2 **contrôleurs** de disque, chacun capable de gérer 2 disques, un **maître** et un **esclave**. Les disques attachés à ces contrôleurs comportent des noms différents pour pouvoir les distinguer : | ||
+ | |||
+ | * Contrôleur 0 | ||
+ | * 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 : | ||
+ | |||
+ | * **Partitions primaires**, | ||
+ | * Maximum de **4**. En effet, la Table des Partitions est grande de 64 octets. Il faut 16 octets pour codés une partition. | ||
+ | * **Partitions Etendues**, | ||
+ | * Généralement une seule partition étendue par disque. Elle contient des **Lecteurs Logiques** aussi appelés des partitions, | ||
+ | * **Lecteurs Logiqiques**. | ||
+ | |||
+ | Les 4 partitions primaires sont numérotées de 1 à 4. Par exemple : | ||
+ | |||
+ | * **hda1**, **hda2**, **hda3** et **hda4** pour le premier disque **IDE** sur le premier contrôleur de disque, | ||
+ | * **sda1**, **sda2**, **sda3** et **sda4** pour le premier disque **SCSI** ou **SATA** sur le premier contrôleur de disque. | ||
+ | |||
+ | {{free: | ||
+ | |||
+ | Une partition étendue prend la place d'une partition primaire et les lecteurs logiques qui s'y trouvent commencent à partir de **hda5** ou de **sda5**. | ||
+ | |||
+ | 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' | ||
+ | |||
+ | Les lecteurs logiques commençant à **sda5**, nous obtenons la liste de partitions suivante : sda1, sda2, sda5, sda6, sda7. Notez que la sda3 ne peut pas être utilisée en tant que partition car elle est cachée par les lecteurs sda5, sda6 et sda7. | ||
+ | |||
+ | {{free: | ||
+ | |||
+ | Le nombre de partitions sur un disque est limité : | ||
+ | |||
+ | * **IDE**, | ||
+ | * Jusqu' | ||
+ | * **SCSI**, | ||
+ | * Jusqu' | ||
+ | * **Disques utilisant l'API libata**, | ||
+ | * Jusqu' | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Ces limites peuvent être dépassées en utilisant la gestion **LVM** (//Logical Volume Management// | ||
+ | </ | ||
+ | |||
+ | =====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%> | ||
+ | **Important** -Notez que la taille du LV est un multiple du PE. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvcreate** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvcreate --help | ||
+ | lvcreate - Create a logical volume | ||
+ | |||
+ | Create a linear LV. | ||
+ | lvcreate -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ --type linear ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a striped LV (infers --type striped). | ||
+ | lvcreate -i|--stripes Number -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a raid1 or mirror LV (infers --type raid1|mirror). | ||
+ | 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). | ||
+ | lvcreate --type raid -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -m|--mirrors Number ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ --minrecoveryrate Size[k|UNIT] ] | ||
+ | [ --maxrecoveryrate Size[k|UNIT] ] | ||
+ | [ --raidintegrity y|n ] | ||
+ | [ --raidintegritymode String ] | ||
+ | [ --raidintegrityblocksize Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a raid10 LV. | ||
+ | lvcreate -m|--mirrors Number -i|--stripes Number -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ --minrecoveryrate Size[k|UNIT] ] | ||
+ | [ --maxrecoveryrate Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a COW snapshot LV of an origin LV. | ||
+ | lvcreate -s|--snapshot -L|--size Size[m|UNIT] LV | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --type snapshot ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin pool. | ||
+ | lvcreate --type thin-pool -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --thinpool LV_new ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a cache pool. | ||
+ | lvcreate --type cache-pool -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -H|--cache ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin LV in a thin pool (infers --type thin). | ||
+ | lvcreate -V|--virtualsize Size[m|UNIT] --thinpool LV_thinpool VG | ||
+ | [ -T|--thin ] | ||
+ | [ --type thin ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a thin LV that is a snapshot of an existing thin LV | ||
+ | (infers --type thin). | ||
+ | lvcreate -s|--snapshot LV_thin | ||
+ | [ --type thin ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a thin LV that is a snapshot of an external origin LV. | ||
+ | lvcreate --type thin --thinpool LV_thinpool LV | ||
+ | [ -T|--thin ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Create a LV that returns VDO when used. | ||
+ | lvcreate --type vdo -L|--size Size[m|UNIT] VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -V|--virtualsize Size[m|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --vdo ] | ||
+ | [ --vdopool LV_new ] | ||
+ | [ --compression y|n ] | ||
+ | [ --deduplication y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a thin LV, first creating a thin pool for it, | ||
+ | where the new thin pool is named by the --thinpool arg. | ||
+ | lvcreate --type thin -V|--virtualsize Size[m|UNIT] -L|--size Size[m|UNIT] --thinpool LV_new | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -T|--thin ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --errorwhenfull y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachepool | ||
+ | which converts the new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachepool LV_cachepool VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -H|--cache ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachevol | ||
+ | which converts the new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachevol LV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach a cachevol created from | ||
+ | the specified cache device, which converts the | ||
+ | new LV to type cache. | ||
+ | lvcreate --type cache -L|--size Size[m|UNIT] --cachedevice PV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach the specified cachevol | ||
+ | which converts the new LV to type writecache. | ||
+ | lvcreate --type writecache -L|--size Size[m|UNIT] --cachevol LV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Create a new LV, then attach a cachevol created from | ||
+ | the specified cache device, which converts the | ||
+ | new LV to type writecache. | ||
+ | lvcreate --type writecache -L|--size Size[m|UNIT] --cachedevice PV VG | ||
+ | [ -l|--extents Number[PERCENT] ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -a|--activate y|n|ay ] | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -C|--contiguous y|n ] | ||
+ | [ -M|--persistent y|n ] | ||
+ | [ -j|--major Number ] | ||
+ | [ -k|--setactivationskip y|n ] | ||
+ | [ -K|--ignoreactivationskip ] | ||
+ | [ -n|--name String ] | ||
+ | [ -p|--permission rw|r ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -W|--wipesignatures y|n ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --addtag Tag ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --ignoremonitoring ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ --minor Number ] | ||
+ | [ --monitor y|n ] | ||
+ | [ --nosync ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un répertoire dans /mnt pour monter lv0 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir /mnt/lvm | ||
+ | </ | ||
+ | |||
+ | Créez un système de fichiers en **ext3** sur / | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mke2fs -j / | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | Creating filesystem with 360448 1k blocks and 90112 inodes | ||
+ | Filesystem UUID: 87b6d526-d379-4e0c-8984-94811f1cee33 | ||
+ | Superblock backups stored on blocks: | ||
+ | 8193, 24577, 40961, 57345, 73729, 204801, 221185 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (8192 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Montez votre lv0 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount -t ext3 / | ||
+ | </ | ||
+ | |||
+ | Vous allez maintenant copier le contenu de votre répertoire /home vers /mnt/lvm. | ||
+ | |||
+ | Saisissez donc la commande pour copier le contenu de /home : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cp -a /home /mnt/lvm | ||
+ | </ | ||
+ | |||
+ | Constatez ensuite le contenu de /mnt/lvm : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /mnt/lvm | ||
+ | total 14 | ||
+ | drwxr-xr-x. 5 root root 1024 Apr 20 14:35 home | ||
+ | drwx------. 2 root root 12288 May 26 17:00 lost+found | ||
+ | </ | ||
+ | |||
+ | Une particularité du volume logique est la capacité de d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# df -h /mnt/lvm | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Dans la cas de notre exemple, la taille est de **333 Mo** avec **17 Mo** occupé. | ||
+ | |||
+ | ====LAB #4 - Etendre un Volume Logique à Chaud==== | ||
+ | |||
+ | Pour agrandir un volume logique, le paquet **lvm2** contient les commandes **lvextend** et **resize2fs** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvextend -L +100M / | ||
+ | Rounding size to boundary between physical extents: 104.00 MiB. | ||
+ | Size of logical volume vg0/lv0 changed from 352.00 MiB (44 extents) to 456.00 MiB (57 extents). | ||
+ | Logical volume vg0/lv0 successfully resized. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que l' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvextend** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvextend --help | ||
+ | lvextend - Add space to a logical volume | ||
+ | |||
+ | Extend an LV by a specified size. | ||
+ | lvextend -L|--size [+]Size[m|UNIT] LV | ||
+ | [ -l|--extents [+]Number[PERCENT] ] | ||
+ | [ -r|--resizefs ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ --poolmetadatasize [+]Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Extend an LV by specified PV extents. | ||
+ | lvextend LV PV ... | ||
+ | [ -r|--resizefs ] | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Extend a pool metadata SubLV by a specified size. | ||
+ | lvextend --poolmetadatasize [+]Size[m|UNIT] LV_thinpool | ||
+ | [ -i|--stripes Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Extend an LV according to a predefined policy. | ||
+ | lvextend --usepolicies LV_snapshot_thinpool | ||
+ | [ -r|--resizefs ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Common options for command: | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -f|--force ] | ||
+ | [ -m|--mirrors Number ] | ||
+ | [ -n|--nofsck ] | ||
+ | [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit ] | ||
+ | [ --nosync ] | ||
+ | [ --noudevsync ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --type linear|striped|snapshot|mirror|raid|thin|cache|vdo|thin-pool|cache-pool|vdo-pool ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Le volume ayant été agrandi, il est necessaire maintenant d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# resize2fs / | ||
+ | resize2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem at / | ||
+ | old_desc_blocks = 2, new_desc_blocks = 2 | ||
+ | The filesystem on / | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant la modification de la taille du volume : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# df -h /mnt/lvm | ||
+ | Filesystem | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | 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 ~]# dd if=/ | ||
+ | 10+0 records in | ||
+ | 10+0 records out | ||
+ | 10485760 bytes (10 MB, 10 MiB) copied, 0.0281282 s, 373 MB/s | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un snapshot : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvcreate -s -L 18M -n testsnap / | ||
+ | Rounding up size to full physical extent 24.00 MiB | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Pour avoir une confirmation de la création du snapshot, utilisez la commande **lvs** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvs | ||
+ | LV | ||
+ | root | ||
+ | swap | ||
+ | lv0 vg0 owi-aos--- 456.00m | ||
+ | testsnap vg0 swi-a-s--- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que le snapshot est créé dans le même VG que le LV d' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvs** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvs --help | ||
+ | lvs - Display information about logical volumes | ||
+ | |||
+ | lvs | ||
+ | [ -H|--history ] | ||
+ | [ -a|--all ] | ||
+ | [ -o|--options String ] | ||
+ | [ -S|--select String ] | ||
+ | [ -O|--sort String ] | ||
+ | [ --segments ] | ||
+ | [ --aligned ] | ||
+ | [ --binary ] | ||
+ | [ --configreport log|vg|lv|pv|pvseg|seg ] | ||
+ | [ --foreign ] | ||
+ | [ --ignorelockingfailure ] | ||
+ | [ --logonly ] | ||
+ | [ --nameprefixes ] | ||
+ | [ --noheadings ] | ||
+ | [ --nosuffix ] | ||
+ | [ --readonly ] | ||
+ | [ --reportformat basic|json ] | ||
+ | [ --rows ] | ||
+ | [ --separator String ] | ||
+ | [ --shared ] | ||
+ | [ --unbuffered ] | ||
+ | [ --units r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E ] | ||
+ | [ --unquoted ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ VG|LV|Tag ... ] | ||
+ | |||
+ | Common options for lvm: | ||
+ | [ -d|--debug ] | ||
+ | [ -h|--help ] | ||
+ | [ -q|--quiet ] | ||
+ | [ -v|--verbose ] | ||
+ | [ -y|--yes ] | ||
+ | [ -t|--test ] | ||
+ | [ --commandprofile String ] | ||
+ | [ --config String ] | ||
+ | [ --driverloaded y|n ] | ||
+ | [ --nolocking ] | ||
+ | [ --lockopt String ] | ||
+ | [ --longhelp ] | ||
+ | [ --profile String ] | ||
+ | [ --version ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un répertoire pour monter le snapshot : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir / | ||
+ | </ | ||
+ | |||
+ | Montez le snapshot : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount / | ||
+ | </ | ||
+ | |||
+ | Comparez le volume d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /mnt/lvm | ||
+ | total 10296 | ||
+ | -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 | ||
+ | [root@centos8 ~]# ls -l / | ||
+ | total 10296 | ||
+ | -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** de votre volume d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# rm / | ||
+ | rm: remove regular file '/ | ||
+ | </ | ||
+ | |||
+ | Constatez le résultat de cette suppression : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# df -Ph /mnt/lvm | ||
+ | Filesystem | ||
+ | / | ||
+ | |||
+ | [root@centos8 ~]# df -Ph / | ||
+ | Filesystem | ||
+ | / | ||
+ | |||
+ | [root@centos8 ~]# lvs | ||
+ | LV | ||
+ | root | ||
+ | swap | ||
+ | lv0 vg0 owi-aos--- 456.00m | ||
+ | testsnap vg0 swi-aos--- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round todo 60%> | ||
+ | **A Faire** - Restaurez le fichier 10M à partir du snapshot. | ||
+ | </ | ||
+ | |||
+ | ====LAB #6 - Suppression des Volumes==== | ||
+ | |||
+ | La suppression d'un volume logique se fait grace à la commande **lvremove** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# umount / | ||
+ | [root@centos8 ~]# lvremove / | ||
+ | Do you really want to remove active logical volume vg0/ | ||
+ | Logical volume " | ||
+ | [root@centos8 ~]# umount / | ||
+ | [root@centos8 ~]# lvremove / | ||
+ | Do you really want to remove active logical volume vg0/lv0? [y/n]: y | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que cette opération necéssite à ce que le volume logique soit démonté. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvremove** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvremove --help | ||
+ | lvremove - Remove logical volume(s) from the system | ||
+ | |||
+ | lvremove VG|LV|Tag|Select ... | ||
+ | [ -A|--autobackup y|n ] | ||
+ | [ -f|--force ] | ||
+ | [ -S|--select String ] | ||
+ | [ --nohistory ] | ||
+ | [ --noudevsync ] | ||
+ | [ --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 ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands | ||
+ | </ | ||
+ | |||
+ | Le Volume Group peut aussi être supprimé : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgremove vg0 | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **vgremove** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgremove --help | ||
+ | vgremove - Remove volume group(s) | ||
+ | |||
+ | vgremove VG|Tag|Select ... | ||
+ | [ -f|--force ] | ||
+ | [ -S|--select String ] | ||
+ | [ --noudevsync ] | ||
+ | [ --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 ] | ||
+ | |||
+ | Use --longhelp to show all options and advanced commands. | ||
+ | </ | ||
+ | |||
+ | Ainsi que le volume physique : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# pvremove /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
+ | Labels on physical volume "/ | ||
+ | Labels on physical volume "/ | ||
+ | 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: | ||
+ | [ -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 #7 - Volumes Logiques en Miroir==== | ||
+ | |||
+ | Re-créez maintenant votre Volume Group : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# pvcreate /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | Physical volume "/ | ||
+ | |||
+ | [root@centos8 ~]# vgcreate -s 8M vg0 /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un Logical Volume en miroir grâce à l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvcreate -m 1 -L 100M -n lv1 vg0 | ||
+ | Rounding up size to full physical extent 104.00 MiB | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Constatez maintenant la présence du miroir : | ||
+ | |||
+ | < | ||
+ | [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 8192 | ||
+ | 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' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# pvdisplay -m /dev/sdb6 /dev/sdb7 /dev/sdb9 | ||
+ | --- Physical volume --- | ||
+ | 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 1 to 13: | ||
+ | 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 / | ||
+ | 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 : | ||
+ | |||
+ | < | ||
+ | [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 de créer un miroir pour un volume logique existant : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvconvert -m 1 / | ||
+ | Are you sure you want to convert linear LV vg0/lv1 to raid1 with 2 images enhancing resilience? [y/n]: y | ||
+ | Logical volume vg0/lv1 successfully converted. | ||
+ | </ | ||
+ | |||
+ | Supprimez de nouveau votre miroir : | ||
+ | |||
+ | < | ||
+ | [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 de la commande **lvconvert** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvconvert --help | ||
+ | lvconvert - Change logical volume layout | ||
+ | |||
+ | Convert LV to linear. | ||
+ | lvconvert --type linear LV | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to striped. | ||
+ | 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), | ||
+ | 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 | ||
+ | (a specific raid level must be used, e.g. raid1). | ||
+ | lvconvert --type raid LV | ||
+ | [ -m|--mirrors [+|-]Number ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --stripes Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to raid1 or mirror, or change number of mirror images. | ||
+ | lvconvert -m|--mirrors [+|-]Number LV | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -i|--interval Number ] | ||
+ | [ --mirrorlog core|disk ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert raid LV to change number of stripe images. | ||
+ | lvconvert --stripes Number LV_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert raid LV to change the stripe size. | ||
+ | lvconvert -I|--stripesize Size[k|UNIT] LV_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ -R|--regionsize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Split images from a raid1 or mirror LV and use them to create a new LV. | ||
+ | lvconvert --splitmirrors Number -n|--name LV_new LV_cache_mirror_raid1 | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Split images from a raid1 LV and track changes to origin for later merge. | ||
+ | lvconvert --splitmirrors Number --trackchanges LV_cache_raid1 | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Merge LV images that were split from a raid1 LV. | ||
+ | lvconvert --mergemirrors VG|LV_linear_raid|Tag ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Convert LV to a thin LV, using the original LV as an external origin. | ||
+ | lvconvert --type thin --thinpool LV LV_linear_striped_thin_cache_raid | ||
+ | [ -T|--thin ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --originname LV_new ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a cache pool to an LV, converts the LV to type cache. | ||
+ | lvconvert --type cache --cachepool LV LV_linear_striped_thinpool_vdo_vdopool_vdopooldata_raid | ||
+ | [ -H|--cache ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a writecache to an LV, converts the LV to type writecache. | ||
+ | lvconvert --type writecache --cachevol LV LV_linear_striped_raid | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Attach a cache to an LV, converts the LV to type cache. | ||
+ | lvconvert --type cache --cachevol LV LV_linear_striped_thinpool_raid | ||
+ | [ -H|--cache ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Add a writecache to an LV, using a specified cache device. | ||
+ | lvconvert --type writecache --cachedevice PV LV_linear_striped_raid | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Add a cache to an LV, using a specified cache device. | ||
+ | lvconvert --type cache --cachedevice PV LV_linear_striped_thinpool_raid | ||
+ | [ --cachesize Size[m|UNIT] ] | ||
+ | [ --cachesettings String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Convert LV to type thin-pool. | ||
+ | lvconvert --type thin-pool LV_linear_striped_cache_raid | ||
+ | [ -I|--stripesize Size[k|UNIT] ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ --stripes Number ] | ||
+ | [ --discards passdown|nopassdown|ignore ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to type cache-pool. | ||
+ | lvconvert --type cache-pool LV_linear_striped_raid | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ -r|--readahead auto|none|Number ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ --cachemetadataformat auto|1|2 ] | ||
+ | [ --cachemode writethrough|writeback|passthrough ] | ||
+ | [ --cachepolicy String ] | ||
+ | [ --cachesettings String ] | ||
+ | [ --poolmetadata LV ] | ||
+ | [ --poolmetadatasize Size[m|UNIT] ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ --metadataprofile String ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Convert LV to type vdopool. | ||
+ | lvconvert --type vdo-pool LV_linear_striped_cache_raid | ||
+ | [ -n|--name LV_new ] | ||
+ | [ -V|--virtualsize Size[m|UNIT] ] | ||
+ | [ --compression y|n ] | ||
+ | [ --deduplication y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Detach a cache from an LV. | ||
+ | lvconvert --splitcache LV_thinpool_cache_cachepool_vdopool_writecache | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Merge thin LV into its origin LV. | ||
+ | lvconvert --mergethin LV_thin ... | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Merge COW snapshot LV into its origin. | ||
+ | lvconvert --mergesnapshot LV_snapshot ... | ||
+ | [ -i|--interval Number ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Combine a former COW snapshot (second arg) with a former | ||
+ | origin LV (first arg) to reverse a splitsnapshot command. | ||
+ | lvconvert --type snapshot LV LV_linear_striped | ||
+ | [ -s|--snapshot ] | ||
+ | [ -c|--chunksize Size[k|UNIT] ] | ||
+ | [ -Z|--zero y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | |||
+ | Replace failed PVs in a raid or mirror LV. | ||
+ | Repair a thin pool. | ||
+ | Repair a cache pool. | ||
+ | lvconvert --repair LV_thinpool_cache_cachepool_mirror_raid | ||
+ | [ -i|--interval Number ] | ||
+ | [ --usepolicies ] | ||
+ | [ --poolmetadataspare y|n ] | ||
+ | [ COMMON_OPTIONS ] | ||
+ | [ PV ... ] | ||
+ | |||
+ | Replace specific PV(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 d'un miroir, la commande **lvs** indique la présence du miroir dans la colonne **Attr** avec la lettre **m** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvs | ||
+ | LV | ||
+ | root cl_centos8 -wi-ao---- | ||
+ | swap cl_centos8 -wi-ao---- | ||
+ | lv1 vg0 -wi-a----- 104.00m | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | La commande equivalente pour les Volume Groups est **vgs** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgs | ||
+ | VG #PV #LV #SN Attr | ||
+ | cl_centos8 | ||
+ | vg0 3 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | La commande equivalente pour les Physical Volumes est **pvs** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# pvs | ||
+ | PV | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | Consultez **[[http:// | ||
+ | </ | ||
+ | |||
+ | Les commandes **lvchange**, | ||
+ | |||
+ | Par exemple, pour rendre inutilisable un Logical Volume, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvchange -a n / | ||
+ | </ | ||
+ | |||
+ | Pour faire l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvchange -a y / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **lvchange** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvchange --help | ||
+ | lvchange - Change the attributes of logical volume(s) | ||
+ | |||
+ | 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==== | ||
+ | |||
+ | Un volume logique en bandes est créé pour augmenter, comme dans le cas du RAID, les performances des entrées et sorties. Pour créer ce volume, la commande **lvcreate** prend deux option supplémentaires : | ||
+ | |||
+ | * **-i** - indique le nombre de volumes de bandes, | ||
+ | * **-I** - indique la taille en Ko de chaque bande. | ||
+ | |||
+ | Saisissez donc la commande suivante : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvcreate -i2 -I64 -n lv2 -L 100M vg0 /dev/sdb7 /dev/sdb9 | ||
+ | Rounding up size to full physical extent 104.00 MiB | ||
+ | Rounding size 104.00 MiB (13 extents) up to stripe boundary size 112.00 MiB(14 extents). | ||
+ | Logical volume " | ||
+ | </ | ||
+ | |||
+ | Constatez la présence de vos bandes sur /dev/sda7 et sur /dev/sda9 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvdisplay -m / | ||
+ | --- Logical volume --- | ||
+ | LV Path / | ||
+ | LV Name lv2 | ||
+ | VG Name vg0 | ||
+ | LV UUID MmXbPt-ZF8u-rnIv-3YU9-m64J-RCz2-6NzAuG | ||
+ | LV Write Access | ||
+ | LV Creation host, time centos8.ittraining.loc, | ||
+ | LV Status | ||
+ | # open 0 | ||
+ | LV Size 112.00 MiB | ||
+ | Current LE 14 | ||
+ | Segments | ||
+ | Allocation | ||
+ | Read ahead sectors | ||
+ | - currently set to 8192 | ||
+ | Block device | ||
+ | |||
+ | --- Segments --- | ||
+ | Logical extents 0 to 13: | ||
+ | Type striped | ||
+ | Stripes 2 | ||
+ | Stripe size 64.00 KiB | ||
+ | Stripe 0: | ||
+ | Physical volume / | ||
+ | Physical extents 0 to 6 | ||
+ | Stripe 1: | ||
+ | Physical volume / | ||
+ | Physical extents 0 to 6 | ||
+ | |||
+ | </ | ||
+ | |||
+ | Utilisez maintenant la commande **lvs** pour visualiser les volumes physiques utilisés par le volume logique : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# lvs -o +devices | ||
+ | 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==== | ||
+ | |||
+ | Les métadonnées pour chaque Volume Group sont stockés dans un fichier texte au nom du Volume Group dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cat / | ||
+ | # Generated by LVM2 version 2.03.09(2)-RHEL8 (2020-05-28): | ||
+ | |||
+ | 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 = "/ | ||
+ | |||
+ | status = [" | ||
+ | flags = [] | ||
+ | dev_size = 409600 # 200 Megabytes | ||
+ | pe_start = 2048 | ||
+ | pe_count = 24 # 192 Megabytes | ||
+ | } | ||
+ | |||
+ | pv1 { | ||
+ | id = " | ||
+ | device = "/ | ||
+ | |||
+ | status = [" | ||
+ | flags = [] | ||
+ | dev_size = 614400 # 300 Megabytes | ||
+ | pe_start = 2048 | ||
+ | pe_count = 37 # 296 Megabytes | ||
+ | } | ||
+ | |||
+ | pv2 { | ||
+ | id = " | ||
+ | device = "/ | ||
+ | |||
+ | 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 d'un groupe de volumes et elles sont placés dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls / | ||
+ | vg0_00000-427117660.vg | ||
+ | vg0_00001-1993147316.vg | ||
+ | </ | ||
+ | |||
+ | La commande **vgcfgbackup** est utilisée pour sauvegarder les métadonnées manuellement dans le fichier **/ | ||
+ | |||
+ | La commande **vgcfgrestore** permet de restaurer une sauvegarde. Sans l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgcfgbackup vg0 | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Il est aussi possible de modifier l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgcfgbackup -f / | ||
+ | Volume group " | ||
+ | </ | ||
+ | |||
+ | Par contre, toute sauvegarde en dehors des répertoires par défaut n'est pas visible dans la sortie de la commande **vgcfgrestore --list** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vgcfgrestore --list vg0 | ||
+ | |||
+ | File: | ||
+ | VG name: vg0 | ||
+ | Description: | ||
+ | Backup Time: Wed May 26 10:43:14 2021 | ||
+ | |||
+ | |||
+ | 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 journalisé qui trace les opérations d' | ||
+ | |||
+ | 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 des données, | ||
+ | * utiliser tous les utilitaires de maintenance pour les systèmes de fichiers ext2, comme fsck, | ||
+ | * utiliser le logiciel dump, ce qui n'est pas le cas avec %%ReiserFS%%. | ||
+ | |||
+ | Pour plus d' | ||
+ | |||
+ | ===Gestion d' | ||
+ | |||
+ | Notez maintenant le numéro de la dernière partition que vous avez précédemment créée : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# fdisk -l | ||
+ | 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 | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | |||
+ | 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/ | ||
+ | I/O size (minimum/ | ||
+ | </ | ||
+ | |||
+ | Créez un filesystem Ext3 sur /dev/sdb12 en utilisant la commande **mke2fs -j** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mke2fs -j /dev/sdb12 | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | Creating filesystem with 204800 1k blocks and 51200 inodes | ||
+ | Filesystem UUID: a2515f45-a32a-4e87-b7e6-170448f3f803 | ||
+ | Superblock backups stored on blocks: | ||
+ | 8193, 24577, 40961, 57345, 73729 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (4096 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **mke2fs** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mke2fs --help | ||
+ | mke2fs: invalid option -- ' | ||
+ | Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size] | ||
+ | [-i bytes-per-inode] [-I inode-size] [-J journal-options] | ||
+ | [-G flex-group-size] [-N number-of-inodes] [-d root-directory] | ||
+ | [-m reserved-blocks-percentage] [-o creator-os] | ||
+ | [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] | ||
+ | [-O feature[, | ||
+ | [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] | ||
+ | [-jnqvDFSV] device [blocks-count] | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Lors de la mise en place d'un filesystem ext2/ | ||
+ | </ | ||
+ | |||
+ | ===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 -h /dev/sdb12 | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | 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: Linux | ||
+ | Inode count: | ||
+ | Block count: | ||
+ | Reserved block count: | ||
+ | Free blocks: | ||
+ | Free inodes: | ||
+ | First block: | ||
+ | Block size: 1024 | ||
+ | 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: 4096k | ||
+ | Journal length: | ||
+ | Journal sequence: | ||
+ | Journal start: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Le drapeau **Filesystem features: | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dumpe2fs --help | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | dumpe2fs: invalid option -- ' | ||
+ | Usage: dumpe2fs [-bfghimxV] [-o superblock=< | ||
+ | </ | ||
+ | |||
+ | Pour supprimer le journal du système de fichier Ext3 sur cette partition, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tune2fs -O ^has_journal /dev/sdb12 | ||
+ | tune2fs 1.45.6 (20-Mar-2020) | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tune2fs --help | ||
+ | tune2fs 1.45.6 (20-Mar-2020) | ||
+ | tune2fs: invalid option -- ' | ||
+ | Usage: tune2fs [-c max_mounts_count] [-e errors_behavior] [-f] [-g group] | ||
+ | [-i interval[d|m|w]] [-j] [-J journal_options] [-l] | ||
+ | [-m reserved_blocks_percent] [-o [^]mount_options[, | ||
+ | [-r reserved_blocks_count] [-u user] [-C mount_count] | ||
+ | [-L volume_label] [-M last_mounted_dir] | ||
+ | [-O [^]feature[, | ||
+ | [-E extended-option[, | ||
+ | [-I new_inode_size] [-z undo_file] device | ||
+ | </ | ||
+ | |||
+ | Constatez le résultat de cette commande : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dumpe2fs -h /dev/sdb12 | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | 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: Linux | ||
+ | Inode count: | ||
+ | Block count: | ||
+ | Reserved block count: | ||
+ | Free blocks: | ||
+ | Free inodes: | ||
+ | First block: | ||
+ | Block size: 1024 | ||
+ | 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%> | ||
+ | **Important** : Notez que le drapeau **Filesystem features: | ||
+ | </ | ||
+ | |||
+ | Supprimez maintenant l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# fsck /dev/sdb12 | ||
+ | fsck from util-linux 2.32.1 | ||
+ | e2fsck 1.45.6 (20-Mar-2020) | ||
+ | /dev/sdb12: clean, 11/51200 files, 8013/204800 blocks | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un point de montage pour /dev/sdb12 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir /mnt/sdb12 | ||
+ | </ | ||
+ | |||
+ | Essayez de monter /dev/sdb12 en tant que système de fichiers Ext3. Vous obtiendrez un résultat similaire à celui-ci : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 | ||
+ | mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez l' | ||
+ | </ | ||
+ | |||
+ | Montez maintenant le système de fichiers en tant que Ext2 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount -t ext2 /dev/sdb12 /mnt/sdb12 | ||
+ | </ | ||
+ | |||
+ | ===LAB #12 - Convertir un Système de Fichiers Ext2 en Ext3=== | ||
+ | |||
+ | Pour replacer le journal sur /dev/sdb12, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# umount /mnt/sdb12 | ||
+ | |||
+ | [root@centos8 ~]# tune2fs -j /dev/sdb12 | ||
+ | tune2fs 1.45.6 (20-Mar-2020) | ||
+ | Creating journal inode: done | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez que vous avez du démonter la partition avant d' | ||
+ | </ | ||
+ | |||
+ | ===LAB #13 - Placer le Journal sur un autre Partition=== | ||
+ | |||
+ | Le journal d'un système de fichiers peut être placé sur un autre périphérique bloc. | ||
+ | |||
+ | Créez un système de fichiers sur /dev/sdb11 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mke2fs -O journal_dev /dev/sdb11 | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | Creating filesystem with 512000 1k blocks and 0 inodes | ||
+ | Filesystem UUID: 23327281-e88a-4da0-bafa-50ee10c52937 | ||
+ | Superblock backups stored on blocks: | ||
+ | |||
+ | Zeroing journal device: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez l' | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un système de fichiers Ext3 sur /dev/sdb12 en plaçant le journal sur /dev/sdb11 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mke2fs -j -J device=/ | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | Using journal device' | ||
+ | /dev/sdb12 contains a ext3 file system | ||
+ | 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: | ||
+ | 8193, 24577, 40961, 57345, 73729 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Adding journal to device /dev/sdb11: done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : Notez que le journal a été placé sur /dev/sdb11 graĉe à l' | ||
+ | </ | ||
+ | |||
+ | ===LAB #14 - Modifier la Fréquence de Vérification du Système de Fichiers Ext3=== | ||
+ | |||
+ | Pour modifier la fréquence de vérification du système de fichiers sur /dev/sdb12, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tune2fs -i 100d /dev/sdb12 | ||
+ | tune2fs 1.45.6 (20-Mar-2020) | ||
+ | Setting interval between checks to 8640000 seconds | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem UUID: 0e783411-6407-4cba-8db5-0e2729000c9e | ||
+ | Journal UUID: | ||
+ | </ | ||
+ | |||
+ | ====Ext4==== | ||
+ | |||
+ | 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 /dev/sdb11 | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | /dev/sdb11 contains a jbd file system | ||
+ | Proceed anyway? (y,N) y | ||
+ | Creating filesystem with 512000 1k blocks and 128016 inodes | ||
+ | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | ||
+ | Superblock backups stored on blocks: | ||
+ | 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (8192 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkfs.ext4 --help | ||
+ | mkfs.ext4: invalid option -- ' | ||
+ | Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size] | ||
+ | [-i bytes-per-inode] [-I inode-size] [-J journal-options] | ||
+ | [-G flex-group-size] [-N number-of-inodes] [-d root-directory] | ||
+ | [-m reserved-blocks-percentage] [-o creator-os] | ||
+ | [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory] | ||
+ | [-O feature[, | ||
+ | [-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file] | ||
+ | [-jnqvDFSV] device [blocks-count] | ||
+ | </ | ||
+ | |||
+ | Consultez maintenant les caractéristiques du système de fichier : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dumpe2fs /dev/sdb11 | more | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem volume name: < | ||
+ | Last mounted on: <not available> | ||
+ | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | ||
+ | Filesystem magic number: | ||
+ | Filesystem revision #: 1 (dynamic) | ||
+ | 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: Linux | ||
+ | Inode count: | ||
+ | Block count: | ||
+ | Reserved block count: | ||
+ | Free blocks: | ||
+ | Free inodes: | ||
+ | First block: | ||
+ | Block size: 1024 | ||
+ | Fragment size: 1024 | ||
+ | Group descriptor size: 64 | ||
+ | Reserved GDT blocks: | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | ===LAB #16 - Ajouter une Etiquette au Système de Fichiers Ext4=== | ||
+ | |||
+ | Utilisez la commande **e2label** pour associer une étiquette au système de fichiers : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# e2label /dev/sdb11 my_ext4 | ||
+ | [root@centos8 ~]# dumpe2fs /dev/sdb11 | more | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem volume name: | ||
+ | Last mounted on: <not available> | ||
+ | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | ||
+ | Filesystem magic number: | ||
+ | Filesystem revision #: 1 (dynamic) | ||
+ | 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: Linux | ||
+ | Inode count: | ||
+ | Block count: | ||
+ | Reserved block count: | ||
+ | Free blocks: | ||
+ | Free inodes: | ||
+ | First block: | ||
+ | Block size: 1024 | ||
+ | Fragment size: 1024 | ||
+ | Group descriptor size: 64 | ||
+ | Reserved GDT blocks: | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que l' | ||
+ | </ | ||
+ | |||
+ | Créez un point de montage dans **/mnt** et essayez de monter **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkdir /mnt/sdb11 | ||
+ | |||
+ | [root@centos8 ~]# mount -t ext3 /dev/sdb11 /mnt/sdb11 | ||
+ | mount: /mnt/sdb11: wrong fs type, bad option, bad superblock on /dev/sdb11, missing codepage or helper program, or other error.. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez l' | ||
+ | </ | ||
+ | |||
+ | Montez de nouveau la partition **sans** stipuler le type de système de fichiers : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount /dev/sdb11 /mnt/sdb11 | ||
+ | |||
+ | [root@centos8 ~]# mount | grep sdb11 | ||
+ | /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 /dev/sdb12 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkfs.ext3 /dev/sdb12 | ||
+ | mke2fs 1.45.6 (20-Mar-2020) | ||
+ | /dev/sdb12 contains a ext3 file system | ||
+ | created on Wed Jun 2 08:10:40 2021 | ||
+ | Proceed anyway? (y,N) y | ||
+ | Creating filesystem with 204800 1k blocks and 51200 inodes | ||
+ | Filesystem UUID: b73322d4-f2e4-43bc-96ae-422d4584f3de | ||
+ | Superblock backups stored on blocks: | ||
+ | 8193, 24577, 40961, 57345, 73729 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (4096 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Montez maintenant **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12 | ||
+ | |||
+ | [root@centos8 ~]# ls -l /mnt/sdb12 | ||
+ | total 12 | ||
+ | drwx------. 2 root root 12288 Jun 2 08:42 lost+found | ||
+ | </ | ||
+ | |||
+ | Créez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# touch / | ||
+ | </ | ||
+ | |||
+ | Injectez la chaine **check file** dans le fichier / | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# echo "check file" > / | ||
+ | |||
+ | [root@centos8 ~]# umount /dev/sdb12 | ||
+ | </ | ||
+ | |||
+ | Exécutez e2fsck sur /dev/sda12 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# e2fsck /dev/sdb12 | ||
+ | e2fsck 1.45.6 (20-Mar-2020) | ||
+ | /dev/sdb12: clean, 12/51200 files, 12128/ | ||
+ | </ | ||
+ | |||
+ | Convertissez /dev/sdb12 en Ext4 : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# tune2fs -O extents, | ||
+ | tune2fs 1.45.6 (20-Mar-2020) | ||
+ | </ | ||
+ | |||
+ | Optimisez le système de fichiers : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# e2fsck -fDC0 /dev/sdb12 | ||
+ | e2fsck 1.45.6 (20-Mar-2020) | ||
+ | Pass 1: Checking inodes, blocks, and sizes | ||
+ | Pass 2: Checking directory structure | ||
+ | Pass 3: Checking directory connectivity | ||
+ | Pass 3A: Optimizing directories | ||
+ | Pass 4: Checking reference counts | ||
+ | Pass 5: Checking group summary information | ||
+ | | ||
+ | /dev/sdb12: ***** FILE SYSTEM WAS MODIFIED ***** | ||
+ | /dev/sdb12: 12/51200 files (0.0% non-contiguous), | ||
+ | </ | ||
+ | |||
+ | Essayez de monter **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount -t ext3 /dev/sdb12 /mnt/sdb12 | ||
+ | mount: /mnt/sdb12: wrong fs type, bad option, bad superblock on /dev/sdb12, missing codepage or helper program, or other error. | ||
+ | </ | ||
+ | |||
+ | Montez /dev/sdb12 sans spécifier le type de fichiers Ext3 et vérifiez le contenu du fichier **check_file** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount /dev/sdb12 /mnt/sdb12 | ||
+ | |||
+ | [root@centos8 ~]# ls -l /mnt/sdb12 | ||
+ | total 14 | ||
+ | -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 / | ||
+ | check file | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# dumpe2fs /dev/sdb11 | grep UUID | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem UUID: 72a6ad08-7023-4561-adcb-d434e00afed1 | ||
+ | |||
+ | [root@centos8 ~]# dumpe2fs /dev/sdb12 | grep UUID | ||
+ | dumpe2fs 1.45.6 (20-Mar-2020) | ||
+ | Filesystem UUID: b73322d4-f2e4-43bc-96ae-422d4584f3de | ||
+ | </ | ||
+ | |||
+ | ====XFS==== | ||
+ | |||
+ | XFS est un système de fichiers 64-bit journalisé de haute performance crée par SGI pour son système d' | ||
+ | |||
+ | <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 **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# umount /dev/sdb12 | ||
+ | </ | ||
+ | |||
+ | Créez un système de fichiers XFS sur la partition **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkfs.xfs -f /dev/sdb12 | ||
+ | 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 | ||
+ | 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@centos8 ~]# xfs_info /dev/sdb12 | ||
+ | meta-data=/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | data | ||
+ | | ||
+ | naming | ||
+ | log =internal log | ||
+ | | ||
+ | realtime =none | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# xfs_info --help | ||
+ | / | ||
+ | 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 /dev/sdb12 | ||
+ | xfs_admin: /dev/sdb12 contains a mounted filesystem | ||
+ | |||
+ | fatal error -- couldn' | ||
+ | |||
+ | [root@centos8 ~]# umount /dev/sdb12 | ||
+ | |||
+ | [root@centos8 ~]# xfs_admin -L my_xfs /dev/sdb12 | ||
+ | writing all SBs | ||
+ | new label = " | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que la partition XFS doit être démonté pour pouvoir utiliser la commande **xfs_admin**. | ||
+ | </ | ||
+ | |||
+ | Pour voir l' | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# xfs_admin -l /dev/sdb12 | ||
+ | label = " | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Notez que l' | ||
+ | </ | ||
+ | |||
+ | Les options de cette commande sont : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# xfs_admin --help | ||
+ | / | ||
+ | Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# xfs_admin -u /dev/sdb12 | ||
+ | UUID = 15db1b62-0866-4aa4-9ac1-3ac325a4e20f | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - La commande **xfs_metadump** est utilisée pour sauvegarder les méta-données du système de fichiers, tandis que la commande **xfs_mdrestore** est utilisée pour restaurer les les méta-données du système de fichiers. | ||
+ | </ | ||
+ | |||
+ | =====Autres Systèmes de Fichiers===== | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** - Veuillez noter que le support des systèmes de fichiers **ReiserFS**, | ||
+ | </ | ||
+ | |||
+ | ====ReiserFS==== | ||
+ | |||
+ | %%ReiserFS%% permet : | ||
+ | |||
+ | * 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@centos8 tmp]# mkisofs -r -T -o tmp.iso . | ||
+ | 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** : | ||
+ | |||
+ | < | ||
+ | [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: | ||
+ | -nobak | ||
+ | -no-bak | ||
+ | -abstract FILE Set Abstract filename | ||
+ | -A ID, -appid ID Set Application ID | ||
+ | -biblio FILE Set Bibliographic filename | ||
+ | -cache-inodes | ||
+ | -no-cache-inodes | ||
+ | -check-oldnames | ||
+ | -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 this mode. | ||
+ | -D, -disable-deep-relocation | ||
+ | Disable deep directory relocation (violates ISO9660) | ||
+ | -file-mode mode Make the mode of all plain files this mode. | ||
+ | -f, -follow-links | ||
+ | -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 help | ||
+ | -hide GLOBFILE | ||
+ | -hide-list FILE File with list of ISO9660/RR files to hide | ||
+ | -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 | ||
+ | -quiet | ||
+ | -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-min-file-size SIZE | ||
+ | -jigdo-force-md5 PATTERN | ||
+ | -jigdo-exclude PATTERN | ||
+ | -jigdo-map PATTERN1=PATTERN2 | ||
+ | Pattern(s) to map paths (e.g. Debian=/ | ||
+ | -md5-list FILE File containing MD5 sums of the files that should be checked | ||
+ | -jigdo-template-compress ALGORITHM | ||
+ | Choose to use gzip or bzip2 compression for template data; default is gzip | ||
+ | -checksum_algorithm_iso alg1, | ||
+ | Specify the checksum types desired for the output image | ||
+ | -checksum_algorithm_template alg1, | ||
+ | Specify the checksum types desired for the output jigdo template | ||
+ | -sort FILE Sort file content locations according to rules in FILE | ||
+ | -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 | ||
+ | -table-name TABLE_NAME | ||
+ | -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 | ||
+ | -no-iso-translate | ||
+ | -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 | ||
+ | -map MAPPING_FILE | ||
+ | -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. | ||
+ | </ | ||
+ | |||
+ | =====Systèmes de Fichiers Chiffrés sous RHEL/CentOS 8===== | ||
+ | |||
+ | ====LAB #21 - Créer un Système de Fichiers Chiffré avec LUKS sous RHEL/CentOS 8===== | ||
+ | |||
+ | ===Présentation=== | ||
+ | |||
+ | **LUKS** ( Linux Unified Key Setup ) permet de chiffrer l' | ||
+ | |||
+ | ===Mise en Place=== | ||
+ | |||
+ | Remplissez la partition /dev/sdb12 avec des données aléatoires : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# shred -v --iterations=1 /dev/sdb12 | ||
+ | shred: /dev/sdb12: pass 1/1 (random)... | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : L' | ||
+ | </ | ||
+ | |||
+ | Initialisez la partition avec LUKS : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb12 | ||
+ | |||
+ | WARNING! | ||
+ | ======== | ||
+ | This will overwrite data on /dev/sdb12 irrevocably. | ||
+ | |||
+ | Are you sure? (Type ' | ||
+ | Enter passphrase for /dev/sdb12: fenestros123456789 | ||
+ | Verify passphrase: fenestros123456789 | ||
+ | Key slot 0 created. | ||
+ | Command successful. | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important 60%> | ||
+ | **Important** : La passphrase ne sera pas en claire. Elle l'est ici pour vous montrer un mot de passe acceptable pour LUKS. | ||
+ | </ | ||
+ | |||
+ | Ouvrez la partition LUKS en lui donnant le nom **sdb12** : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# cryptsetup luksOpen /dev/sdb12 sdb12 | ||
+ | Enter passphrase for /dev/sdb12: fenestros123456789 | ||
+ | </ | ||
+ | |||
+ | Vérifiez que le système voit la partition : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# ls -l /dev/mapper | grep sdb12 | ||
+ | lrwxrwxrwx. 1 root root 7 Jun 2 10:03 sdb12 -> ../dm-2 | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un système de fichiers sur **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mkfs.xfs / | ||
+ | meta-data=/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | data | ||
+ | | ||
+ | naming | ||
+ | log =internal log | ||
+ | | ||
+ | realtime =none | ||
+ | </ | ||
+ | |||
+ | Montez la partition LUKS : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# mount / | ||
+ | </ | ||
+ | |||
+ | Vérifiez la présence du montage : | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# df -h | grep sdb12 | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi / | ||
+ | [root@centos8 ~]# cat / | ||
+ | sdb12 /dev/sdb12 none | ||
+ | </ | ||
+ | |||
+ | Modifiez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi /etc/fstab | ||
+ | [root@centos8 ~]# cat /etc/fstab | ||
+ | |||
+ | # | ||
+ | # /etc/fstab | ||
+ | # Created by anaconda on Fri May 8 07:35:23 2020 | ||
+ | # | ||
+ | # Accessible filesystems, | ||
+ | # 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 /dev/sdb12 | ||
+ | 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 /dev/sdb12 | ||
+ | Enter passphrase to be deleted: redhat123456789 | ||
+ | </ | ||
+ | |||
+ | Avant de poursuivre, éditez les fichiers **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# vi /etc/fstab | ||
+ | [root@centos8 ~]# cat /etc/fstab | ||
+ | |||
+ | # | ||
+ | # /etc/fstab | ||
+ | # Created by anaconda on Fri May 8 07:35:23 2020 | ||
+ | # | ||
+ | # Accessible filesystems, | ||
+ | # 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. | ||
+ | |||
+ | Options: | ||
+ | -a, --all enable all swaps from /etc/fstab | ||
+ | -d, --discard[=< | ||
+ | -e, --ifexists | ||
+ | -f, --fixpgsz | ||
+ | -o, --options < | ||
+ | -p, --priority < | ||
+ | -s, --summary | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -v, --verbose | ||
+ | |||
+ | -h, --help | ||
+ | -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%> | ||
+ | **Important** : L' | ||
+ | </ | ||
+ | |||
+ | ====La Commande swapoff==== | ||
+ | |||
+ | Dans le cas de notre exemple, la partition de swap se trouve sur **/ | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# swapoff /dev/dm-1 | ||
+ | [root@centos8 ~]# swapon -s | ||
+ | [root@centos8 ~]# | ||
+ | </ | ||
+ | |||
+ | ===Options de la Commande=== | ||
+ | |||
+ | < | ||
+ | [root@centos8 ~]# swapoff --help | ||
+ | |||
+ | Usage: | ||
+ | | ||
+ | |||
+ | Disable devices and files for paging and swapping. | ||
+ | |||
+ | Options: | ||
+ | -a, --all disable all swaps from /proc/swaps | ||
+ | -v, --verbose | ||
+ | |||
+ | -h, --help | ||
+ | -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. |