Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:centos:8:avance:l102 [2021/06/25 09:42] – created adminelearning:workbooks:centos:8:avance:l102 [2022/02/22 15:15] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
 +
 +Version : **2022.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF302 - Gestion des Disques Avancée - Raid Logiciel======+======LCF602 - Gestion du Noyau et des Quotas======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF302 - Gestion Avancée des Disques - Raid Logiciel**+  * **LCF602 - Gestion du Noyau et des Quotas**
     * Contenu du Module     * Contenu du Module
-    * Concepts RAID +    * Rôle du noyau 
-      Disques en miroir +    LAB #1 - Modules 
-      * Bandes de données +    * LAB #2 - Compilation et installation du noyau et des modules 
-    * Types de RAID +      * 2.1 Déplacer /home 
-      * RAID 0 Concaténation +      * 2.2 Préparer l'Environnement 
-      * RAID 0 Striping +      * 2.3 Préparer l'Arborescence Source du Noyau 
-      * RAID 1 Miroir +        * Le Fichier .config 
-      * RAID 1+0 Striping en Miroir +        * Le Fichier Makefile 
-      * RAID 2 - Miroir avec Contrôle d'Erreurs +      * 2.4 Paramétrage du noyau 
-      * RAID et 4 Striping avec Parité +      * 2.5 Compiler le Noyau 
-      * RAID 5 Striping avec Parité Distribuée +      * 2.6 - Installer le Nouveau Noyau 
-      * Au délà de RAID 5 +    * LAB #3 - Gestion des Quotas 
-    RAID Logiciel sous RHEL/CentOS +      * 3.1 La Commande quotacheck 
-      * Préparation du disque +      * 3.2 - La Commande edquota 
-      * Partitionnement +      3.3 - La Commande quotaon 
-      * Mise en Place du RAID 5 Logiciel+      * 3.4 - La Commande repquota 
 +      * 3.5 - La Commande quota 
 +      * 3.6 - La Commande warnquota
  
-=====Concepts RAID=====+=====Rôle du noyau=====
  
-Les solutions RAID ou //Redundant Array of Independent Disks// ou encore //Redundant Array of Inexpensive Disks// permettent la combinaison de plusieurs disques de façon à ce que ceux-ci soient vu comme un seul disque logique.+Le noyau ou //kernel// est la partie du système d'exploitation qui gère les entrées/sorties avec des périphériques. Dans certains cas il est préférable de recompiler le noyau de LinuxLa motivation de cette recompilation peut être :
  
-Les solutions RAID sont issues du travail fourni par l'université de Berkeley en Californie sur un projet de tolérances de pannesLes systèmes RAID offre maintenant plusieurs avantages :+  * la diminution de la taille du noyau, 
 +  * la prise en charge de nouveau matériel, 
 +  * l'ajout de fonctionnalités, 
 +  * l'optimisation du code, 
 +  * la correction de bogues, 
 +  * le besoin d'une fonctionnalité expérimentale. 
 +   
 +Commencez par mettre à jour CentOS 8 :
  
-    * Addition des capacités, +<code> 
-    * Amélioration des performances, +[root@centos8 ~]# dnf update 
-    * Apporter la tolérance de panne.+... 
 +[root@centos8 ~]# reboot 
 +</code>
  
-Deux concepts sont fondamentaux à la compréhension des solutions RAID.+Identifiez ensuite le noyau utilisé par votre machine virtuelle :
  
-====Disques en miroir====+<code> 
 +[root@centos8 ~]# uname -r 
 +4.18.0-305.7.1.el8_4.x86_64 
 +</code>
  
-La technique des disques en miroir consiste à dupliquer l'écriture des données sur plusieurs disques. Le miroir peut être géré par un logiciel ou par du matériel.+=====LAB #1 - Modules=====
  
-====Bandes de données====+Dans le cas d'une utilisation courante de Linux, il est cependant préférable de faire appel aux **modules**. Les modules se trouvent dans le répertoire **/lib/modules/<version-du-noyau>** :
  
-La technique des bandes de données, autrement appelée //data striping// consiste à couper les données à enregistrer en segments séquentiels et contigus pour les enregistrer sur plusieurs disques physiquesL'ensemble des segments constitue alors un disque logique ou //striped disk//Cette technique peut être améliorée en déposant une bande de parité, calculée à partir des données des autres bandes, afin de pouvoir reconstituer une bande de données défaillante.+<code> 
 +[root@centos8 ~]# ls /lib/modules/`uname -r`/ 
 +bls.conf           modules.builtin      modules.networking   System.map 
 +build              modules.builtin.bin  modules.order        updates 
 +config             modules.dep          modules.softdep      vdso 
 +kernel             modules.dep.bin      modules.symbols      vmlinuz 
 +modules.alias      modules.devname      modules.symbols.bin  weak-updates 
 +modules.alias.bin  modules.drm          source 
 +modules.block      modules.modesetting  symvers.gz 
 +</code>
  
-=====Types de RAID=====+Les commandes pour manipuler les modules sont :
  
-====RAID 0 - Concaténation====+  * insmod 
 +  * rmmod 
 +  * lsmod 
 +  * modprobe
  
-Création de volume par récupération de l'espace libre sur un ou plusieurs disques. Le principe de la concaténation est la création d'un volume à bandes où chaque bande est une tranche.+Par exemple :
  
-{{:linux:raid0c.gif|}}+<code> 
 +[root@centos8 ~]# lsmod 
 +Module                  Size  Used by 
 +xt_CHECKSUM            16384  1 
 +ipt_MASQUERADE         16384 
 +xt_conntrack           16384 
 +ipt_REJECT             16384 
 +nft_compat             20480  16 
 +nf_nat_tftp            16384  0 
 +nft_objref             16384 
 +nf_conntrack_tftp      16384  3 nf_nat_tftp 
 +nft_counter            16384  33 
 +tun                    53248  1 
 +bridge                192512 
 +stp                    16384  1 bridge 
 +llc                    16384  2 bridge,stp 
 +nft_fib_inet           16384 
 +nft_fib_ipv4           16384  1 nft_fib_inet 
 +nft_fib_ipv6           16384  1 nft_fib_inet 
 +nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet 
 +nft_reject_inet        16384  5 
 +nf_reject_ipv4         16384  2 nft_reject_inet,ipt_REJECT 
 +nf_reject_ipv6         16384  1 nft_reject_inet 
 +nft_reject             16384  1 nft_reject_inet 
 +nft_ct                 20480  19 
 +nf_tables_set          49152  21 
 +nft_chain_nat          16384  12 
 +nf_nat                 45056  3 ipt_MASQUERADE,nf_nat_tftp,nft_chain_nat 
 +nf_conntrack          172032  6 xt_conntrack,nf_nat,nf_conntrack_tftp,nft_ct,ipt_MASQUERADE,nf_nat_tftp 
 +nf_defrag_ipv6         20480  1 nf_conntrack 
 +nf_defrag_ipv4         16384  1 nf_conntrack 
 +ip_set                 49152 
 +nf_tables             172032  414 nft_ct,nft_compat,nft_reject_inet,nft_fib_ipv6,nft_objref,nft_fib_ipv4,nft_counter,nft_chain_nat,nf_tables_set,nft_reject,nft_fib,nft_fib_inet 
 +nfnetlink              16384  4 nft_compat,nf_tables,ip_set 
 +sunrpc                540672 
 +ext4                  761856 
 +mbcache                16384  1 ext4 
 +jbd2                  131072  1 ext4 
 +virtio_balloon         20480 
 +pcspkr                 16384 
 +i2c_piix4              24576  0 
 +joydev                 24576 
 +ip_tables              28672  0 
 +xfs                  1515520 
 +libcrc32c              16384  4 nf_conntrack,nf_nat,nf_tables,xfs 
 +sr_mod                 28672 
 +sd_mod                 53248 
 +cdrom                  65536  1 sr_mod 
 +t10_pi                 16384  1 sd_mod 
 +sg                     40960 
 +ata_generic            16384  0 
 +bochs_drm              16384  1 
 +drm_vram_helper        28672  1 bochs_drm 
 +drm_kms_helper        233472  4 drm_vram_helper,bochs_drm 
 +syscopyarea            16384  1 drm_kms_helper 
 +sysfillrect            16384  1 drm_kms_helper 
 +sysimgblt              16384  1 drm_kms_helper 
 +fb_sys_fops            16384  1 drm_kms_helper 
 +drm_ttm_helper         16384  1 drm_vram_helper 
 +ttm                   114688  2 drm_vram_helper,drm_ttm_helper 
 +drm                   569344  7 drm_kms_helper,drm_vram_helper,bochs_drm,drm_ttm_helper,ttm 
 +ahci                   40960 
 +libahci                40960  1 ahci 
 +virtio_net             53248 
 +net_failover           24576  1 virtio_net 
 +ata_piix               36864 
 +serio_raw              16384  0 
 +failover               16384  1 net_failover 
 +libata                270336  4 ata_piix,libahci,ahci,ata_generic 
 +dm_mirror              28672  0 
 +dm_region_hash         20480  1 dm_mirror 
 +dm_log                 20480  2 dm_region_hash,dm_mirror 
 +dm_mod                151552  8 dm_log,dm_mirror 
 +fuse                  151552 
 +</code>
  
-===Avantages===+Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement le module passé en argument mais également ses dépendances :
  
-  * Récupération de l'espace disque.+<code> 
 +[root@centos8 ~]# modprobe bonding 
 +[root@centos8 ~]# lsmod | more 
 +Module                  Size  Used by 
 +bonding               196608 
 +xt_CHECKSUM            16384  1 
 +ipt_MASQUERADE         16384 
 +xt_conntrack           16384 
 +ipt_REJECT             16384 
 +nft_compat             20480  16 
 +nf_nat_tftp            16384  0 
 +nft_objref             16384 
 +nf_conntrack_tftp      16384  3 nf_nat_tftp 
 +nft_counter            16384  33 
 +tun                    53248  1 
 +bridge                192512 
 +stp                    16384  1 bridge 
 +llc                    16384  2 bridge,stp 
 +nft_fib_inet           16384 
 +nft_fib_ipv4           16384  1 nft_fib_inet 
 +nft_fib_ipv6           16384  1 nft_fib_inet 
 +nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet 
 +nft_reject_inet        16384  5 
 +nf_reject_ipv4         16384  2 nft_reject_inet,ipt_REJECT 
 +nf_reject_ipv6         16384  1 nft_reject_inet 
 +--More-- 
 +</code>
  
-===Inconvénients===+Pour supprimer un module, on peut utiliser la commande **rmmod** ou **modprobe -r**. Cette dernière essaie de supprimer les dépendances non-utilisées :
  
-  * Pas de protection des données+<code> 
-  * Pas d'augmentation des performances d'E/S.+[root@centos8 ~]# modprobe -r bonding 
 +[root@centos8 ~]# lsmod | more 
 +Module                  Size  Used by 
 +xt_CHECKSUM            16384  1 
 +ipt_MASQUERADE         16384 
 +xt_conntrack           16384 
 +ipt_REJECT             16384 
 +nft_compat             20480  16 
 +nf_nat_tftp            16384  0 
 +nft_objref             16384 
 +nf_conntrack_tftp      16384  3 nf_nat_tftp 
 +nft_counter            16384  33 
 +tun                    53248  1 
 +bridge                192512 
 +stp                    16384  1 bridge 
 +llc                    16384  2 bridge,stp 
 +nft_fib_inet           16384  
 +nft_fib_ipv4           16384  1 nft_fib_inet 
 +nft_fib_ipv6           16384  1 nft_fib_inet 
 +nft_fib                16384  3 nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet 
 +nft_reject_inet        16384  5 
 +nf_reject_ipv4         16384  2 nft_reject_inet,ipt_REJECT 
 +nf_reject_ipv6         16384  1 nft_reject_inet 
 +nft_reject             16384  1 nft_reject_inet 
 +--More-- 
 +</code>
  
-====RAID 0 Striping====+Les dépendances des modules sont résolues par la commande **modprobe** grâce aux fichier **/lib/modules/<version-du-noyau>/modules.dep**. Ce dernier peut être créé manuellement grâce à la commande **depmod** :
  
-Création de volume sur plusieurs disques afin d'augmenter les performances d'E/SLe principe du striping est la création d'un volume à bandes réparties sur plusieurs tranchesLa taille de la bande doit être fonction des données à écrire sur le volume (16k, 32k, 64k, etc.) Cette taille est choisie à la création du volume.+<code> 
 +[root@centos8 ~]# more /lib/modules/`uname -r`/modules.dep 
 +kernel/arch/x86/events/amd/power.ko.xz: 
 +kernel/arch/x86/events/intel/intel-uncore.ko.xz: 
 +kernel/arch/x86/events/intel/intel-cstate.ko.xz: 
 +kernel/arch/x86/events/rapl.ko.xz: 
 +kernel/arch/x86/kernel/cpu/mce/mce-inject.ko.xz: 
 +kernel/arch/x86/crypto/des3_ede-x86_64.ko.xz: kernel/crypto/des_generic.ko.xz 
 +kernel/arch/x86/crypto/camellia-x86_64.ko.xz: 
 +kernel/arch/x86/crypto/blowfish-x86_64.ko.xz: kernel/crypto/blowfish_common.ko.xz 
 +kernel/arch/x86/crypto/twofish-x86_64.ko.xz: kernel/crypto/twofish_common.ko.xz 
 +kernel/arch/x86/crypto/twofish-x86_64-3way.ko.xz: kernel/arch/x86/crypto/twofish-x86_64.ko. 
 +xz kernel/crypto/twofish_common.ko.xz 
 +kernel/arch/x86/crypto/chacha20-x86_64.ko.xz: kernel/crypto/chacha20_generic.ko.xz 
 +kernel/arch/x86/crypto/serpent-sse2-x86_64.ko.xz: kernel/crypto/serpent_generic.ko.xz 
 +kernel/arch/x86/crypto/ghash-clmulni-intel.ko.xz: 
 +kernel/arch/x86/crypto/crc32c-intel.ko.xz: 
 +kernel/arch/x86/crypto/crc32-pclmul.ko.xz: 
 +kernel/arch/x86/crypto/sha512-ssse3.ko.xz: kernel/crypto/sha512_generic.ko.xz 
 +kernel/arch/x86/crypto/crct10dif-pclmul.ko.xz: 
 +kernel/arch/x86/crypto/poly1305-x86_64.ko.xz: kernel/crypto/poly1305_generic.ko.xz 
 +kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko.xz: kernel/arch/x86/crypto/camellia-x86 
 +_64.ko.xz 
 +kernel/arch/x86/crypto/cast5-avx-x86_64.ko.xz: kernel/crypto/cast5_generic.ko.xz kernel/cry 
 +--More--(0%) 
 +</code>
  
-{{:linux:raid0s.gif|}}+Il est possible d'obtenir des informations sur un module grâce à la commande **modinfo** :
  
-===Avantages===+<code> 
 +[root@centos8 ~]# modinfo bonding 
 +filename:       /lib/modules/4.18.0-305.7.1.el8_4.x86_64/kernel/drivers/net/bonding/bonding.ko.xz 
 +author:         Thomas Davis, tadavis@lbl.gov and many others 
 +description:    Ethernet Channel Bonding Driver 
 +license:        GPL 
 +alias:          rtnl-link-bond 
 +rhelversion:    8.4 
 +srcversion:     445F4CC9A2F7E64E3A87FD0 
 +depends:         
 +intree:         Y 
 +name:           bonding 
 +vermagic:       4.18.0-305.7.1.el8_4.x86_64 SMP mod_unload modversions  
 +sig_id:         PKCS#
 +signer:         CentOS kernel signing key 
 +sig_key:        3B:5A:0A:B8:8E:4A:51:C0:AA:FF:97:FD:CB:94:D6:B6:D2:46:B8:17 
 +sig_hashalgo:   sha256 
 +signature:      B2:3A:20:BE:2B:F3:E0:5A:1A:74:0E:69:76:40:2A:D4:80:10:2C:5A: 
 +                B7:F1:1E:7A:71:13:29:F0:0A:4A:28:EE:81:33:C8:C2:5C:BD:FF:E4: 
 +                3F:A9:15:A3:9A:0E:A7:98:9E:99:06:23:10:47:D3:B2:48:B3:F1:61: 
 +                BE:4B:B0:FC:62:B9:3B:D6:64:CC:E3:29:01:4D:91:92:32:FD:EB:54: 
 +                44:F1:2C:1B:23:30:F1:3E:EE:69:EA:94:54:D9:A0:8D:16:53:F5:20: 
 +                DE:38:A0:13:E8:2F:89:66:CB:11:D7:AA:30:37:7B:EC:DF:A1:69:29: 
 +                7F:4E:80:4D:34:6E:F2:07:01:FA:18:23:94:58:10:C6:97:27:68:B9: 
 +                D8:08:5E:9D:00:17:F4:1B:48:BE:CA:BF:5C:5A:A8:6D:36:EE:3F:95: 
 +                BA:BE:59:82:EE:7B:CA:BB:32:1E:E3:05:ED:C9:C2:C8:10:64:B9:29: 
 +                B8:09:4B:79:42:65:1A:FA:99:96:BA:7E:2D:6E:75:F1:91:0E:F4:9A: 
 +                8F:11:10:9F:70:BD:35:06:BE:F0:4C:D8:AB:D5:C4:E1:B3:A2:2A:CA: 
 +                58:CA:9E:16:1D:0C:BE:9C:37:A1:82:20:6F:24:CD:23:63:F7:F5:BC: 
 +                6E:81:14:F0:52:DA:04:0E:9D:CC:17:60:2D:B0:D8:BD:6E:2C:AD:E7: 
 +                50:48:49:B6:57:96:AC:FD:A4:29:33:01:43:92:32:88:A2:AC:CB:93: 
 +                2F:C3:29:F3:01:77:84:00:AB:AA:C8:59:43:F1:DA:90:7B:5F:9A:A9: 
 +                CA:60:97:34:85:5E:98:56:73:03:0D:D7:8D:A6:AB:51:D4:8C:92:91: 
 +                0C:0A:BA:6B:92:01:16:FE:8B:86:80:11:5F:8E:21:BD:C2:2F:02:58: 
 +                A6:CF:6C:E3:87:28:8B:4D:CE:54:8C:00:B3:F7:AE:9E:01:81:1E:83: 
 +                AE:6D:58:B0:10:98:36:D9:69:76:E2:C0:E2:15:94:3B:D4:14:19:D9: 
 +                59:86:75:31 
 +parm:           max_bonds:Max number of bonded devices (int) 
 +parm:           tx_queues:Max number of transmit queues (default 16) (int) 
 +parm:           num_grat_arp:Number of peer notifications to send on failover event (alias of num_unsol_na) (int) 
 +parm:           num_unsol_na:Number of peer notifications to send on failover event (alias of num_grat_arp) (int) 
 +parm:           miimon:Link check interval in milliseconds (int) 
 +parm:           updelay:Delay before considering link up, in milliseconds (int) 
 +parm:           downdelay:Delay before considering link down, in milliseconds (int) 
 +parm:           use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int) 
 +parm:           mode:Mode of operation; 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp) 
 +parm:           primary:Primary network device to use (charp) 
 +parm:           primary_reselect:Reselect primary slave once it comes up; 0 for always (default), 1 for only if speed of primary is better, 2 for only on active slave failure (charp) 
 +parm:           lacp_rate:LACPDU tx rate to request from 802.3ad partner; 0 for slow, 1 for fast (charp) 
 +parm:           ad_select:802.3ad aggregation selection logic; 0 for stable (default), 1 for bandwidth, 2 for count (charp) 
 +parm:           min_links:Minimum number of available links before turning on carrier (int) 
 +parm:           xmit_hash_policy:balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; 0 for layer 2 (default), 1 for layer 3+4, 2 for layer 2+3, 3 for encap layer 2+3, 4 for encap layer 3+4, 5 for vlan+srcmac (charp) 
 +parm:           arp_interval:arp interval in milliseconds (int) 
 +parm:           arp_ip_target:arp targets in n.n.n.n form (array of charp) 
 +parm:           arp_validate:validate src/dst of ARP probes; 0 for none (default), 1 for active, 2 for backup, 3 for all (charp) 
 +parm:           arp_all_targets:fail on any/all arp targets timeout; 0 for any (default), 1 for all (charp) 
 +parm:           fail_over_mac:For active-backup, do not set all slaves to the same MAC; 0 for none (default), 1 for active, 2 for follow (charp) 
 +parm:           all_slaves_active:Keep all frames received on an interface by setting active flag for all slaves; 0 for never (default), 1 for always. (int) 
 +parm:           resend_igmp:Number of IGMP membership reports to send on link failure (int) 
 +parm:           packets_per_slave:Packets to send per slave in balance-rr mode; 0 for a random slave, 1 packet per slave (default), >1 packets per slave. (int) 
 +parm:           lp_interval:The number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch. The default is 1. (uint) 
 +</code>
  
-  Augmentation des performances d'E/S par écriture en parallèle sur les disques.+Dernièrement, les fichiers dans le repertoire **/etc/modprobe.d** sont utilisés pour spécifier les options éventuelles à passer aux modules lors de leur chargement ainsi que les alias utilisés pour leur faire référence :
  
-===Inconvénients===+<code> 
 +[root@centos8 ~]# ls /etc/modprobe.d 
 +firewalld-sysctls.conf  lockd.conf  nvdimm-security.conf  tuned.conf 
 +kvm.conf                mlx4.conf   truescale.conf        vhost.conf
  
-  * Pas de protection des données.+[root@centos8 ~]# cat /etc/modprobe.d/kvm.conf  
 +# Setting modprobe kvm_intel/kvm_amd nested = 1 
 +# only enables Nested Virtualization until the next reboot or 
 +# module reload. Uncomment the option applicable 
 +# to your system below to enable the feature permanently. 
 +
 +# User changes in this file are preserved across upgrades. 
 +
 +# For Intel 
 +#options kvm_intel nested=1 
 +
 +# For AMD 
 +#options kvm_amd nested=1 
 +</code>
  
-====RAID 1 Miroir====+=====LAB #2 Compilation et installation du noyau et des modules=====
  
-Création d'un volume où les disques sont en miroir. Quand les deux disques sont connectés à des contrôleurs de disques différents, on parle de //duplexing// :+Activez le dépôt **CentOS-Linux-PowerTools** en passant la directive **enabled** à **1** :
  
-{{:linux:raid1m.gif|}}+<code> 
 +[root@centos8 ~]# vi /etc/yum.repos.d/CentOS-Linux-PowerTools.repo  
 +[root@centos8 ~]# cat /etc/yum.repos.d/CentOS-Linux-PowerTools.repo  
 +# CentOS-Linux-PowerTools.repo 
 +
 +# The mirrorlist system uses the connecting IP address of the client and the 
 +# update status of each mirror to pick current mirrors that are geographically 
 +# close to the client.  You should use this for CentOS updates unless you are 
 +# manually picking other mirrors. 
 +
 +# If the mirrorlist does not work for you, you can try the commented out 
 +# baseurl line instead.
  
-===Avantages===+[powertools] 
 +name=CentOS Linux $releasever - PowerTools 
 +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra 
 +#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/ 
 +gpgcheck=1 
 +enabled=1 
 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial 
 +</code>
  
-  * Protection des données contre une défaillance d'un disque.+Installez maintenant les paquets nécessaires :
  
-===Inconvénients===+<code> 
 +[root@centos8 ~]# dnf groupinstall "Development Tools" 
 +... 
 +[root@centos8 ~]# dnf install asciidoc audit-libs-devel bash bc binutils binutils-devel bison diffutils elfutils elfutils-devel elfutils-libelf-devel findutils flex gawk gcc gettext gzip hmaccalc hostname make module-init-tools ncurses-devel net-tools newt-devel numactl-devel openssl patch pciutils-devel perl perl-ExtUtils-Embed pesign redhat-rpm-config rpm-build rpmdevtools sh-utils tar xmlto xz zlib-devel 
 +... 
 +</code>
  
-  * Coûteux à cause de l'augmentation du nombre de disques.+====2.1 - Déplacer /home====
  
-====RAID 1+0 Striping en Miroir====+<WRAP center round alert 60%> 
 +**Important** Il n'est pas conseillé de compiler en tant que root pour des raisons de sécurité. Pour pouvoir utiliser le compte d'un utilisateur pour créer un nouveau noyau, celui-ci doit disposer de plus de 10 Go d'espace libre. 
 +</WRAP>
  
-Le RAID 1+0 ou encore 0+1 est une technique qui réunit le RAID 0 et le RAID 1On l'appelle aussi un RAID **exotique**:+<WRAP center round todo 60%> 
 +**A faire** - **Déconnectez-vous** de votre session **CentOS8_SSH_10.0.2.45** et re-connectez-vous à la VM en tant que root en utilisant la connexion **CentOS8_ROOT_10.0.2.45**. 
 +</WRAP>
  
-{{:linux:raid10.gif|}}+Créez ensuite une seule partition sur **/dev/sdc** :
  
-===Avantages===+<code> 
 +[root@centos8 ~]# fdisk /dev/sdc
  
-  * Protection des données contre une défaillance d'un disque+Welcome to fdisk (util-linux 2.32.1). 
-  * Augmentation des performances d'E/S par écriture en parallèle sur les disques.+Changes will remain in memory only, until you decide to write them
 +Be careful before using the write command.
  
-===Inconvénients===+Device does not contain a recognized partition table. 
 +Created a new DOS disklabel with disk identifier 0xc321702b.
  
-  * Coûteux à cause de l'augmentation du nombre de disques.+Command (m for help): n 
 +Partition type 
 +   p   primary (0 primary, 0 extended, 4 free) 
 +     extended (container for logical partitions) 
 +Select (default p): 
  
-====RAID 2 Miroir avec Contrôle d'Erreurs====+Using default response p. 
 +Partition number (1-4, default 1):  
 +First sector (2048-41943039, default 2048):  
 +Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): 
  
-Le RAID 2 est une technique de miroir avec contrôle de correction d'erreurs (EEC). De nos jours cette technique est peu utilisée, ayant été remplacée par les RAID 3, 4 et 5.+Created a new partition 1 of type 'Linux' and of size 20 GiB.
  
-====RAID 3 et 4 Striping avec Parité====+Command (m for help): w 
 +The partition table has been altered. 
 +Calling ioctl() to re-read partition table. 
 +Syncing disks. 
 +</code>
  
-Les RAID 3 et 4 sont des technologies avec bandes de parité distribuées sur un seul disque :+Créez maintenant un système de fichiers ext4 sur **/dev/sdc1** :
  
-{{:linux:raid34.gif|}}+<code> 
 +[root@centos8 ~]# mkfs.ext4 /dev/sdc1 
 +mke2fs 1.45.6 (20-Mar-2020) 
 +Discarding device blocksdone                             
 +Creating filesystem with 16776960 4k blocks and 4194304 inodes 
 +Filesystem UUIDdc92c0d7-919b-4fff-8719-53e9e7e628dd 
 +Superblock backups stored on blocks:  
 +        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,  
 +        4096000, 7962624, 11239424
  
-En RAID 3, la taille des segments n’est pas modifiable et est fixée à 512 octets (en RAID 3 un segment = un secteur de disque dur = 512 octets).+Allocating group tablesdone                             
 +Writing inode tables: done                             
 +Creating journal (65536 blocks): done 
 +Writing superblocks and filesystem accounting information: done  
 +</code>
  
-En RAID 4, la taille des segments est variable et se modifie en temps réel. Cela implique que les informations de parité doivent être mise à jour à chaque écriture afin de vérifier si la taille des segments a été modifiée. +Montez **/dev/sdc1** sur /mnt :
  
-===Avantages===+<code> 
 +[root@centos8 ~]# mount /dev/sdc1 /mnt 
 +</code>
  
-  * Protection des données contre une défaillance d'un disque.+Copiez le contenu de /home vers /mnt :
  
-===Inconvénients===+<code> 
 +[root@centos8 ~]# cp -a /home/* /mnt 
 +</code>
  
-  * Création d'un goulot d'étranglement des données à cause de l'écriture des données de parité sur un seul disque.+Démontez /dev/sdc1 et déplacez /home vers /root :
  
-====RAID 5 - Striping avec Parité Distribuée====+<code> 
 +[root@centos8 ~]# umount /mnt 
 +[root@centos8 ~]# mv /home /root 
 +</code>
  
-Le RAID 5 est une technologie avec bandes de parité distribuées sur plusieurs disques :+Identifiez l'UUID de /dev/sdc1 :
  
-{{:linux:raid5.gif|}}+<code> 
 +[root@centos8 ~]# ls -l /dev/disk/by-uuid/ | grep sdc1 
 +lrwxrwxrwx. 1 root root 10 Jul 19 12:02 f76d6b66-985b-4a91-af9c-4987e8c1443c -> ../../sdc 
 +[root@centos8 ~]#  
 +</code>
  
-===Avantages===+Editez le fichier **/etc/fstab** et ajoutez une ligne pour /dev/sdc1 :
  
-  * Protection des données contre une défaillance d'un disque, +<code> 
-  * Evite le goulot d'étranglement d'un seul disque de parité.+[root@centos8 ~]# vi /etc/fstab 
 +[root@centos8 ~]# cat /etc/fstab
  
-===Inconvénients===+
 +# /etc/fstab 
 +# Created by anaconda on Wed Jun 16 06:21:32 2021 
 +
 +# Accessible filesystems, by reference, are maintained under '/dev/disk/'
 +# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. 
 +
 +# After editing this file, run 'systemctl daemon-reload' to update systemd 
 +# units generated from this file. 
 +
 +/dev/mapper/cl_centos8-root /                       xfs     defaults        0 0 
 +UUID=1c04981e-5317-4b73-9695-3ce25246835d /boot                   ext4    defaults        1 2 
 +/dev/mapper/cl_centos8-swap swap                    swap    defaults        0 0 
 +UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home     ext4          defaults            1 2 
 +</code>
  
-  * Lecture moins performante qu'avec RAID 3 et 4.+Créez le point de montage /home :
  
-====Au délà de RAID 5====+<code> 
 +[root@centos8 ~]# mkdir /home 
 +</code>
  
-Il existe aussi deux autres technologies RAID, toute deux issues de la technologie RAID 5 :+Montez /dev/sdc1 :
  
-  * RAID 6 +<code> 
-    //Disk Striping with Double Distributed Parity// +[root@centos8 ~]# mount -a 
-  * RAID TP +[root@centos8 ~]# mount 
-    //Disk Striping with Triple Distributed Parity//+sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) 
 +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) 
 +devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1882880k,nr_inodes=470720,mode=755) 
 +securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) 
 +tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel) 
 +devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000) 
 +tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755) 
 +tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755) 
 +cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) 
 +pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel) 
 +bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) 
 +cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb) 
 +cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory) 
 +cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu,cpuacct) 
 +cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,rdma) 
 +cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids) 
 +cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset) 
 +cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event) 
 +cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer) 
 +cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio) 
 +cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls,net_prio) 
 +cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices) 
 +none on /sys/kernel/tracing type tracefs (rw,relatime,seclabel) 
 +configfs on /sys/kernel/config type configfs (rw,relatime) 
 +/dev/mapper/cl_centos8-root on / type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota) 
 +selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime) 
 +mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel) 
 +hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M) 
 +debugfs on /sys/kernel/debug type debugfs (rw,relatime,seclabel) 
 +systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=40,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=6022) 
 +fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime) 
 +/dev/sda1 on /boot type ext4 (rw,relatime,seclabel) 
 +sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime) 
 +tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700,uid=1000,gid=1000) 
 +tmpfs on /run/user/42 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700,uid=42,gid=42) 
 +gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000) 
 +tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=382500k,mode=700) 
 +gvfsd-fuse on /run/user/0/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0) 
 +/dev/sdc1 on /home type ext4 (rw,relatime,seclabel) 
 +</code>
  
-=====RAID Logiciel sous RHEL/CentOS=====+Notez la taille de /home :
  
-====Préparation du disque====+<code> 
 +[root@centos8 ~]# df -h 
 +Filesystem                   Size  Used Avail Use% Mounted on 
 +devtmpfs                     1.8G      1.8G   0% /dev 
 +tmpfs                        1.9G      1.9G   0% /dev/shm 
 +tmpfs                        1.9G  9.4M  1.9G   1% /run 
 +tmpfs                        1.9G      1.9G   0% /sys/fs/cgroup 
 +/dev/mapper/cl_centos8-root   28G  5.2G   23G  19% / 
 +/dev/sda1                    976M  289M  620M  32% /boot 
 +tmpfs                        374M   16K  374M   1% /run/user/1000 
 +tmpfs                        374M  1.2M  373M   1% /run/user/42 
 +/dev/sdc1                     63G   67M   60G   1% /home 
 +</code> 
 + 
 +<WRAP center round todo 60%> 
 +**A faire** - **Déconnectez-vous** de votre session **CentOS8_ROOT_10.0.2.45** et re-connectez-vous à la VM en tant que trainee en utilisant la connexion **CentOS8_SSH_10.0.2.45**. 
 +</WRAP>
  
-===Partitionnement===+====2.2 - Préparer l'Environnement====
  
-Suite à votre LAB de la leçon **Gestion des Disques et le Swap**, votre disque comporte 12 partitions :+Pour créer l'arborescence de l'environnement de création de paquets dans /home/trainee, utilisez la commande **rpmdev-setuptree** :
  
 <code> <code>
-[root@centos7 ~]# fdisk -l+[trainee@centos8 ~]$ rpmdev-setuptree 
 +...> 
 +[trainee@centos8 ~]$ ls -laR rpmbuild/ 
 +rpmbuild/: 
 +total 28 
 +drwxrwxr-x.  7 trainee trainee 4096 Jul 19 12:10 . 
 +drwxr-xr-x. 17 trainee trainee 4096 Jul 19 12:10 .. 
 +drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 BUILD 
 +drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 RPMS 
 +drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SOURCES 
 +drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SPECS 
 +drwxrwxr-x.  2 trainee trainee 4096 Jul 19 12:10 SRPMS
  
-Disk /dev/sda21.5 GB, 21474836480 bytes, 41943040 sectors +rpmbuild/BUILD
-Units = sectors of 1 * 512 = 512 bytes +total 8 
-Sector size (logical/physical)512 bytes / 512 bytes +drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . 
-I/O size (minimum/optimal)512 bytes / 512 bytes +drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 ..
-Disk label type: dos +
-Disk identifier: 0x000c5a90+
  
-   Device Boot      Start         End      Blocks   Id  System +rpmbuild/RPMS: 
-/dev/sda1          2048      411647      204800   83  Linux +total 8 
-/dev/sda2          411648    20891647    10240000   83  Linux +drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . 
-/dev/sda3        20891648    25083903     2096128   82  Linux swap / Solaris +drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. 
-/dev/sda4        25083904    41943039     8429568    5  Extended + 
-/dev/sda5        25085952    26109951      512000   fd  Linux raid autodetect +rpmbuild/SOURCES: 
-/dev/sda6        26112000    26521599      204800   8e  Linux LVM +total 8 
-/dev/sda7        26523648    27138047      307200   8e  Linux LVM +drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . 
-/dev/sda8        27140096    28164095      512000   fd  Linux raid autodetect +drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. 
-/dev/sda9        28166144    28985343      409600   8e  Linux LVM + 
-/dev/sda10       28987392    30011391      512000   fd  Linux raid autodetect +rpmbuild/SPECS: 
-/dev/sda11       30013440    31037439      512000   fd  Linux raid autodetect +total 8 
-/dev/sda12       31039488    31449087      204800   83  Linux+drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . 
 +drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 .. 
 + 
 +rpmbuild/SRPMS: 
 +total 8 
 +drwxrwxr-x. 2 trainee trainee 4096 Jul 19 12:10 . 
 +drwxrwxr-x. 7 trainee trainee 4096 Jul 19 12:10 ..
 </code> </code>
  
-====Mise en Place du RAID 5 Logiciel====+Téléchargez le rpm source du noyau :
  
-Dans le cas de cet exemple les quatre partitions concernées par la mise en place d'un RAID 5 sont :+<code> 
 +[trainee@centos8 ~]$ uname -a 
 +Linux centos8.ittraining.loc 4.18.0-305.7.1.el8_4.x86_64 #1 SMP Tue Jun 29 21:55:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  
-<file> +[trainee@centos8 ~]$ cat /etc/centos-release 
-/dev/sda5        25085952    26109951      512000   fd  Linux raid autodetect +CentOS Linux release 8.4.2105
-/dev/sda8        27140096    28164095      512000   fd  Linux raid autodetect +
-/dev/sda10       28987392    30011391      512000   fd  Linux raid autodetect +
-/dev/sda11       30013440    31037439      512000   fd  Linux raid autodetect +
-</file>+
  
-La création d'une unité RAID avec la commande **mdadm** se fait grâce aux options passées en arguments à la commande :+[trainee@centos8 ~]$ wget https://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/kernel-4.18.0-305.7.1.el8_4.src.rpm 
 +--2021-07-14 02:54:14--  https://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/kernel-4.18.0-305.7.1.el8_4.src.rpm 
 +Resolving vault.centos.org (vault.centos.org)... 81.171.33.194, 2a05:d014:10:7803:4af1:9320:7050:d28e 
 +Connecting to vault.centos.org (vault.centos.org)|81.171.33.194|:443... connected. 
 +HTTP request sent, awaiting response... 200 OK 
 +Length: 123000617 (117M) [application/x-rpm] 
 +Saving to: ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ 
 + 
 +kernel-4.18.0-305.7.1. 100%[===========================>] 117.30M  1.49MB/   in 79s      
 + 
 +2021-07-14 02:55:33 (1.49 MB/s) - ‘kernel-4.18.0-305.7.1.el8_4.src.rpm’ saved [123000617/123000617] 
 +</code> 
 + 
 +Installez maintenant les dépendances pour le rpm source en tant que root :
  
 <code> <code>
-mdadm --create <unité RAID> [options<unités physiques>+[trainee@centos8 ~]$ su - 
 +Mot de passe : fenestros 
 + 
 +[root@centos8 ~]# dnf install yum-utils 
 +... 
 + 
 +[root@centos8 ~]# yum-builddep /home/trainee/kernel-4.18.0-305.7.1.el8_4.src.rpm  
 +...
 </code> </code>
  
-Par exemple, saisissez la commande suivante :+Installez maintenant le paquet **kernel-4.18.0-305.7.1.el8_4.src.rpm** :
  
 <code> <code>
-[root@centos7 ~]# mdadm --create /dev/md1 --level=5 --raid-devices=3 /dev/sda5 /dev/sda8 /dev/sda11 +[root@centos8 ~]# exit 
-mdadmDefaulting to version 1.2 metadata +logout 
-mdadmarray /dev/md1 started.+[trainee@centos8 ~]$ rpm -Uvh kernel-4.18.0-305.7.1.el8_4.src.rpm 
 +Updating installing... 
 +   1:kernel-4.18.0-305.7.1.el8_4      warning: user mockbuild does not exist using root 
 +warning: group mockbuild does not exist using root 
 +warning: user mockbuild does not exist using root 
 +warninggroup mockbuild does not exist - using root 
 +warninguser mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +################################# [100%] 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root 
 +warning: user mockbuild does not exist - using root 
 +warning: group mockbuild does not exist - using root
 </code> </code>
  
-Les options dans la ligne de commande sont :+<WRAP center round important 60%> 
 +**Important** - Les erreurs sont sans importance. 
 +</WRAP>
  
-^ Option Courte ^ Option Longue ^ Description ^ +====2.3 Préparer l'Arborescence Source du Noyau====
-| -l | - -level | Le niveau RAID - **linear, 0,1,2,4 ou 5** | +
--n | - -raid-devices=<nombre> | Le nombre de périphériques actifs dans le RAID |+
  
-Les autres options de la commande **mdadm** peuvent être visualisées grâce à la commande suivante :+Naviguez vers le repertoire **~/rpmbuild/SPECS** et utilisez la commande **rpmbuild** pour préparer l'arborescence source du noyau :
  
 <code> <code>
-[root@centos7 ~]# mdadm --help-options +[trainee@centos7 ~]$ cd ~/rpmbuild/SPECS 
-Any parameter that does not start with '-' is treated as a device name +[trainee@centos7 SPECS]$ rpmbuild -bp --target=$(uname -m) kernel.spec 
-or, for --examine-bitmap, a file name+..
-The first such name is often the name of an md device Subsequent +</code>
-names are often names of component devices.+
  
-Some common options are: +A l'issu du processusexaminez l'arborescence :
-  --help        -h   : General help message orafter above option, +
-                       mode specific help message +
-  --help-options     : This help message +
-  --version     -V   : Print version information for mdadm +
-  --verbose     -v   : Be more verbose about what is happening +
-  --quiet       -q   : Don't print un-necessary messages +
-  --brief       -b   : Be less verbose, more brief +
-  --export      -Y   : With --detail, --detail-platform or --examine use +
-                       key=value format for easy import into environment +
-  --force       -f   Override normal checks and be more forceful+
  
-  --assemble    -  : Assemble an array +<code> 
-  --build       -  : Build an array without metadata +[trainee@centos8 SPECS]$ ls -la ~/rpmbuild/BUILD/kernel-4.18.0-305.7.1.el8_4/linux-4.18.0-305.7.1.el8.x86_64/ 
-  --create      -  : Create a new array +total 812 
-  --detail      -  : Display details of an array +drwxr-xr-x.  26 trainee trainee   4096 Jul 14 03:13 . 
-  --examine     -  : Examine superblock on an array component +drwxr-xr-x.   3 trainee trainee   4096 Jul 14 03:12 .. 
-  --examine-bitmap -XDisplay the detail of a bitmap file +drwxr-xr-x.  27 trainee trainee   4096 Jul 14 03:13 arch 
-  --examine-badblocksDisplay list of known bad blocks on device +drwxr-xr-x.   3 trainee trainee   4096 Jun 14 10:33 block 
-  --monitor     -  : monitor (follow) some arrays +drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 certs 
-  --grow        -  : resize/ reshape and array +-rw-r--r--.   1 trainee trainee  13079 Jun 14 10:33 .clang-format 
-  --incremental -  : add/remove a single device to/from an array as appropriate +-rw-r--r--.   1 trainee trainee     59 Jun 14 10:33 .cocciconfig 
-  --query       -  : Display general information about how a +drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 configs 
-                       device relates to the md driver +-rw-r--r--.   1 trainee trainee    423 Jun 14 10:33 COPYING-4.18.0 
-  --auto-detect      Start arrays auto-detected by the kernel+-rw-r--r--.   1 trainee trainee  98651 Jun 14 10:33 CREDITS 
 +drwxr-xr-x.   4 trainee trainee   4096 Jun 14 10:33 crypto 
 +drwxr-xr-x. 119 trainee trainee   4096 Jul 14 03:13 Documentation 
 +drwxr-xr-x. 137 trainee trainee   4096 Jun 14 10:33 drivers 
 +drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 firmware 
 +drwxr-xr-x.  73 trainee trainee   4096 Jun 14 10:33 fs 
 +-rw-r--r--.   1 trainee trainee     68 Jun 14 10:33 .get_maintainer.conf 
 +-rw-r--r--  1 trainee trainee     31 Jun 14 10:33 .get_maintainer.ignore 
 +-rw-r--r--.   1 trainee trainee     76 Jun 14 10:33 .gitattributes 
 +-rw-r--r--.   1 trainee trainee   1639 Jun 14 10:33 .gitlab-ci-private.yml 
 +-rw-r--r--.   1 trainee trainee   1668 Jun 14 10:33 .gitlab-ci.yml 
 +drwxr-xr-x.  30 trainee trainee   4096 Jun 14 10:33 include 
 +drwxr-xr-x.   2 trainee trainee   4096 Jun 14 10:33 init 
 +drwxr-xr-x.   2 trainee trainee   4096 Jun 14 10:33 ipc 
 +-rw-r--r--.   1 trainee trainee   2245 Jun 14 10:33 Kbuild 
 +-rw-r--r--.   1 trainee trainee    575 Jun 14 10:33 Kconfig 
 +drwxr-xr-x.  19 trainee trainee   4096 Jul 14 03:13 kernel 
 +drwxr-xr-x.  20 trainee trainee  12288 Jul 14 03:13 lib 
 +drwxr-xr-x.   5 trainee trainee   4096 Jun 14 10:33 LICENSES 
 +-rw-r--r--.   1 trainee trainee   9559 Jun 14 10:33 .mailmap 
 +-rw-r--r--.   1 trainee trainee 471696 Jun 14 10:33 MAINTAINERS 
 +-rw-r--r--.   1 trainee trainee  61558 Jun 14 10:33 Makefile 
 +-rw-r--r--.   1 trainee trainee   1324 Jun 14 10:33 Makefile.rhelver 
 +-rw-r--r--.   1 trainee trainee      0 Jul 14 03:13 .mismatches 
 +drwxr-xr-x.   3 trainee trainee   4096 Jun 14 10:33 mm 
 +drwxr-xr-x.  72 trainee trainee   4096 Jun 14 10:33 net 
 +-rw-r--r--.   1 trainee trainee    800 Jun 14 10:33 README 
 +drwxr-xr-x.  28 trainee trainee   4096 Jun 14 10:33 samples 
 +-rw-r--r--  1 trainee trainee      0 Jul 14 03:12 .scmversion 
 +drwxr-xr-x.  14 trainee trainee   4096 Jul 14 03:13 scripts 
 +drwxr-xr-x.  10 trainee trainee   4096 Jun 14 10:33 security 
 +drwxr-xr-x.  26 trainee trainee   4096 Jun 14 10:33 sound 
 +drwxr-xr-x.  33 trainee trainee   4096 Jun 14 10:33 tools 
 +drwxr-xr-x.   2 trainee trainee   4096 Jul 14 03:13 usr 
 +drwxr-xr-x.   4 trainee trainee   4096 Jun 14 10:33 virt
 </code> </code>
  
-Les //modes majeurs// de la commande **mdadm** peuvent être visualisés grâce à la commande suivante :+===Le Fichier .config=== 
 + 
 +Changez de répertoire de travail :
  
 <code> <code>
-[root@centos7 ~]# mdadm --help +[trainee@centos8 SPECS]$ cd ~/rpmbuild/BUILD/kernel-*/linux-*/ 
-mdadm is used for building, managing, and monitoring +</code>
-Linux md devices (aka RAID arrays) +
-Usage: mdadm --create device options... +
-            Create a new array from unused devices. +
-       mdadm --assemble device options... +
-            Assemble a previously created array. +
-       mdadm --build device options... +
-            Create or assemble an array without metadata. +
-       mdadm --manage device options... +
-            make changes to an existing array. +
-       mdadm --misc options... devices +
-            report on or modify various md related devices. +
-       mdadm --grow options device +
-            resize/reshape an active array +
-       mdadm --incremental device +
-            add/remove a device to/from an array as appropriate +
-       mdadm --monitor options... +
-            Monitor one or more array for significant changes. +
-       mdadm device options... +
-            Shorthand for --manage. +
-Any parameter that does not start with '-' is treated as a device name +
-or, for --examine-bitmap, a file name. +
-The first such name is often the name of an md device.  Subsequent +
-names are often names of component devices.+
  
- For detailed help on the above major modes use --help after the mode +Copiez le fichier **configs/kernel-4.18.0-`uname -m`.config** vers **.config** dans le répertoire courant : 
- e.g. + 
-         mdadm --assemble --help +<code> 
- For general help on options use +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp configs/kernel-4.18.0-`uname -m`.config .config
-         mdadm --help-options+
 </code> </code>
  
-Dernièrement, chaque //mode majeur// dispose de son propre aide :+Mettez à jour le fichier .config par rapport à la configuration actuelle du noyau :
  
 <code> <code>
-[root@centos7 ~]# mdadm --assemble --help +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ make oldconfig 
-Usage: mdadm --assemble device options... +scripts/kconfig/conf  --oldconfig Kconfig 
-       mdadm --assemble --scan options...+
 +# configuration written to .config 
 +
 +</code>
  
-This usage assembles one or more raid arrays from pre-existing +<WRAP center round important 60%> 
-components. +**Important** Cette commande lit le fichier .config du noyau actuel et le compare avec celui des sources du noyau. S'il existent des nouvelles configurations à effectuer dans les sources du noyaula commande vous pose des questions
-For each arraymdadm needs to know the md device, the identity of +</WRAP>
-the array, and a number of sub devicesThese can be found in a number +
-of ways.+
  
-The md device is given on the command line, is found listed in the +La configuration du noyau se trouve dans un fichier dénommé **.config**Le fichier **.config** est généré par une des trois commandes suivantes et ne doit **pas** être édité manuellement :
-config file, or can be deduced from the array identity. +
-The array identity is determined either from the --uuid, --name, or +
---super-minor commandline arguments, from the config file, +
-or from the first component device on the command line.+
  
-The different combinations of these are as follows: +  * make config 
- If the --scan option is not given, then only devices and identities +  * make menuconfig 
- listed on the command line are considered. +  * make xconfig 
- The first device will be the array device, and the remainder will be +   
- examined when looking for components. +Exécutez la commande **make menuconfig** :
- If an explicit identity is given with --uuid or --super-minor, then +
- only devices with a superblock which matches that identity is considered, +
- otherwise every device listed is considered.+
  
- If the --scan option is given, and no devices are listed, then +<code> 
- every array listed in the config file is considered for assembly+[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ make menuconfig 
- The identity of candidate devices are determined from the config file+  UPD     scripts/kconfig/.mconf-cfg 
- After these arrays are assembled, mdadm will look for other devices +  HOSTCC  scripts/kconfig/mconf.o 
- that could form further arrays and tries to assemble them.  This can +  HOSTCC  scripts/kconfig/lxdialog/checklist.o 
- be disabled using the 'AUTO' option in the config file.+  HOSTCC  scripts/kconfig/lxdialog/inputbox.
 +  HOSTCC  scripts/kconfig/lxdialog/menubox.o 
 +  HOSTCC  scripts/kconfig/lxdialog/textbox.o 
 +  HOSTCC  scripts/kconfig/lxdialog/util.o 
 +  HOSTCC  scripts/kconfig/lxdialog/yesno.o 
 +  HOSTLD  scripts/kconfig/mconf 
 +scripts/kconfig/mconf  Kconfig 
 +
 +using defaults found in /boot/config-4.18.0-305.7.1.el8_4.x86_64 
 +
 +</code>
  
- If the --scan option is given as well as one or more devicesthen +Dans l'interfacevous pouvez constater la présence de lignes correspondantes à des fonctionalités suivies par une lettre ou une valeurDans le cas d'une lettre, la signification est la suivante :
- Those devices are md devices that are to be assembled.  Their identity +
- and components are determined from the config file.+
  
- If mdadm can not find all of the components for an arrayit will assemble +  * **y**
- it but not activate it unless --run or --scan is given.  To preserve this +    * la fonctionalité est incluse dans le noyau monolithique ou dans le cas d'une dépendance d'un module, dans le module concerné
- behaviour even with --scanadd --no-degraded.  Note that "all of the +  * **m**
- components" means as many as were present the last time the array was running +    * la fonctionalité est incluse en tant que module, 
- as recorded in the superblock.  If the array was already degradedand +  * **n**, 
- the missing device is not a new problemit will still be assembled.  It +    * la fonctionalité n'est pas incluse.
- is only newly missing devices that cause the array not to be started.+
  
-Options that are valid with --assemble (-A) are: +<WRAP center round important 60%> 
-  --bitmap=          : bitmap file to use with the array +**Important** Cette commande permet la modification de la configuration du noyau
-  --uuid=       -u   : uuid of array to assembleDevices which don't +</WRAP> 
-                       have this uuid are excluded +  
-  --super-minor= -m  : minor number to look for in super-block when +Sauvegardez simplement la configuration actuelle et sortez de l'interface 
-                       choosing devices to use. + 
-  --name=       -N   Array name to look for in super-block. +<code> 
-  --config=     -c   : config file +*** End of the configuration
-  --scan        -s   : scan config file for missing information +*** Execute 'maketo start the build or try 'make help'.
-  --run         -R   : Try to start the array even if not enough devices +
-                       for a full array are present +
-  --force       -f   : Assemble the array even if some superblocks appear +
-                     : out-of-date.  This involves modifying the superblocks+
-  --update=     -U   : Update superblock: try '-A --update=?for option list. +
-  --no-degraded      : Assemble but do not start degraded arrays. +
-  --readonly    -o   : Mark the array as read-only. No resync will start.+
 </code> </code>
  
-Constatez maintenant les informations concernant le RAID 5 créé :+Vérifiez que le fichier **.config** a été" créé par l'exécution de makeconfig :
  
 <code> <code>
-[root@centos7 ~]# cat /proc/mdstat +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ ls -a 
-Personalities : [raid6] [raid5] [raid4]  +     certs          configs         Documentation  .get_maintainer.conf    .gitlab-ci.yml  Kbuild   LICENSES     Makefile.rhelver  README       security  virt 
-md1 : active raid5 sda11[3] sda8[1] sda5[0] +..     .clang-format  COPYING-4.18.0  drivers        .get_maintainer.ignore  include         Kconfig  .mailmap     .mismatches       samples      sound 
-      1021952 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] +arch   .cocciconfig   CREDITS         firmware       .gitattributes          init            kernel   MAINTAINERS  mm                .scmversion  tools 
-       +block  .config        crypto          fs             .gitlab-ci-private.yml  ipc             lib      Makefile     net               scripts      usr
-unused devices: <none>+
 </code> </code>
  
-Grâce à la commande mdadm, il est possible d'obtenir d'avantage d'informations :+Consultez ce fichier :
  
 <code> <code>
-[root@centos7 ~]# mdadm --query /dev/md1 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ more .config 
-/dev/md1: 998.17MiB raid5 3 devices, sparesUse mdadm --detail for more detail.+
 +# Automatically generated file; DO NOT EDIT. 
 +# Linux/x86 4.18.0 Kernel Configuration 
 +
 + 
 +
 +# Compiler: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) 
 +
 +CONFIG_64BIT=y 
 +CONFIG_X86_64=y 
 +CONFIG_X86=y 
 +CONFIG_INSTRUCTION_DECODER=y 
 +CONFIG_OUTPUT_FORMAT="elf64-x86-64" 
 +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" 
 +CONFIG_LOCKDEP_SUPPORT=y 
 +CONFIG_STACKTRACE_SUPPORT=y 
 +CONFIG_MMU=y 
 +CONFIG_ARCH_MMAP_RND_BITS_MIN=28 
 +CONFIG_ARCH_MMAP_RND_BITS_MAX=32 
 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8 
 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16 
 +CONFIG_GENERIC_ISA_DMA=y 
 +CONFIG_GENERIC_BUG=y 
 +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y 
 +CONFIG_GENERIC_HWEIGHT=y 
 +CONFIG_ARCH_MAY_HAVE_PC_FDC=y 
 +CONFIG_GENERIC_CALIBRATE_DELAY=y 
 +CONFIG_ARCH_HAS_CPU_RELAX=y 
 +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y 
 +CONFIG_ARCH_HAS_FILTER_PGPROT=y 
 +CONFIG_HAVE_SETUP_PER_CPU_AREA=y 
 +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y 
 +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 
 +CONFIG_ARCH_HIBERNATION_POSSIBLE=y 
 +CONFIG_ARCH_SUSPEND_POSSIBLE=y 
 +CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y 
 +CONFIG_ARCH_WANT_GENERAL_HUGETLB=y 
 +CONFIG_ZONE_DMA32=y 
 +CONFIG_AUDIT_ARCH=y 
 +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y 
 +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 
 +CONFIG_HAVE_INTEL_TXT=y 
 +CONFIG_X86_64_SMP=y 
 +--More--(0%)
 </code> </code>
  
-L'option **- -detail** produit le résultat suivant :+===Le Fichier Makefile=== 
 + 
 +Le fichier **Makefile** contient le nom du noyau et spécifie les informations suivantes : 
 + 
 +  * VERSION, 
 +  * PATCHLEVEL, 
 +  * SUBLEVEL, 
 +  * EXTRAVERSION. 
 + 
 +Les trois premières informations sont gérées par **kernel.org** et Linus Torvalds en personne tandis que l'EXTRAVERSION est gérée par Red Hat :
  
 <code> <code>
-[root@centos7 ~]# mdadm --detail /dev/md1 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ more Makefile 
-/dev/md1: +# SPDX-License-IdentifierGPL-2.0 
-        Version : 1.2 +VERSION = 4 
-  Creation Time Tue Aug  15:10:12 2016 +PATCHLEVEL = 18 
-     Raid Level : raid5 +SUBLEVEL = 0 
-     Array Size : 1021952 (998.17 MiB 1046.48 MB) +EXTRAVERSION = 
-  Used Dev Size : 510976 (499.08 MiB 523.24 MB) +NAME = Merciless Moray
-   Raid Devices : 3 +
-  Total Devices : 3 +
-    Persistence : Superblock is persistent+
  
-    Update Time : Tue Aug  2 15:10:17 2016 +# 
-          State : clean  +# DRM backport version 
- Active Devices : 3 +# 
-Working Devices : 3 +RHEL_DRM_VERSION = 5 
- Failed Devices : 0 +RHEL_DRM_PATCHLEVEL = 9 
-  Spare Devices : 0+RHEL_DRM_SUBLEVEL = 14
  
-         Layout : left-symmetric +# *DOCUMENTATION* 
-     Chunk Size : 512K+# To see a list of typical targets execute "make help" 
 +# More info can be located in ./README 
 +# Comments in this file are targeted only to the developer, do not 
 +# expect to learn how to build the kernel reading this file.
  
-           Name : centos7.fenestros.loc: (local to host centos7.fenestros.loc) +# That's our default target when none is given on the command line 
-           UUID : fd8bac53:1457a4f4:30feab84:e0f9d8e0 +PHONY := _all 
-         Events 18+_all:
  
-    Number   Major   Minor   RaidDevice State +# o Do not use make's built-in rules and variables 
-       0              5        0      active sync   /dev/sda5 +  (this increases performance and avoids hard-to-debug behaviour); 
-       1              8        1      active sync   /dev/sda8 +# o Look for make include files relative to root of kernel src 
-       3             11             active sync   /dev/sda11+MAKEFLAGS += -rR --include-dir=$(CURDIR) 
 + 
 +# Avoid funny character set dependencies 
 +unexport LC_ALL 
 +LC_COLLATE=C 
 +LC_NUMERIC=C 
 +export LC_COLLATE LC_NUMERIC 
 + 
 +# Avoid interference with shell env settings 
 +unexport GREP_OPTIONS 
 + 
 +# Set RHEL variables 
 +# Use this spot to avoid future merge conflicts 
 +include Makefile.rhelver 
 + 
 +# We are using a recursive build, so we need to do a little thinking 
 +--Plus--(2%)
 </code> </code>
  
-Notez la ligne **Persistence : Superblock is persistent**. En effetcette implémentation de RAID inscrit les caractéristiques du volume dans un //super bloc// persistant en début de chaque unité de type bloc dans le volume.+<WRAP center round important 60%> 
 +**Important** - La version 2.6 du noyau a vu le jour en **2003**. Les **SUBLEVEL** se suivaient régulièrement. Avec la version 2.6 du noyau, la valeur paire du **PATCHLEVEL** indiquait que le noyau était stableQuand vous recompilez le noyau à partir des sourcesvous devez modifier la valeur de l'EXTRAVERSION.  Le passage à la version 3.0 fut décidé par Linus Torvalds à l'occasion des 20 ans du noyau Linux. Depuis l'arrivée de la version 3 du noyau, la signification de la valeur de PATCHLEVEL paire et impaire a été abondonnée. 
 +</WRAP>
  
-<WRAP center round todo+====2.4 - Paramétrage du noyau==== 
-Recherchez la signification des termes Layout, Chunk size, Major et Minor.+ 
 +Insérez la sortie de la commande **uname -i** sur la première ligne du fichier .config : 
 + 
 +<code> 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ uname -i 
 +x86_64 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ vi .config 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ head .config 
 +# x86_64 
 +
 +# Automatically generated file; DO NOT EDIT. 
 +# Linux/x86 4.18.0 Kernel Configuration 
 +
 + 
 +
 +# Compiler: gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1) 
 +
 +CONFIG_64BIT=y 
 +</code> 
 + 
 +Renommez le fichier .config en le plaçant dans le répertoire **~/rpmbuild/SOURCES/** : 
 + 
 +<code> 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp .config ~/rpmbuild/SOURCES/config-`uname -m`-generic 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ ls ~/rpmbuild/SOURCES 
 +centos-ca-secureboot.der  cpupower.config            filter-x86_64.sh                           kernel-s390x.config                mod-extra.list           Module.kabi_s390x 
 +centos-dup.x509           cpupower.service           generate_all_configs.sh                    kernel-s390x-debug.config          mod-internal.list        Module.kabi_x86_64 
 +centos-kpatch.x509        debrand-rh-i686-cpu.patch  generate_bls_conf.sh                       kernel-s390x-zfcpdump.config       mod-sign.sh              parallel_xz.sh 
 +centos.pem                debrand-rh_taint.patch     kernel-aarch64.config                      kernel-x86_64.config               Module.kabi_aarch64      process_configs.sh 
 +centossecureboot001.der   debrand-single-cpu.patch   kernel-aarch64-debug.config                kernel-x86_64-debug.config         Module.kabi_dup_aarch64  x509.genkey 
 +centossecureboot201.der   filter-aarch64.sh          kernel-abi-stablelists-4.18.0-305.tar.bz2  kvm_stat.logrotate                 Module.kabi_dup_ppc64le 
 +centossecurebootca2.der   filter-modules.sh          kernel-kabi-dw-4.18.0-305.tar.bz2          linux-4.18.0-305.7.1.el8_4.tar.xz  Module.kabi_dup_s390x 
 +check-kabi                filter-ppc64le.sh          kernel-ppc64le.config                      linux-kernel-test.patch            Module.kabi_dup_x86_64 
 +config-x86_64-generic     filter-s390x.sh            kernel-ppc64le-debug.config                mod-blacklist.sh                   Module.kabi_ppc64le 
 +</code> 
 + 
 +Copiez le contenu du répertoire **configs** vers le répertoire **~/rpmbuild/SOURCES/** : 
 + 
 +<code> 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cp configs/* ~/rpmbuild/SOURCES/ 
 +</code> 
 + 
 +Editez la directive **buildid** dans le fichier **~/rpmbuild/SPECS/kernel.spec** : 
 + 
 +<code> 
 +[trainee@centos8 linux-4.18.0-305.7.1.el8.x86_64]$ cd ~/rpmbuild/SPECS 
 + 
 +[trainee@centos8 SPECS]$ vi kernel.spec 
 + 
 +[trainee@centos8 SPECS]$ head -n 50 kernel.spec 
 +# We have to override the new %%install behavior because, well... the kernel is special. 
 +%global __spec_install_pre %{___build_pre} 
 + 
 +# At the time of this writing (2019-03), RHEL8 packages use w2.xzdio 
 +# compression for rpms (xz, level 2). 
 +# Kernel has several large (hundreds of mbytes) rpms, they take ~5 mins 
 +# to compress by single-threaded xz. Switch to threaded compression, 
 +# and from level 2 to 3 to keep compressed sizes close to "w2" results. 
 +
 +# NB: if default compression in /usr/lib/rpm/redhat/macros ever changes, 
 +# this one might need tweaking (e.g. if default changes to w3.xzdio, 
 +# change below to w4T.xzdio): 
 +%define _binary_payload w3T.xzdio 
 + 
 +# For a kernel released for public testing, released_kernel should be 1. 
 +# For internal testing builds during development, it should be 0. 
 +%global released_kernel 1 
 + 
 +%global distro_build 305 
 + 
 +# Sign the x86_64 kernel for secure boot authentication 
 +%ifarch x86_64 aarch64 
 +%global signkernel 1 
 +%else 
 +%global signkernel 0 
 +%endif 
 + 
 +# Sign modules on all arches 
 +%global signmodules 1 
 + 
 +# Compress modules only for architectures that build modules 
 +%ifarch noarch 
 +%global zipmodules 0 
 +%else 
 +%global zipmodules 1 
 +%endif 
 + 
 +%if %{zipmodules} 
 +%global zipsed -e 's/\.ko$/\.ko.xz/' 
 +%endif 
 + 
 +%define buildid .i2tch 
 + 
 +%define rpmversion 4.18.0 
 +%define pkgrelease 305.7.1.el8_4 
 + 
 +# allow pkg_release to have configurable %%{?dist} tag 
 +%define specrelease 305.7.1%{?dist} 
 + 
 +%define pkg_release %{specrelease}%{?buildid} 
 +</code> 
 + 
 +====2.5 - Compiler le Noyau==== 
 + 
 +La compilation du noyau peut prendre beaucoup de temps (~5 heures). La commande utilisée est la suivante : 
 + 
 +<code> 
 +[trainee@centos7 SPECS]$ rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log & 
 +</code> 
 + 
 +<WRAP center round important 60%
 +**Important** - La compilation peut prendre des heures. Arrêtez donc le processus avec les touches ^C. Arrêtez ensuite votre VM. Demandez à votre formateur de démarrer la VM contenant le noyau déjà compilé.
 </WRAP> </WRAP>
  
-Cependantil necéssaire de renseigner le fichier **/etc/mdadm.conf** afin que le RAID soit contruit à chaque démarrage :+A l'issu du processusles RPMs se trouvent dans le répertoire **/home/trainee/rpmbuild/RPMS/x86_64/** :
  
 <code> <code>
-[root@centos7 ~]# echo 'DEVICES /dev/sda5 /dev/sda8 /dev/sda11' > /etc/mdadm.conf +... 
-[root@centos7 ~]# mdadm --detail --scan >> /etc/mdadm.conf  +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
-[root@centos7 ~]# cat /etc/mdadm.conf +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
-DEVICES /dev/sda5 /dev/sda8 /dev/sda11 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
-ARRAY /dev/md1 metadata=1.2 name=centos7.fenestros.loc:1 UUID=fd8bac53:1457a4f4:30feab84:e0f9d8e0+Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/python3-perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote/home/trainee/rpmbuild/RPMS/x86_64/python3-perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote/home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote/home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote/home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/bpftool-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/bpftool-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Wrote: /home/trainee/rpmbuild/RPMS/x86_64/kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.rkOgfs 
 + 
 +[1]+  Done                    rpmbuild -bb --target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log
 </code> </code>
  
-Chaque unité peut être examinée individuellement :+<code> 
 +[trainee@centos8 SPECS]$ cd ../RPMS 
 +[trainee@centos8 RPMS]$ ls 
 +x86_64 
 +[trainee@centos8 RPMS]$ cd x86_64/ 
 +[trainee@centos8 x86_64]$ ls 
 +bpftool-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                 kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64.rpm  kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +bpftool-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm      kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm             kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm   kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm    kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                    kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm       perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm  kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64.rpm                  python3-perf-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64.rpm      kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64.rpm            python3-perf-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64.rpm        kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64.rpm 
 +</code> 
 + 
 +Notez que la génération du nouveau noyau peut consommer jusqu'à 21 Go d'espace disque :
  
 <code> <code>
-[root@centos7 ~]# mdadm --examine /dev/sda5 +[trainee@centos8 x86_64]$ df -
-/dev/sda5: +Filesystem                   Size  Used Avail Use% Mounted on 
-          Magic : a92b4efc +devtmpfs                     1.8G      1.8G   0% /dev 
-        Version : 1.+tmpfs                        1.9G      1.9G   0% /dev/shm 
-    Feature Map : 0x0 +tmpfs                        1.9G  9.4M  1.9G   1% /run 
-     Array UUID : fd8bac53:1457a4f4:30feab84:e0f9d8e0 +tmpfs                        1.9G      1.9G   0% /sys/fs/cgroup 
-           Name : centos7.fenestros.loc:1  (local to host centos7.fenestros.loc) +/dev/mapper/cl_centos8-root   28G  5.5G   23G  20% / 
-  Creation Time : Tue Aug  2 15:10:12 2016 +/dev/sda1                    976M  289M  620M  32% /boot 
-     Raid Level : raid5 +tmpfs                        374M   24K  374M   1% /run/user/1000 
-   Raid Devices : 3+tmpfs                        374M  1.2M  373M   1% /run/user/42 
 +/dev/sdc1                     63G   21G   39G  35% /home 
 +</code>
  
- Avail Dev Size : 1021952 (499.08 MiB 523.24 MB) +====2.6 - Installer le Nouveau Noyau====
-     Array Size : 1021952 (998.17 MiB 1046.48 MB) +
-    Data Offset : 2048 sectors +
-   Super Offset : 8 sectors +
-   Unused Space : before=1960 sectors, after=0 sectors +
-          State : clean +
-    Device UUID : 4569e15e:20201bce:365776f2:75aed23f+
  
-    Update Time : Tue Aug  15:10:17 2016 +Installez maintenant les paquets **kernel***. L'installation du noyau peut prendre beaucoup de temps (~heures). La commande utilisée est la suivante : :
-  Bad Block Log : 512 entries available at offset 72 sectors +
-       Checksum 4c9948d0 - correct +
-         Events 18+
  
-         Layout : left-symmetric +<code> 
-     Chunk Size : 512K+[root@centos8 x86_64]# dnf localinstall kernel-*.rpm 
 +Last metadata expiration check: 2:25:32 ago on Tue 20 Jul 2021 08:37:00 EDT. 
 +Dependencies resolved. 
 +=============================================================================================================================================================================================================== 
 + Package                                                       Architecture                          Version                                                 Repository                                   Size 
 +=============================================================================================================================================================================================================== 
 +Installing: 
 + kernel                                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M 
 + kernel-core                                                   x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 36 M 
 + kernel-cross-headers                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 11 M 
 + kernel-debug                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M 
 + kernel-debug-core                                             x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 63 M 
 + kernel-debug-debuginfo                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                683 M 
 + kernel-debug-devel                                            x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 19 M 
 + kernel-debug-modules                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 54 M 
 + kernel-debug-modules-extra                                    x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                7.2 M 
 + kernel-debug-modules-internal                                 x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.3 M 
 + kernel-debuginfo                                              x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                570 M 
 + kernel-debuginfo-common-x86_64                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 75 M 
 + kernel-devel                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 18 M 
 + kernel-ipaclones-internal                                     x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 20 M 
 + kernel-modules                                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 28 M 
 + kernel-modules-extra                                          x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.5 M 
 + kernel-modules-internal                                       x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.1 M 
 + kernel-selftests-internal                                     x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                 19 M 
 + kernel-tools-debuginfo                                        x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.2 M 
 + kernel-tools-libs-devel                                       x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M 
 +Downgrading: 
 + kernel-headers                                                x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                7.1 M 
 + kernel-tools                                                  x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                6.1 M 
 + kernel-tools-libs                                             x86_64                                4.18.0-305.7.1.el8.i2tch                                @commandline                                5.9 M
  
-   Device Role : Active device 0 +Transaction Summary 
-   Array State : AAA ('A' == active, '.' == missing, 'R' == replacing)+=============================================================================================================================================================================================================== 
 +Install    20 Packages 
 +Downgrade   3 Packages 
 + 
 +Total size: 1.6 G 
 +Is this ok [y/N]: y
 </code> </code>
  
-ce stade il est intéressant de noter comment réagir lors d'une défaillance d'un disque. Dans notre cas nous allons indiquer au système que la partition /dev/sda5 est devenue défaillante :+l'issu de l'installation, re-démarrez la VM :
  
 <code> <code>
-[root@centos7 ~]# mdadm --manage --set-faulty /dev/md1 /dev/sda5 +[root@centos7 ~]# reboot
-mdadm: set /dev/sda5 faulty in /dev/md1+
 </code> </code>
  
-L'utilisation de la ligne de commande suivante nous confirme le statut de /dev/sda5 :+Connectez-vous en tant que trainee et devenez root. Listez ensuite les noyaux installés :
  
 <code> <code>
-[root@centos7 ~]# mdadm --detail /dev/md1 +[root@centos8 ~]# rpm -qa | grep kernel 
-/dev/md1: +kernel-modules-4.18.0-305.3.1.el8.x86_64 
-        Version : 1.2 +kernel-tools-4.18.0-305.7.1.el8.i2tch.x86_64 
-  Creation Time : Tue Aug  2 15:10:12 2016 +kernel-headers-4.18.0-305.7.1.el8.i2tch.x86_64 
-     Raid Level : raid5 +kernel-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 
-     Array Size : 1021952 (998.17 MiB 1046.48 MB) +kernel-debug-core-4.18.0-305.7.1.el8.i2tch.x86_64 
-  Used Dev Size : 510976 (499.08 MiB 523.24 MB) +kernel-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 
-   Raid Devices : +kernel-modules-4.18.0-305.7.1.el8_4.x86_64 
-  Total Devices : +kernel-debug-modules-4.18.0-305.7.1.el8.i2tch.x86_64 
-    Persistence : Superblock is persistent+kernel-devel-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-tools-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-tools-libs-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-debug-modules-internal-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-cross-headers-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-core-4.18.0-305.7.1.el8_4.x86_64 
 +kernel-devel-4.18.0-305.7.1.el8_4.x86_64 
 +kernel-debuginfo-common-x86_64-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-debug-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-debug-devel-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-tools-libs-devel-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-modules-extra-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-4.18.0-305.7.1.el8_4.x86_64 
 +kernel-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-core-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-selftests-internal-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-debug-debuginfo-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-debug-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-4.18.0-305.3.1.el8.x86_64 
 +kernel-core-4.18.0-305.3.1.el8.x86_64 
 +kernel-modules-4.18.0-305.7.1.el8.i2tch.x86_64 
 +kernel-ipaclones-internal-4.18.0-305.7.1.el8.i2tch.x86_64 
 +</code>
  
-    Update Time Tue Aug  2 15:14:59 2016 +Constatez l'entrée **saved-entry** du fichier **/boot/grub2/grubenv** :
-          State : clean, degraded  +
- Active Devices : 2 +
-Working Devices : 2 +
- Failed Devices : 1 +
-  Spare Devices : 0+
  
-         Layout : left-symmetric +<code> 
-     Chunk Size : 512K+[root@centos8 ~]# grep i2tch /boot/grub2/grubenv  
 +saved_entry=95bd69e34a7444a7b58cb74fbfb86df2-4.18.0-305.7.1.el8.i2tch.x86_64 
 +</code>
  
-           Name centos7.fenestros.loc: (local to host centos7.fenestros.loc) +Dernièrement, vérifiez l'utilisation du nouveau noyau :
-           UUID : fd8bac53:1457a4f4:30feab84:e0f9d8e0 +
-         Events : 20+
  
-    Number   Major   Minor   RaidDevice State +<code> 
-       0              0        0      removed +[root@centos8 ~]# uname -r 
-             8        8        1      active sync   /dev/sda8 +4.18.0-305.7.1.el8.i2tch.x86_64 
-             8       11        2      active sync   /dev/sda11+</code> 
 + 
 +=====LAB #- Gestion des Quotas===== 
 + 
 +Sous Linux il est possible de mettre en place des quotas par utilisateur et par groupe. Ceci étant, Linux ne sait  pas gérer des quotas par répertoire, uniquement des  
 +quotas par partition. L'administrateur met souvent des quotas en place sur l'arborescence de /home pour limiter l'espace de stockage occupé par les utilisateurs. 
 + 
 +Déconnectez-vous et reconnectez-vous **directement** en tant que root : 
 + 
 +<code> 
 +root@computeXX:~# ssh -l root 10.0.2.45 
 +root@10.0.2.45's password: fenestros 
 +Activate the web console with: systemctl enable --now cockpit.socket
  
-                    5        -      faulty   /dev/sda5+Last login: Wed Jul 21 11:14:31 2021 
 +[root@centos8 ~]# 
 </code> </code>
  
-Il est maintenant nécessaire de supprimer /dev/sda5 de notre RAID 5 :+Avant de mettre en place des quotas, configurer SELINUX en mode **permissive** afin de ne pas avoir d'erreurs de ce dernier :
  
 <code> <code>
-[root@centos7 ~]# mdadm --manage --remove /dev/md1 /dev/sda5 +[root@centos8 ~]# getenforce 
-mdadm: hot removed /dev/sda5 from /dev/md1+Enforcing 
 +[root@centos8 ~]# setenforce permissive 
 +[root@centos8 ~]# getenforce 
 +Permissive 
 +[root@centos8 ~]# 
 </code> </code>
  
-A l'examen de notre RAID, on constate que /dev/sda5 a été supprimé :+Editez ensuite le fichier /etc/sysconfig/selinux ainsi :
  
 <code> <code>
-[root@centos7 ~]# mdadm --detail /dev/md1 +[root@centos8 ~]# vi /etc/sysconfig/selinux 
-/dev/md1: +[root@centos8 ~]# cat /etc/sysconfig/selinux
-        Version : 1.2 +
-  Creation Time : Tue Aug  2 15:10:12 2016 +
-     Raid Level : raid5 +
-     Array Size : 1021952 (998.17 MiB 1046.48 MB) +
-  Used Dev Size : 510976 (499.08 MiB 523.24 MB) +
-   Raid Devices : 3 +
-  Total Devices : 2 +
-    Persistence : Superblock is persistent+
  
-    Update Time : Tue Aug  2 15:16:41 2016 +# This file controls the state of SELinux on the system. 
-          State clean, degraded  +# SELINUX= can take one of these three values
- Active Devices : 2 +#     enforcing - SELinux security policy is enforced. 
-Working Devices : 2 +#     permissive - SELinux prints warnings instead of enforcing. 
- Failed Devices : 0 +#     disabled - No SELinux policy is loaded. 
-  Spare Devices 0+SELINUX=permissive 
 +# SELINUXTYPE= can take one of these three values: 
 +#     targeted - Targeted processes are protected, 
 +#     minimum - Modification of targeted policy. Only selected processes are protected.  
 +#     mls - Multi Level Security protection. 
 +SELINUXTYPE=targeted
  
-         Layout : left-symmetric +</code>
-     Chunk Size : 512K+
  
-           Name centos7.fenestros.loc: (local to host centos7.fenestros.loc) +Commencez par vérifiez que le paquet **quota** est bien installé :
-           UUID : fd8bac53:1457a4f4:30feab84:e0f9d8e0 +
-         Events : 21+
  
-    Number   Major   Minor   RaidDevice State +<code> 
-       0              0        0      removed +[root@centos8 ~]# rpm -qa | grep quota 
-       1              8        1      active sync   /dev/sda8 +quota-4.04-12.el8.x86_64 
-       3             11        2      active sync   /dev/sda11+quota-nls-4.04-12.el8.noarch
 </code> </code>
  
-Constatez maintenant l'existance de votre RAID :+Editez le fichier **/etc/fstab** en ajoutant les options **usrquota** et **grpquota** à la ligne **/home** :
  
 <code> <code>
-[root@centos7 ~]# cat /proc/mdstat +[root@centos8 ~]# vi /etc/fstab 
-Personalities : [raid6] [raid5] [raid4]  +[root@centos8 ~]# cat /etc/fstab 
-md1 active raid5 sda11[3] sda8[1] + 
-      1021952 blocks super 1.2 level 5, 512k chunkalgorithm 2 [3/2] [_UU] +
-       +# /etc/fstab 
-unused devices: <none>+# Created by anaconda on Wed Jun 16 06:21:32 2021 
 +
 +# Accessible filesystems, by reference, are maintained under '/dev/disk/'. 
 +# See man pages fstab(5)findfs(8)mount(8) and/or blkid(8) for more info. 
 +
 +# After editing this file, run 'systemctl daemon-reload' to update systemd 
 +# units generated from this file. 
 +
 +/dev/mapper/cl_centos8-root /                       xfs     defaults        0 0 
 +UUID=1c04981e-5317-4b73-9695-3ce25246835d /boot                   ext4    defaults        1 
 +/dev/mapper/cl_centos8-swap swap                    swap    defaults        0 0 
 +UUID=f76d6b66-985b-4a91-af9c-4987e8c1443c /home     ext4          defaults,usrquota,grpquota            1 2
 </code> </code>
  
-<WRAP center round important+Redémarrez la VM : 
-Notez que le RAID a été démarré avec 2 unités au lieu de trois.+ 
 +<code
 +[root@centos8 ~]# reboot 
 +</code> 
 + 
 +Reconnectez-vous **directement** en tant que root : 
 + 
 +<code> 
 +root@computeXX:~# ssh -l root 10.0.2.45 
 +root@10.0.2.45's password: fenestros 
 +Activate the web console with: systemctl enable --now cockpit.socket 
 + 
 +Last login: Wed Jul 21 11:19:46 2021 
 +[root@centos8 ~]#  
 +</code> 
 + 
 +Vérifiez ensuite que les options **usrquota** et **grpquota** soient prises en compte : 
 + 
 +<code> 
 +[root@centos8 ~]# cat /etc/mtab | grep /home 
 +/dev/sdc1 /home ext4 rw,seclabel,relatime,quota,usrquota,grpquota 0 0 
 +</code> 
 + 
 +====3.1 - La Commande quotacheck==== 
 + 
 +Pour activer les quotas sur /home, il convient d'utiliser la commande **quotacheck** : 
 + 
 +<code> 
 +[root@centos8 ~]# quotacheck -cugvm -f /dev/sdc1 
 +quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. 
 +quotacheck: Scanning /dev/sdc1 [/home] done 
 +quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be subtracted. 
 +quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be subtracted. 
 +quotacheck: Cannot stat old user quota file /home/aquota.user: No such file or directory. Usage will not be subtracted. 
 +quotacheck: Cannot stat old group quota file /home/aquota.group: No such file or directory. Usage will not be subtracted. 
 +quotacheck: Checked 6763 directories and 129772 files 
 +quotacheck: Old file not found. 
 +quotacheck: Old file not found. 
 +</code> 
 + 
 +Les options de la commande quotacheck sont : 
 + 
 +<code> 
 +[root@centos8 ~]# quotacheck --help 
 +Utility for checking and repairing quota files. 
 +quotacheck [-gucbfinvdmMR] [-F <quota-format>] filesystem|-a 
 + 
 +-u, --user                check user files 
 +-g, --group               check group files 
 +-c, --create-files        create new quota files 
 +-b, --backup              create backups of old quota files 
 +-f, --force               force check even if quotas are enabled 
 +-i, --interactive         interactive mode 
 +-n, --use-first-dquot     use the first copy of duplicated structure 
 +-v, --verbose             print more information 
 +-d, --debug               print even more messages 
 +-m, --no-remount          do not remount filesystem read-only 
 +-M, --try-remount         try remounting filesystem read-only, 
 +                          continue even if it fails 
 +-R, --exclude-root        exclude root when checking all filesystems 
 +-F, --format=formatname   check quota files of specific format 
 +-a, --all                 check all filesystems 
 +-h, --help                display this message and exit 
 +-V, --version             display version information and exit 
 + 
 +Bugs to jack@suse.cz 
 +</code> 
 + 
 +Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home : 
 + 
 +<code> 
 +[root@centos8 ~]# ls -la /home 
 +total 40 
 +drwxr-xr-x.  4 root    root     4096 Jul 21 11:27 . 
 +dr-xr-xr-x. 17 root    root      224 Jul 19 12:05 .. 
 +-rw-------.  1 root    root     7168 Jul 21 11:27 aquota.group 
 +-rw-------.  1 root    root     7168 Jul 21 11:27 aquota.user 
 +drwx------.  2 root    root    16384 Jul 19 12:02 lost+found 
 +drwxr-xr-x. 17 trainee trainee  4096 Jul 21 11:22 trainee  
 +</code> 
 + 
 +Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** : 
 + 
 +<code> 
 +[root@centos8 ~]# groupadd fenestros && useradd fenestros -c FenestrOs -d /home/fenestros -g fenestros -s /bin/bash 
 +[root@centos8 ~]# passwd fenestros 
 +Changing password for user fenestros. 
 +New password:  
 +BAD PASSWORD: The password contains the user name in some form 
 +Retype new password:  
 +passwd: all authentication tokens updated successfully. 
 +</code> 
 + 
 +====3.- La Commande edquota==== 
 + 
 +Mettez en place maintenant un quota de 10Mo pour l'utilisateur **fenestros** : 
 + 
 +<code> 
 +[root@centos8 ~]# edquota -u fenestros -f /home 
 +</code> 
 + 
 +L'éditeur **vi** se lance et vous obtiendrez un résultat similaire à celui-ci : 
 + 
 +<file> 
 +Disk quotas for user fenestros (uid 1001): 
 +  Filesystem                   blocks       soft       hard     inodes     soft     hard 
 +  /dev/sdc1                                  0          0          0        0        0 
 +</file> 
 + 
 +Modifiez ce fichier ainsi : 
 + 
 +<file> 
 +Disk quotas for user fenestros (uid 1001): 
 +  Filesystem                   blocks       soft       hard     inodes     soft     hard 
 +  /dev/sdc1                               8000      10000          0        0        0 
 +</file> 
 + 
 +Sauvegardez et quittez le fichier. 
 + 
 +Les options de la commande **edquota** sont : 
 + 
 +<code> 
 +[root@centos8 ~]# edquota --help 
 +edquota: Usage: 
 +        edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... 
 +        edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... 
 +        edquota [-rm] -P [-F formatname] [-p projectname] [-f filesystem] projectname ... 
 +        edquota [-u|g|-P] [-F formatname] [-f filesystem] -t 
 +        edquota [-u|g|-P] [-F formatname] [-f filesystem] -T username|groupname|projectname ... 
 + 
 +-u, --user                    edit user data 
 +-g, --group                   edit group data 
 +-P, --project                 edit project data 
 +-r, --remote                  edit remote quota (via RPC) 
 +-m, --no-mixed-pathnames      trim leading slashes from NFSv4 mountpoints 
 +-F, --format=formatname       edit quotas of a specific format 
 +-p, --prototype=name          copy data from a prototype user/group 
 +    --always-resolve          always try to resolve name, even if it is 
 +                              composed only of digits 
 +-f, --filesystem=filesystem   edit data only on a specific filesystem 
 +-t, --edit-period             edit grace period 
 +-T, --edit-times              edit grace time of a user/group 
 +-h, --help                    display this help text and exit 
 +-V, --version                 display version information and exit 
 + 
 +Bugs to: jack@suse.cz 
 +</code> 
 + 
 +<WRAP center round important 60%> 
 +**Important** - Pour mettre en place un quota par group, la procédure est similaire. Il suffit d'utiliser l'option -g de la commande edquota.
 </WRAP> </WRAP>
  
-Pour ajouter un autre disque à notre RAID afin de remplacer /dev/sda5 il convient d'utiliser l'option **--add** :+====3.3 La Commande quotaon==== 
 + 
 +Appliquez maintenant les quotas :
  
 <code> <code>
-[root@centos7 ~]# mdadm --manage --add /dev/md1 /dev/sda10 +[root@centos8 ~]# quotaon -a
-mdadm: added /dev/sda10+
 </code> </code>
  
-L'exemen du RAID indique que /dev/sda10 a été ajouté en tant que //spare// et à l'issu de quelques minutes le RAID 5 a été reconstruite :+Les options de la commande **quotaon** sont :
  
 <code> <code>
-[root@centos7 ~]# mdadm --detail /dev/md1 +[root@centos8 ~]# quotaon --help 
-/dev/md1+quotaon: Usage
-        Version : 1.2 +        quotaon [-guPvp] [-F quotaformat] [-x state] -a 
-  Creation Time : Tue Aug  2 15:10:12 2016 +        quotaon [-guPvp] [-F quotaformat] [-x state] filesys ...
-     Raid Level : raid5 +
-     Array Size : 1021952 (998.17 MiB 1046.48 MB) +
-  Used Dev Size : 510976 (499.08 MiB 523.24 MB) +
-   Raid Devices : 3 +
-  Total Devices : 3 +
-    Persistence : Superblock is persistent+
  
-    Update Time : Tue Aug  2 15:19:06 2016 +-a, --all                turn quotas on for all filesystems 
-          State : clean  +-f, --off                turn quotas off 
- Active Devices : 3 +-u, --user               operate on user quotas 
-Working Devices : 3 +-g, --group              operate on group quotas 
- Failed Devices : 0 +-P, --project            operate on project quotas 
-  Spare Devices : 0+-p, --print-state        print whether quotas are on or off 
 +-x, --xfs-command=cmd    perform XFS quota command 
 +-F, --format=formatname  operate on specific quota format 
 +-v, --verbose            print more messages 
 +-h, --help               display this help text and exit 
 +-V, --version            display version information and exit 
 +</code>
  
-         Layout : left-symmetric +De cette manière vous avez mis en place un quota **souple** pour fenestros de 8 000 Ko et un quota **stricte** de 10 000 Ko. 
-     Chunk Size : 512K+
  
-           Name : centos7.fenestros.loc:1  (local to host centos7.fenestros.loc) +Quand l'utilisateur fenestros aura dépassé le quota **souple**, il recevra un message d'avertissementQuand il dépasse le quota **stricte**, il ne pourra plus enregistrer dans /home, sauf dans le cas où il supprime des fichiers pour retomber en dessous de la limite **stricte**.
-           UUID : fd8bac53:1457a4f4:30feab84:e0f9d8e0 +
-         Events : 40+
  
-    Number   Major   Minor   RaidDevice State +Il est à noter que vous pouvez soit mettre en place un quota en taille, soit mettre en place un quota basé sur le nombre d'inodes utilisés par l'utilisateur. 
-             8       10        0      active sync   /dev/sda10 + 
-       1              8        1      active sync   /dev/sda8 +<WRAP center round important 60%> 
-             8       11             active sync   /dev/sda11+**important** - La commande pour désactivez les quotas est **quotaoff**.  
 +</WRAP> 
 + 
 +====3.- La Commande repquota==== 
 + 
 +Pour visualiser les quotas utilisez la commande **repquota** : 
 + 
 +<code> 
 +[root@centos8 ~]# repquota /home 
 +*** Report for user quotas on device /dev/sdc1 
 +Block grace time: 7days; Inode grace time: 7days 
 +                        Block limits                File limits 
 +User            used    soft    hard  grace    used  soft  hard  grace 
 +---------------------------------------------------------------------- 
 +root      --      20             0                  0            
 +trainee   -- 21495888                     136532                      
 +   
 </code> </code>
  
-Naturellement, il necéssaire de renseigner le fichier **/etc/mdadm.conf** du changement afin que le RAID soit contruit à chaque démarrage :+<WRAP center round important 60%> 
 +**Important** - Notez que l'utilisateur fenestros ne figure pas dans la liste. Sous RHEL / CentOS, le quota n'est pas visible tant que l'utilisateur ne s'est pas connecté pour la première fois.  
 +</WRAP> 
 + 
 +Les options de la commande **repquota** sont :
  
 <code> <code>
-[root@centos7 ~]# echo 'DEVICES /dev/sda10 /dev/sda8 /dev/sda11' > /etc/mdadm.conf +[root@centos8 ~]# repquota --help 
-[root@centos7 ~]# mdadm --detail --scan >> /etc/mdadm.conf  +repquota: Utility for reporting quotas. 
-[root@centos7 ~]# cat /etc/mdadm.conf +Usage: 
-DEVICES /dev/sda10 /dev/sda8 /dev/sda11 +repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] [-O (default | xml | csv)] (-a | mntpoint) 
-ARRAY /dev/md1 metadata=1.2 name=centos7.fenestros.loc:1 UUID=fd8bac53:1457a4f4:30feab84:e0f9d8e0+ 
 +-v, --verbose               display also users/groups without any usage 
 +-u, --user                  display information about users 
 +-g, --group                 display information about groups 
 +-P, --project               display information about projects 
 +-s, --human-readable        show numbers in human friendly units (MB, GB, ...) 
 +-t, --truncate-names        truncate names to 9 characters 
 +-p, --raw-grace             print grace time in seconds since epoch 
 +-n, --no-names              do not translate uid/gid to name 
 +-i, --no-autofs             avoid autofs mountpoints 
 +-c, --cache                 translate big number of ids at once 
 +-C, --no-cache              translate ids one by one 
 +-F, --format=formatname     report information for specific format 
 +-O, --output=format         format output as xml or csv 
 +-a, --all                   report information for all mount points with quotas 
 +-h, --help                  display this help message and exit 
 +-V, --version               display version information and exit 
 + 
 +Bugs to jack@suse.cz 
 +</code> 
 + 
 +====3.5 - La Commande quota==== 
 + 
 +Pour visualiser les quotas d'un utilisateur spécifique, il convient d'utiliser la commande **quota** : 
 + 
 +<code> 
 +[root@centos8 ~]# quota fenestros 
 +Disk quotas for user fenestros (uid 1001): no limited resources used 
 +[root@centos8 ~]# su - fenestros 
 +[fenestros@centos8 ~]$ touch test 
 +[fenestros@centos8 ~]$ exit 
 +logout 
 +[root@centos8 ~]# quota fenestros 
 +Disk quotas for user fenestros (uid 1001):  
 +     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace 
 +      /dev/sdc1          8000   10000                                        
 +</code> 
 + 
 +Les options de la commande **quota** sont : 
 + 
 +<code> 
 +[root@centos8 ~]# quota --help 
 +quota: Usage: quota [-guPqvswim] [-l | [-Q | -A]] [-F quotaformat] 
 +        quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... 
 +        quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... 
 +        quota [-qvswugPQm] [-F quotaformat] -f filesystem ... 
 + 
 +-u, --user                display quota for user 
 +-g, --group               display quota for group 
 +-P, --project             display quota for project 
 +-q, --quiet               print more terse message 
 +-v, --verbose             print more verbose message 
 +-s, --human-readable      display numbers in human friendly units (MB, GB...) 
 +    --always-resolve      always try to translate name to id, even if it is 
 +                          composed of only digits 
 +-w, --no-wrap             do not wrap long lines 
 +-p, --raw-grace           print grace time in seconds since epoch 
 +-l, --local-only          do not query NFS filesystems 
 +-Q, --quiet-refuse        do not print error message when NFS server does 
 +                          not respond 
 +-i, --no-autofs           do not query autofs mountpoints 
 +-F, --format=formatname   display quota of a specific format 
 +-f, --filesystem-list     display quota information only for given filesystems 
 +-A, --all-nfs             display quota for all NFS mountpoints 
 +-m, --no-mixed-pathnames  trim leading slashes from NFSv4 mountpoints 
 +    --show-mntpoint       show mount point of the file system in output 
 +    --hide-device         do not show file system device in output 
 +-h, --help                display this help message and exit 
 +-V, --version             display version information and exit 
 + 
 +Bugs to: jack@suse.cz 
 +</code> 
 + 
 +====3.6 - La Commande warnquota==== 
 + 
 +La commande **warnquota** vérifie le ou les disques et envoie un message par mail à tout utilisateur qui a dépassé la limite soft. Elle est enrègle générale appelée par un job cron. Cependant elle peut aussi est appelée d'une manière intéractive. 
 + 
 +Sous RHEL/CentOS, warnquota n'est pas installé par défaut : 
 + 
 +<code> 
 +[root@centos8 ~]# which warnquota 
 +/usr/bin/which: no warnquota in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) 
 +</code> 
 + 
 +Installez donc le paquet **quota-warnquota** :  
 + 
 +<code> 
 +[root@centos7 ~]# dnf install quota-warnquota 
 +..
 +</code> 
 + 
 +Les options de la commande **warnquota** sont : 
 + 
 +<code> 
 +[root@centos8 ~]# warnquota --help 
 +warnquotaUsage: 
 +  warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...] 
 + 
 +-u, --user                      warn users 
 +-g, --group                     warn groups 
 +-s, --human-readable            send information in more human friendly units 
 +-i, --no-autofs                 avoid autofs mountpoints 
 +-d, --no-details                do not send quota information itself 
 +-F, --format=formatname         use quotafiles of specific format 
 +-c, --config=config-file        non-default config file 
 +-q, --quota-tab=quotatab-file   non-default quotatab 
 +-a, --admins-file=admins-file   non-default admins file 
 +-h, --help                      display this help message and exit 
 +-v, --version                   display version information and exit 
 + 
 +warnquotaBugs to jack@suse.cz
 </code> </code>
  
 ----- -----
-<html> +Copyright © 2022 Hugh Norris.
-<div align="center"> +
-Copyright © 2020 Hugh Norris. +
-</html>+
Menu