Différences

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

Lien vers cette vue comparative

elearning:workbooks:debian:10:avance:l102 [2022/04/29 07:57] – created adminelearning:workbooks:debian:10:avance:l102 [2022/05/02 08:14] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
 +
 +Version : **2022.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LDF302 - Gestion des Disques Avancée - Raid Logiciel======+======LDF602 - Gestion du Noyau et des Quotas======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LDF302 - Gestion Avancée des Disques - Raid Logiciel** +  * **LDF602 - Gestion du Noyau et des Quotas** 
-    * Contenu du Module +    * Rôle du noyau 
-    * Concepts RAID +    * LAB #1 - Compilation et installation du noyau 
-      * Disques en miroir +      * 1.1 - Déplacer /home 
-      * Bandes de données +      * 1.2 - Télécharger le Code Source du Noyau 
-    * Types de RAID +      * 1.3 Configurer le Noyau 
-      * RAID 0 Concaténation +      * 1.4 Compiler le Noyau 
-      * RAID 0 Striping +      * 1.5 Installer le Nouveau Noyau 
-      * RAID 1 - Miroir +      * 1.6 Désinstaller un Noyau 
-      * RAID 1+0 Striping en Miroir +    LAB #2 - Mise à Jour du Noyau avec le Gestionnaire des Paquets 
-      RAID 2 - Miroir avec Contrôle d'Erreurs +    LAB #3 - Gestion des Quotas 
-      RAID et 4 Striping avec Parité +      * 3.1 La Commande quotacheck 
-      * RAID 5 Striping avec Parité Distribuée +      * 3.2 - La Commande edquota 
-      * Au délà de RAID 5 +      3.3 - La Commande quotaon 
-    RAID Logiciel sous Debian +      * 3.4 - La Commande repquota 
-      * Préparation du disque +      * 3.5 - La Commande quota 
-      * Partitionnement +      * 3.6 - La Commande warnquota
-      * Mise en Place du RAID 5 Logiciel+
  
-=====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.
  
-    * Addition des capacités, +Commencez par identifier le noyau utilisé par votre machine :
-    * Amélioration des performances, +
-    * Apporter la tolérance de panne.+
  
-Deux concepts sont fondamentaux à la compréhension des solutions RAID.+<code> 
 +root@debian11:~# uname -r 
 +5.10.0-13-amd64 
 +</code>
  
-====Disques en miroir====+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 disques en miroir consiste à dupliquer l'écriture des données sur plusieurs disquesLe miroir peut être géré par un logiciel ou par du matériel.+<code> 
 +root@debian11:~# ls /lib/modules/`uname -r`/ 
 +kernel         modules.alias.bin  modules.builtin.alias.bin  modules.builtin.modinfo  modules.dep.bin  modules.order    modules.symbols 
 +modules.alias  modules.builtin    modules.builtin.bin        modules.dep              modules.devname  modules.softdep  modules.symbols.bin 
 +</code>
  
-====Bandes de données====+Les commandes pour manipuler les modules sont :
  
-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 physiques. L'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.+  * insmod 
 +  * rmmod 
 +  * lsmod 
 +  * modprobe
  
-=====Types de RAID=====+Par exemple :
  
-====RAID - Concaténation====+<code> 
 +root@debian11:~# lsmod 
 +Module                  Size  Used by 
 +rfkill                 28672 
 +raid456               180224 
 +async_raid6_recov      24576  1 raid456 
 +async_memcpy           20480  2 raid456,async_raid6_recov 
 +async_pq               20480  2 raid456,async_raid6_recov 
 +async_xor              20480  3 async_pq,raid456,async_raid6_recov 
 +async_tx               20480  5 async_pq,async_memcpy,async_xor,raid456,async_raid6_recov 
 +md_mod                180224  1 raid456 
 +sg                     36864  0 
 +virtio_balloon         24576 
 +joydev                 28672 
 +qemu_fw_cfg            20480  0 
 +pcspkr                 16384 
 +serio_raw              20480  0 
 +evdev                  28672  2 
 +ecryptfs              122880 
 +parport_pc             40960 
 +ppdev                  24576  0 
 +lp                     20480 
 +parport                69632  3 parport_pc,lp,ppdev 
 +fuse                  167936 
 +configfs               57344 
 +ip_tables              32768  0 
 +x_tables               53248  1 ip_tables 
 +autofs4                53248  2 
 +ext4                  921600 
 +crc16                  16384  1 ext4 
 +mbcache                16384  1 ext4 
 +jbd2                  151552  1 ext4 
 +hid_generic            16384  0 
 +btrfs                1568768 
 +usbhid                 65536 
 +hid                   147456  2 usbhid,hid_generic 
 +blake2b_generic        20480  0 
 +xor                    24576  2 async_xor,btrfs 
 +raid6_pq              122880  4 async_pq,btrfs,raid456,async_raid6_recov 
 +libcrc32c              16384  2 btrfs,raid456 
 +crc32c_generic         16384 
 +usb_storage            81920  0 
 +dm_mod                163840 
 +sd_mod                 61440  10 
 +t10_pi                 16384  1 sd_mod 
 +crc_t10dif             20480  1 t10_pi 
 +crct10dif_generic      16384  1 
 +crct10dif_common       16384  2 crct10dif_generic,crc_t10dif 
 +sr_mod                 28672 
 +cdrom                  73728  1 sr_mod 
 +virtio_net             61440 
 +net_failover           24576  1 virtio_net 
 +failover               16384  1 net_failover 
 +virtio_scsi            24576  8 
 +bochs_drm              16384  0 
 +ata_generic            16384  0 
 +drm_vram_helper        20480  1 bochs_drm 
 +uhci_hcd               53248 
 +drm_ttm_helper         16384  1 drm_vram_helper 
 +ttm                   114688  2 drm_vram_helper,drm_ttm_helper 
 +ehci_hcd               98304 
 +drm_kms_helper        278528  4 drm_vram_helper,bochs_drm 
 +cec                    61440  1 drm_kms_helper 
 +psmouse               184320 
 +drm                   618496  6 drm_kms_helper,drm_vram_helper,bochs_drm,drm_ttm_helper,ttm 
 +usbcore               323584  4 usbhid,usb_storage,ehci_hcd,uhci_hcd 
 +ata_piix               36864 
 +virtio_pci             28672 
 +libata                290816  2 ata_piix,ata_generic 
 +virtio_ring            36864  4 virtio_balloon,virtio_scsi,virtio_pci,virtio_net 
 +virtio                 16384  4 virtio_balloon,virtio_scsi,virtio_pci,virtio_net 
 +i2c_piix4              28672  0 
 +scsi_mod              262144  6 virtio_scsi,sd_mod,usb_storage,libata,sg,sr_mod 
 +usb_common             16384  3 usbcore,ehci_hcd,uhci_hcd 
 +floppy                 90112 
 +button                 24576 
 +</code>
  
-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.+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 :
  
-{{:linux:raid0c.gif|}}+<code> 
 +root@debian11:~# modprobe bonding
  
-===Avantages===+root@debian11:~# lsmod | head 
 +Module                  Size  Used by 
 +bonding               192512 
 +rfkill                 28672 
 +raid456               180224 
 +async_raid6_recov      24576  1 raid456 
 +async_memcpy           20480  2 raid456,async_raid6_recov 
 +async_pq               20480  2 raid456,async_raid6_recov 
 +async_xor              20480  3 async_pq,raid456,async_raid6_recov 
 +async_tx               20480  5 async_pq,async_memcpy,async_xor,raid456,async_raid6_recov 
 +md_mod                180224  1 raid456 
 +</code>
  
-  Récupération de l'espace disque.+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 :
  
-===Inconvénients===+<code> 
 +root@debian11:~# modprobe -r bonding 
 +root@debian11:~# lsmod | head 
 +Module                  Size  Used by 
 +rfkill                 28672 
 +raid456               180224 
 +async_raid6_recov      24576  1 raid456 
 +async_memcpy           20480  2 raid456,async_raid6_recov 
 +async_pq               20480  2 raid456,async_raid6_recov 
 +async_xor              20480  3 async_pq,raid456,async_raid6_recov 
 +async_tx               20480  5 async_pq,async_memcpy,async_xor,raid456,async_raid6_recov 
 +md_mod                180224  1 raid456 
 +sg                     36864 
 +</code>
  
-  * Pas de protection des données, +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** :
-  Pas d'augmentation des performances d'E/S.+
  
-====RAID 0 Striping====+<code> 
 +root@debian11:~# more /lib/modules/`uname -r`/modules.dep 
 +kernel/arch/x86/events/amd/power.ko: 
 +kernel/arch/x86/events/intel/intel-uncore.ko: 
 +kernel/arch/x86/events/intel/intel-cstate.ko: 
 +kernel/arch/x86/events/rapl.ko: 
 +kernel/arch/x86/kernel/cpu/mce/mce-inject.ko: 
 +kernel/arch/x86/kernel/msr.ko: 
 +kernel/arch/x86/kernel/cpuid.ko: 
 +kernel/arch/x86/crypto/glue_helper.ko: 
 +kernel/arch/x86/crypto/twofish-x86_64.ko: kernel/crypto/twofish_common.ko 
 +kernel/arch/x86/crypto/twofish-x86_64-3way.ko: kernel/arch/x86/crypto/twofish-x86_64.ko kernel/crypto/twofish_common.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/twofish-avx-x86_64.ko: kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/twofish-x86_64-3way.ko kernel/arch/x86/crypto/twofish-x86_64.ko kernel/crypto/twofish_co 
 +mmon.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/serpent-sse2-x86_64.ko: kernel/crypto/serpent_generic.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/serpent-avx-x86_64.ko: kernel/crypto/serpent_generic.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/serpent-avx2.ko: kernel/arch/x86/crypto/serpent-avx-x86_64.ko kernel/crypto/serpent_generic.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/des3_ede-x86_64.ko: kernel/lib/crypto/libdes.ko 
 +kernel/arch/x86/crypto/camellia-x86_64.ko: kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko: kernel/arch/x86/crypto/camellia-x86_64.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/camellia-aesni-avx2.ko: kernel/arch/x86/crypto/camellia-aesni-avx-x86_64.ko kernel/arch/x86/crypto/camellia-x86_64.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/ 
 +crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/blowfish-x86_64.ko: kernel/crypto/blowfish_common.ko 
 +kernel/arch/x86/crypto/cast5-avx-x86_64.ko: kernel/crypto/cast5_generic.ko kernel/crypto/cast_common.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko 
 +kernel/arch/x86/crypto/cast6-avx-x86_64.ko: kernel/crypto/cast6_generic.ko kernel/crypto/cast_common.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/aegis128-aesni.ko: kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko 
 +kernel/arch/x86/crypto/chacha-x86_64.ko: kernel/lib/crypto/libchacha.ko 
 +kernel/arch/x86/crypto/aesni-intel.ko: kernel/lib/crypto/libaes.ko kernel/crypto/crypto_simd.ko kernel/crypto/cryptd.ko kernel/arch/x86/crypto/glue_helper.ko 
 +kernel/arch/x86/crypto/sha1-ssse3.ko: 
 +kernel/arch/x86/crypto/sha256-ssse3.ko: 
 +kernel/arch/x86/crypto/sha512-ssse3.ko: kernel/crypto/sha512_generic.ko 
 +kernel/arch/x86/crypto/blake2s-x86_64.ko: kernel/lib/crypto/libblake2s-generic.ko 
 +kernel/arch/x86/crypto/ghash-clmulni-intel.ko: kernel/crypto/cryptd.ko 
 +kernel/arch/x86/crypto/crc32c-intel.ko: 
 +kernel/arch/x86/crypto/crc32-pclmul.ko: 
 +kernel/arch/x86/crypto/crct10dif-pclmul.ko: kernel/crypto/crct10dif_common.ko 
 +kernel/arch/x86/crypto/poly1305-x86_64.ko: 
 +kernel/arch/x86/crypto/curve25519-x86_64.ko: kernel/lib/crypto/libcurve25519-generic.ko 
 +kernel/arch/x86/kvm/kvm.ko: kernel/virt/lib/irqbypass.ko 
 +kernel/arch/x86/kvm/kvm-intel.ko: kernel/arch/x86/kvm/kvm.ko kernel/virt/lib/irqbypass.ko 
 +kernel/arch/x86/kvm/kvm-amd.ko: kernel/drivers/crypto/ccp/ccp.ko kernel/drivers/char/hw_random/rng-core.ko kernel/arch/x86/kvm/kvm.ko kernel/virt/lib/irqbypass.ko 
 +kernel/mm/hwpoison-inject.ko: 
 +kernel/mm/zsmalloc.ko: 
 +kernel/mm/z3fold.ko: 
 +kernel/fs/nfs_common/nfs_acl.ko: kernel/net/sunrpc/sunrpc.ko 
 +kernel/fs/nfs_common/grace.ko: 
 +kernel/fs/nfs_common/nfs_ssc.ko: 
 +kernel/fs/quota/quota_v1.ko: 
 +kernel/fs/quota/quota_v2.ko: kernel/fs/quota/quota_tree.ko 
 +kernel/fs/quota/quota_tree.ko: 
 +kernel/fs/nls/nls_cp437.ko: 
 +kernel/fs/nls/nls_cp737.ko: 
 +kernel/fs/nls/nls_cp775.ko: 
 +kernel/fs/nls/nls_cp850.ko: 
 +kernel/fs/nls/nls_cp852.ko: 
 +kernel/fs/nls/nls_cp855.ko: 
 +kernel/fs/nls/nls_cp857.ko: 
 +kernel/fs/nls/nls_cp860.ko: 
 +kernel/fs/nls/nls_cp861.ko: 
 +kernel/fs/nls/nls_cp862.ko: 
 +--More--(0%) 
 +[q] 
 +</code>
  
-Création de volume sur plusieurs disques afin d'augmenter les performances d'E/S. Le principe du striping est la création d'un volume à bandes réparties sur plusieurs tranches. La 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.+Il est possible d'obtenir des informations sur un module grâce à la commande **modinfo** :
  
-{{:linux:raid0s.gif|}}+<code> 
 +root@debian11:~# modinfo bonding 
 +filename      /lib/modules/5.10.0-13-amd64/kernel/drivers/net/bonding/bonding.ko 
 +author:         Thomas Davis, tadavis@lbl.gov and many others 
 +description:    Ethernet Channel Bonding Driver 
 +license:        GPL 
 +alias:          rtnl-link-bond 
 +depends:         
 +retpoline:      Y 
 +intree:         Y 
 +name:           bonding 
 +vermagic:       5.10.0-13-amd64 SMP mod_unload modversions  
 +sig_id:         PKCS#
 +signer:         Debian Secure Boot CA 
 +sig_key:        4B:6E:F5:AB:CA:66:98:25:17:8E:05:2C:84:66:7C:CB:C0:53:1F:8C 
 +sig_hashalgo:   sha256 
 +signature:      52:9F:34:1A:E8:04:22:2E:4C:92:17:82:D2:22:83:59:38:E2:EB:D6: 
 +                EC:81:C3:CD:F8:C1:B9:5F:FC:C2:6D:27:BC:7B:91:13:87:5B:2E:92: 
 +                77:36:A1:3D:F8:41:5C:9B:1D:62:E1:90:F7:48:F4:4E:7E:85:F5:54: 
 +                CD:51:99:A6:C4:E0:FB:2C:4F:D6:5F:11:15:93:7E:30:62:A9:FA:46: 
 +                29:90:B2:58:A4:B4:34:8B:EA:EF:14:AD:D6:5D:6C:4D:03:C9:AC:0F: 
 +                F1:28:A0:65:3C:AA:C8:CA:83:59:25:F3:09:20:F2:74:7F:5A:7D:BB: 
 +                84:17:57:F5:E6:16:E5:CB:A9:A3:0C:F0:A9:04:4A:B2:63:98:80:30: 
 +                73:EE:39:3A:86:3E:67:3C:2F:5C:38:1E:35:F9:79:6C:F6:60:7B:B5: 
 +                9D:3C:EA:0D:0F:23:E1:EC:EA:42:4C:EF:EC:AB:3E:07:D3:35:D7:E4: 
 +                4A:E4:D1:7A:50:F8:C1:50:5E:93:0C:A2:7D:D1:77:E2:3A:97:74:BA: 
 +                D7:38:7E:C0:4C:36:66:00:78:03:E0:E3:20:46:70:13:7D:15:10:3A: 
 +                85:B7:CB:10:3B:9A:DF:1A:4E:64:3D:BF:EC:21:7B:B1:4C:37:CE:30: 
 +                0D:90:FE:73:87:20:40:83:60:02:0F:4F:4D:85:78:E7 
 +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 (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>
  
-===Avantages===+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 :
  
-  * Augmentation des performances d'E/S par écriture en parallèle sur les disques.+<code> 
 +root@debian11:~# ls /etc/modprobe.d 
 +mdadm.conf
  
-===Inconvénients===+root@debian11:~# cat /etc/modprobe.d/mdadm.conf  
 +# mdadm module configuration file 
 +# set start_ro=1 to make newly assembled arrays read-only initially, 
 +# to prevent metadata writes.  This is needed in order to allow 
 +# resume-from-disk to work - new boot should not perform writes 
 +# because it will be done behind the back of the system being 
 +# resumed.  See http://bugs.debian.org/415441 for details.
  
-  * Pas de protection des données.+options md_mod start_ro=1 
 +</code>
  
-====RAID 1 - Miroir====+=====LAB #1 - Compilation et installation du noyau=====
  
-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// :+Commencez par installer les paquets necessaires :
  
-{{:linux:raid1m.gif|}}+<code> 
 +root@debian11:~# apt-get update 
 +Hit:1 http://deb.debian.org/debian bullseye InRelease 
 +Get:2 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB] 
 +Get:3 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB] 
 +Fetched 83.5 kB in 1s (158 kB/s)               
 +Reading package lists..Done
  
-===Avantages===+root@debian11:~# apt-get -y install build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves debconf-utils dpkg-dev debhelper ncurses-dev 
 +</code>
  
-  * Protection des données contre une défaillance d'un disque.+====1.1 - Déplacer /home====
  
-===Inconvénients===+Créez une seule partition sur **/dev/sdb** :
  
-  * Coûteux à cause de l'augmentation du nombre de disques.+<code> 
 +root@debian11:~# fdisk /dev/sdb
  
-====RAID 1+0 Striping en Miroir====+Welcome to fdisk (util-linux 2.36.1). 
 +Changes will remain in memory only, until you decide to write them. 
 +Be careful before using the write command.
  
-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**:+Device does not contain a recognized partition table. 
 +Created a new DOS disklabel with disk identifier 0xa10c368d.
  
-{{:linux:raid10.gif|}}+Command (m for help)
 +Partition type 
 +     primary (0 primary, 0 extended, 4 free) 
 +     extended (container for logical partitions) 
 +Select (default p)
  
-===Avantages===+Using default response p. 
 +Partition number (1-4, default 1):  
 +First sector (2048-134217727, default 2048):  
 +Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-134217727, default 134217727): 
  
-  * Protection des données contre une défaillance d'un disque. +Created a new partition 1 of type 'Linuxand of size 64 GiB.
-  * Augmentation des performances d'E/S par écriture en parallèle sur les disques.+
  
-===Inconvénients===+Command (m for help): w 
 +The partition table has been altered. 
 +Calling ioctl() to re-read partition table. 
 +Syncing disks. 
 +</code>
  
-  * Coûteux à cause de l'augmentation du nombre de disques.+Créez maintenant un système de fichiers ext4 sur **/dev/sdb1** :
  
-====RAID 2 - Miroir avec Contrôle d'Erreurs====+<code> 
 +root@debian11:~# mkfs.ext4 /dev/sdb1 
 +mke2fs 1.46.(28-Feb-2021) 
 +Discarding device blocks: done                             
 +Creating filesystem with 16776960 4k blocks and 4194304 inodes 
 +Filesystem UUID: 24f1821e-1d5b-4256-8ee3-c9ee6b382ddc 
 +Superblock backups stored on blocks:  
 +        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,  
 +        4096000, 7962624, 11239424
  
-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.+Allocating group tables: done                             
 +Writing inode tables: done                             
 +Creating journal (65536 blocks): done 
 +Writing superblocks and filesystem accounting information: done  
 +</code>
  
-====RAID 3 et 4 - Striping avec Parité====+Editez le fichier **/etc/ssh/sshd_config** et modifiez la directive **PermitRootLogin** :
  
-Les RAID 3 et 4 sont des technologies avec bandes de parité distribuées sur un seul disque :+<code> 
 +root@debian11:~# vi /etc/ssh/sshd_config 
 +root@debian11:~# cat /etc/ssh/sshd_config 
 +#       $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
  
-{{:linux:raid34.gif|}}+# This is the sshd server system-wide configuration file.  See 
 +# sshd_config(5) for more information.
  
-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).+# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
  
-En RAID 4la taille des segments est variable et se modifie en temps réelCela 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+# The strategy used for options in the default sshd_config shipped with 
 +# OpenSSH is to specify options with their default value where 
 +# possiblebut leave them commented Uncommented options override the 
 +# default value.
  
-===Avantages===+Include /etc/ssh/sshd_config.d/*.conf
  
-  * Protection des données contre une défaillance d'un disque.+#Port 22 
 +#AddressFamily any 
 +#ListenAddress 0.0.0.0 
 +#ListenAddress ::
  
-===Inconvénients===+#HostKey /etc/ssh/ssh_host_rsa_key 
 +#HostKey /etc/ssh/ssh_host_ecdsa_key 
 +#HostKey /etc/ssh/ssh_host_ed25519_key
  
-  * Création d'un goulot d'étranglement des données à cause de l'écriture des données de parité sur un seul disque.+# Ciphers and keying 
 +#RekeyLimit default none
  
-====RAID 5 - Striping avec Parité Distribuée====+# Logging 
 +#SyslogFacility AUTH 
 +#LogLevel INFO
  
-Le RAID 5 est une technologie avec bandes de parité distribuées sur plusieurs disques :+# Authentication:
  
-{{:linux:raid5.gif|}}+#LoginGraceTime 2m 
 +PermitRootLogin yes  
 +#StrictModes yes 
 +#MaxAuthTries 6 
 +#MaxSessions 10
  
-===Avantages===+... 
 +</code>
  
-  * Protection des données contre une défaillance d'un disque, +Re-démarrez le serveur ssh :
-  * Evite le goulot d'étranglement d'un seul disque de parité.+
  
-===Inconvénients===+<code> 
 +root@debian11:~# systemctl restart sshd 
 +root@debian11:~# systemctl status sshd 
 +● ssh.service - OpenBSD Secure Shell server 
 +     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) 
 +     Active: active (running) since Sun 2022-05-01 15:35:50 CEST; 6s ago 
 +       Docs: man:sshd(8) 
 +             man:sshd_config(5) 
 +    Process: 2793 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) 
 +   Main PID: 2794 (sshd) 
 +      Tasks: 1 (limit: 4656) 
 +     Memory: 1.1M 
 +        CPU: 25ms 
 +     CGroup: /system.slice/ssh.service 
 +             └─2794 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
  
-  * Lecture moins performante qu'avec RAID 3 et 4.+May 01 15:35:50 debian11 systemd[1]: Starting OpenBSD Secure Shell server... 
 +May 01 15:35:50 debian11 sshd[2794]: Server listening on 0.0.0.0 port 22. 
 +May 01 15:35:50 debian11 sshd[2794]: Server listening on :: port 22. 
 +May 01 15:35:50 debian11 systemd[1]: Started OpenBSD Secure Shell server. 
 +</code>
  
-====Au délà de RAID 5====+<WRAP center round todo> 
 +**A Faire** - Déconnectez-vous en ssh. Connectez-vous directement en tant que root en ssh. 
 +</WRAP>
  
-Il existe aussi deux autres technologies RAID, toute deux issues de la technologie RAID 5 :+Montez **/dev/sdb1** sur /mnt :
  
-  * RAID 6 +<code> 
-    //Disk Striping with Double Distributed Parity/+root@debian11:~# mount /dev/sdb1 /mnt 
-  * RAID TP +</code>
-    * //Disk Striping with Triple Distributed Parity//+
  
-=====RAID Logiciel sous Debian=====+Copiez le contenu de /home vers /mnt :
  
-====Préparation du disque====+<code> 
 +root@debian11:~# cp -a /home/* /mnt 
 +</code>
  
-===Partitionnement===+Démontez /dev/sdb1 :
  
-Suite à votre LAB de la leçon **Gestion des Disques et le Swap**, votre disque comporte 12 partitions :+<code> 
 +root@debian11:~# umount /mnt 
 +</code> 
 + 
 +Identifiez l'UUID de /dev/sdb1 :
  
 <code> <code>
-root@debian8:~# fdisk -l+root@debian11:~# ls -l /dev/disk/by-uuid/ | grep sdb1 
 +lrwxrwxrwx 1 root root 10 May  1 15:31 24f1821e-1d5b-4256-8ee3-c9ee6b382ddc -> ../../sdb1 
 +</code>
  
-Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors +Editez le fichier **/etc/fstab** en ajoutant la ligne pour le montage de /home :
-Units: sectors of 1 512 = 512 bytes +
-Sector size (logical/physical): 512 bytes / 512 bytes +
-I/O size (minimum/optimal): 512 bytes / 512 bytes +
-Disklabel type: dos +
-Disk identifier0xac1e8183+
  
-Device     Boot    Start      End  Sectors  Size Id Type +<code> 
-/dev/sda1  *        2048 20482047 20480000  9.8G 83 Linux +root@debian11:~# vi /etc/fstab 
-/dev/sda2       20482048 41938943 21456896 10.2G  5 Extended +root@debian11:~# cat /etc/fstab 
-/dev/sda5       20484096 24578047  4093952    2G 82 Linux swap / Solaris +/etc/fstab: static file system information. 
-/dev/sda6       24610816 25587711   976896  477M fd Linux raid autodetect +
-/dev/sda7       25589760 25980927   391168  191M 8e Linux LVM +# Use 'blkid' to print the universally unique identifier for a 
-/dev/sda8       25982976 26568703   585728  286M 8e Linux LVM +# device; this may be used with UUID= as a more robust way to name devices 
-/dev/sda9       26570752 27547647   976896  477M fd Linux raid autodetect +# that works even if disks are added and removed. See fstab(5). 
-/dev/sda10      27549696 28329983   780288  381M 8e Linux LVM +
-/dev/sda11      28332032 29308927   976896  477M fd Linux raid autodetect +# systemd generates mount units based on this file, see systemd.mount(5). 
-/dev/sda12      29310976 30287871   976896  477M fd Linux raid autodetect +# Please run 'systemctl daemon-reload' after making changes here. 
-/dev/sda13      30289920 30699519   409600  200M 83 Linux+
 +# <file system> <mount point>   <type>  <options>       <dump>  <pass> 
 +# / was on /dev/sda1 during installation 
 +UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e               ext4    errors=remount-ro 0       1 
 +UUID=24f1821e-1d5b-4256-8ee3-c9ee6b382ddc /home           ext4    defaults      0 0 
 +# swap was on /dev/sda5 during installation 
 +UUID=1f9439f5-4b19-49b1-b292-60c2c674cee9 none            swap    sw              0       0 
 +/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto           0
 </code> </code>
  
-====Mise en Place du RAID 5 Logiciel====+Créez le point de montage /home :
  
-Dans le cas de cet exemple les quatre partitions concernées par la mise en place d'un RAID 5 sont :+<code> 
 +root@debian11:~# rm -rf /home 
 +root@debian11:~# mkdir /home 
 +</code>
  
-<file> +Montez /dev/sdb1 :
-/dev/sda6       24610816 25587711   976896  477M fd Linux raid autodetect +
-/dev/sda9       26570752 27547647   976896  477M fd Linux raid autodetect +
-/dev/sda11      28332032 29308927   976896  477M fd Linux raid autodetect +
-/dev/sda12      29310976 30287871   976896  477M 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 :+<code> 
 +root@debian11:~# mount -a 
 + 
 +root@debian11:~# mount 
 +sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) 
 +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) 
 +udev on /dev type devtmpfs (rw,nosuid,relatime,size=1986968k,nr_inodes=496742,mode=755) 
 +devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) 
 +tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=402560k,mode=755) 
 +/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro) 
 +securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) 
 +tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) 
 +tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) 
 +cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot) 
 +pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) 
 +none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700) 
 +systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11732) 
 +mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime) 
 +debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime) 
 +hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M) 
 +tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime) 
 +configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime) 
 +fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime) 
 +tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=402556k,nr_inodes=100639,mode=700) 
 +/dev/sdb1 on /home type ext4 (rw,relatime) 
 +</code> 
 + 
 +Notez la taille de /home :
  
 <code> <code>
-mdadm --create <unité RAID> [options] <unités physiques>+root@debian11:~# df -
 +Filesystem      Size  Used Avail Use% Mounted on 
 +udev            1.9G      1.9G   0% /dev 
 +tmpfs           394M  892K  393M   1% /run 
 +/dev/sda1        31G  4.1G   25G  14% / 
 +tmpfs           2.0G      2.0G   0% /dev/shm 
 +tmpfs           5.0M      5.0M   0% /run/lock 
 +tmpfs           394M   36K  394M   1% /run/user/
 +/dev/sdb1        63G  1.4M   60G   1% /home
 </code> </code>
  
-Sous Debian 8, mdadm n'est pas installé par défaut :+<WRAP center round todo> 
 +**A Faire** - Fermez la session de root et connectez-vous en tant que trainee en ssh. 
 +</WRAP> 
 + 
 +====1.2 - Télécharger le Code Source du Noyau==== 
 + 
 +Le code source est disponible sur le site **www.kernel.org** :
  
 <code> <code>
-root@debian8:~# apt-get install mdadm +trainee@debian11:~$ wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.11.1.tar.gz 
-Reading package lists... Done +--2022-05-01 15:46:58--  https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.11.1.tar.gz 
-Building dependency tree        +Resolving www.kernel.org (www.kernel.org)... 145.40.68.75, 2604:1380:4601:e00::1 
-Reading state information... Done +Connecting to www.kernel.org (www.kernel.org)|145.40.68.75|:443... connected. 
-The following NEW packages will be installed: +HTTP request sent, awaiting response... 301 Moved Permanently 
-  mdadm +Location: https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.11.1.tar.gz [following] 
-0 upgraded, newly installed, 0 to remove and 0 not upgraded. +--2022-05-01 15:46:58--  https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.11.1.tar.gz 
-Need to get 432 kB of archives+Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.101.1, 2604:1380:2001:3900::1 
-After this operation, 1,233 kB of additional disk space will be used. +Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.101.1|:443... connected. 
-Get:1 http://ftp.fr.debian.org/debianjessie/main mdadm amd64 3.3.2-5+deb8u1 [432 kB] +HTTP request sent, awaiting response... 200 OK 
-Fetched 432 kB in 3s (123 kB/s) +Length186370882 (178M[application/x-gzip] 
-Preconfiguring packages ... +Saving to: ‘linux-5.11.1.tar.gz’ 
-Selecting previously unselected package mdadm+ 
-(Reading database ... 82568 files and directories currently installed.) +linux-5.11.1.tar.gz                                  100%[====================================================================================================================>] 177.74M  83.4MB/s    in 2.1s     
-Preparing to unpack .../mdadm_3.3.2-5+deb8u1_amd64.deb ... + 
-Unpacking mdadm (3.3.2-5+deb8u1) ... +2022-05-01 15:47:01 (83.4 MB/s) - ‘linux-5.11.1.tar.gz’ saved [186370882/186370882]
-Processing triggers for man-db (2.7.0.2-5... +
-Processing triggers for systemd (215-17+deb8u4) ... +
-Setting up mdadm (3.3.2-5+deb8u1) ... +
-Generating mdadm.conf... done+
-update-initramfsdeferring update (trigger activated) +
-update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults +
-update-rc.dwarning: start and stop actions are no longer supported; falling back to defaults +
-Processing triggers for systemd (215-17+deb8u4) ... +
-Processing triggers for initramfs-tools (0.120+deb8u1) ... +
-update-initramfs: Generating /boot/initrd.img-3.16.0-4-amd64 +
-Wmdadm: /etc/mdadm/mdadm.conf defines no arrays. +
-W: mdadm: no arrays defined in configuration file+
 </code> </code>
  
-Saisissez maintenant la commande suivante :+Désarchivez le tar.xz que vous avez téléchargé :
  
 <code> <code>
-root@debian8:~# mdadm --create /dev/md1 --level=--raid-devices=3 /dev/sda6 /dev/sda9 /dev/sda11 +trainee@debian8:~$ tar xf linux-5.11.1.tar.gz
-mdadm: Defaulting to version 1.2 metadata +
-mdadm: array /dev/md1 started.+
 </code> </code>
  
-Les options dans la ligne de commande sont :+Notez que l'occupation disque du code source du noyau linux-5.11.1 est de 1.2 Go :
  
-^ Option Courte ^ Option Longue ^ Description ^ +<code> 
--l | -level | Le niveau RAID - **linear, 0,1,2,4 ou 5** | +trainee@debian11:~$ du -hs ./linux-5.11.1 
--n | - -raid-devices=<nombre| Le nombre de périphériques actifs dans le RAID |+1.2G    ./linux-5.11.1 
 +</code>
  
-Les autres options de la commande **mdadm** peuvent être visualisées grâce à la commande suivante :+====1.3 - Configurer le Noyau==== 
 + 
 +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 Debian :
  
 <code> <code>
-root@debian8:~# mdadm --help-options +trainee@debian11:~$ cat ./linux-5.11.1/Makefile | head 
-Any parameter that does not start with '-' is treated as a device name +# SPDX-License-Identifier: GPL-2.0 
-or, for --examine-bitmap, a file name+VERSION = 5 
-The first such name is often the name of an md device.  Subsequent +PATCHLEVEL = 11 
-names are often names of component devices.+SUBLEVEL = 1 
 +EXTRAVERSION = 
 +NAME = 💕 Valentine's Day Edition 💕
  
-Some common options are: +# *DOCUMENTATION* 
-  --help        -h   : General help message or, after above option, +# To see a list of typical targets execute "make help" 
-                       mode specific help message +# More info can be located in ./README 
-  --help-options     : This help message +</code>
-  --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    -A   Assemble an array +<WRAP center round important> 
-  --build       -B   Build an array without metadata +**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 stable. Quand vous recompilez le noyau à partir des sources, vous 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. 
-  --create      -C   Create a new array +</WRAP> 
-  --detail      -D   : Display details of an array + 
-  --examine     -E   : Examine superblock on an array component +Utilisez maintenant la commande **make defconfig** pour créer le fichier de configuration .config 
-  --examine-bitmap -X: Display the detail of a bitmap file + 
-  --examine-badblocks: Display list of known bad blocks on device +<code> 
-  --monitor     -F   : monitor (follow) some arrays +trainee@debian11:~$ su - 
-  --grow        -G   : resizereshape and array +Passwordfenestros 
-  --incremental -I   : add/remove a single device to/from an array as appropriate +root@debian11:~# cd /home/trainee/linux-5.11.1/ 
-  --query       -Q   : Display general information about how a +root@debian11:/home/trainee/linux-5.11.1# make defconfig 
-                       device relates to the md driver +  HOSTCC  scripts/basic/fixdep 
-  --auto-detect      : Start arrays auto-detected by the kernel+  HOSTCC  scripts/kconfig/conf.o 
 +  HOSTCC  scripts/kconfig/confdata.o 
 +  HOSTCC  scripts/kconfig/expr.o 
 +  LEX     scripts/kconfig/lexer.lex.c 
 +  YACC    scripts/kconfig/parser.tab.[ch] 
 +  HOSTCC  scripts/kconfig/lexer.lex.o 
 +  HOSTCC  scripts/kconfig/parser.tab.o 
 +  HOSTCC  scripts/kconfig/preprocess.o 
 +  HOSTCC  scripts/kconfig/symbol.o 
 +  HOSTCC  scripts/kconfig/util.o 
 +  HOSTLD  scripts/kconfig/conf 
 +*** Default configuration is based on 'x86_64_defconfig' 
 +
 +# configuration written to .config 
 +#
 </code> </code>
  
-Les //modes majeurs// de la commande **mdadm** peuvent être visualisés grâce à la commande suivante :+Ce fichier est configuré par une des trois commandes suivantes : 
 + 
 +  make config 
 +  make menuconfig 
 +  make xconfig 
 + 
 +Dans ce fichier, vous pouvez constater la présence de lignes correspondantes à des fonctionalités suivies par une lettre ou une valeur. Dans le cas d'une lettre, la signification est la suivante : 
 + 
 +  * **y** 
 +    * la fonctionalité est incluse dans le noyau monolithique ou dans le cas d'une dépendance d'un module, dans le module concerné, 
 +  * **m** 
 +    * la fonctionalité est incluse en tant que module, 
 +  * **n** 
 +    * la fonctionalité n'est pas incluse. Cette option est rarement visible car dans bien les cas, la fonctionalité est simplement commentée dans le fichier lui-même.
  
 <code> <code>
-root@debian8:~# mdadm --help +root@debian11:/home/trainee/linux-5.11.1# more .config  
-mdadm is used for building, managing, and monitoring +# 
-Linux md devices (aka RAID arrays) +# Automatically generated file; DO NOT EDIT. 
-Usage: mdadm --create device options... +# Linux/x86 5.11.1 Kernel Configuration 
-            Create a new array from unused devices. +# 
-       mdadm --assemble device options... +CONFIG_CC_VERSION_TEXT="gcc (Debian 10.2.1-6) 10.2.1 20210110" 
-            Assemble a previously created array. +CONFIG_CC_IS_GCC=y 
-       mdadm --build device options..+CONFIG_GCC_VERSION=100201 
-            Create or assemble an array without metadata. +CONFIG_LD_VERSION=235020000 
-       mdadm --manage device options... +CONFIG_CLANG_VERSION=0 
-            make changes to an existing array. +CONFIG_LLD_VERSION=0 
-       mdadm --misc options... devices +CONFIG_CC_CAN_LINK=y 
-            report on or modify various md related devices. +CONFIG_CC_CAN_LINK_STATIC=y 
-       mdadm --grow options device +CONFIG_CC_HAS_ASM_GOTO=y 
-            resize/reshape an active array +CONFIG_CC_HAS_ASM_INLINE=y 
-       mdadm --incremental device +CONFIG_IRQ_WORK=y 
-            add/remove a device to/from an array as appropriate +CONFIG_BUILDTIME_TABLE_SORT=y 
-       mdadm --monitor options... +CONFIG_THREAD_INFO_IN_TASK=y 
-            Monitor one or more array for significant changes. + 
-       mdadm device options... +
-            Shorthand for --manage. +# General setup 
-Any parameter that does not start with '-' is treated as a device name +
-or, for --examine-bitmap, a file name. +CONFIG_INIT_ENV_ARG_LIMIT=32 
-The first such name is often the name of an md device.  Subsequent +# CONFIG_COMPILE_TEST is not set 
-names are often names of component devices.+CONFIG_LOCALVERSION="" 
 +# CONFIG_LOCALVERSION_AUTO is not set 
 +CONFIG_BUILD_SALT="" 
 +CONFIG_HAVE_KERNEL_GZIP=y 
 +CONFIG_HAVE_KERNEL_BZIP2=y 
 +CONFIG_HAVE_KERNEL_LZMA=y 
 +CONFIG_HAVE_KERNEL_XZ=y 
 +CONFIG_HAVE_KERNEL_LZO=y 
 +CONFIG_HAVE_KERNEL_LZ4=y 
 +CONFIG_HAVE_KERNEL_ZSTD=y 
 +CONFIG_KERNEL_GZIP=y 
 +# CONFIG_KERNEL_BZIP2 is not set 
 +# CONFIG_KERNEL_LZMA is not set 
 +# CONFIG_KERNEL_XZ is not set 
 +# CONFIG_KERNEL_LZO is not set 
 +# CONFIG_KERNEL_LZ4 is not set 
 +# CONFIG_KERNEL_ZSTD is not set 
 +CONFIG_DEFAULT_INIT="" 
 +CONFIG_DEFAULT_HOSTNAME="(none)" 
 +CONFIG_SWAP=y 
 +CONFIG_SYSVIPC=y 
 +CONFIG_SYSVIPC_SYSCTL=y 
 +CONFIG_POSIX_MQUEUE=y 
 +CONFIG_POSIX_MQUEUE_SYSCTL=y 
 +# CONFIG_WATCH_QUEUE is not set 
 +CONFIG_CROSS_MEMORY_ATTACH=y 
 +CONFIG_USELIB=y 
 +CONFIG_AUDIT=y 
 +CONFIG_HAVE_ARCH_AUDITSYSCALL=y 
 +CONFIG_AUDITSYSCALL=y
  
- For detailed help on the above major modes use --help after the mode +# 
- e.g. +# IRQ subsystem 
-         mdadm --assemble --help +
- For general help on options use +CONFIG_GENERIC_IRQ_PROBE=y 
-         mdadm --help-options+--More--(1%) 
 +[q]
 </code> </code>
  
-Dernièrement, chaque //mode majeur// dispose de son propre aide :+====1.4 - Compiler le Noyau==== 
 + 
 +La compilation du noyau peut prendre beaucoup de temps. La commande utilisée est la suivante :
  
 <code> <code>
-root@debian8:~# mdadm --assemble --help +root@debian11:/home/trainee/linux-5.11.1# make deb-pkg clean 
-Usage: mdadm --assemble device options... +... 
-       mdadm --assemble --scan options...+dpkg-buildpackage: info: full upload (original source is included) 
 +  CLEAN   arch/x86/entry/vdso 
 +  CLEAN   arch/x86/kernel/cpu 
 +  CLEAN   arch/x86/kernel 
 +  CLEAN   arch/x86/realmode/rm 
 +  CLEAN   arch/x86/lib 
 +  CLEAN   certs 
 +  CLEAN   drivers/firmware/efi/libstub 
 +  CLEAN   drivers/scsi 
 +  CLEAN   drivers/tty/vt 
 +  CLEAN   drivers/video/logo 
 +  CLEAN   lib 
 +  CLEAN   net/wireless 
 +  CLEAN   security/selinux 
 +  CLEAN   usr/include 
 +  CLEAN   usr 
 +  CLEAN   arch/x86/boot/compressed 
 +  CLEAN   arch/x86/boot 
 +  CLEAN   arch/x86/tools 
 +  CLEAN   vmlinux.symvers modules.builtin modules.builtin.modinfo 
 +</code>
  
-This usage assembles one or more raid arrays from pre-existing +A l'issu du processusles paquets du nouveau noyau se trouvent dans le répertoire **/home/trainee** :
-components. +
-For each arraymdadm needs to know the md device, the identity of +
-the array, and a number of sub devices. These can be found in a number +
-of ways.+
  
-The md device is given on the command line, is found listed in the +<code> 
-config file, or can be deduced from the array identity+root@debian11:/home/trainee/linux-5.11.1# cd .
-The array identity is determined either from the --uuid, --name, or +root@debian11:/home/trainee# ls 
---super-minor commandline arguments, from the config file, +Desktop    linux-5.11.1                           linux-5.11.1_5.11.1-1.diff.gz    linux-5.11.1.tar.gz                      linux-libc-dev_5.11.1-1_amd64.deb  Public 
-or from the first component device on the command line.+Documents  linux-5.11.1_5.11.1-1_amd64.buildinfo  linux-5.11.1_5.11.1-1.dsc        linux-headers-5.11.1_5.11.1-1_amd64.deb  Music                              Templates 
 +Downloads  linux-5.11.1_5.11.1-1_amd64.changes    linux-5.11.1_5.11.1.orig.tar.gz  linux-image-5.11.1_5.11.1-1_amd64.deb    Pictures                           Videos 
 +</code>
  
-The different combinations of these are as follows: +====1.Installer le Noyau====
- If the --scan option is not given, then only devices and identities +
- listed on the command line are considered. +
- The first device will be the array device, and the remainder will be +
- examined when looking for components. +
- 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 +Installez maintenant les paquets **deb** :
- every array listed in the config file is considered for assembly. +
- The identity of candidate devices are determined from the config file. +
- After these arrays are assembled, mdadm will look for other devices +
- that could form further arrays and tries to assemble them.  This can +
- be disabled using the 'AUTO' option in the config file.+
  
- If the --scan option is given as well as one or more devices, then +<code> 
- Those devices are md devices that are to be assembled Their identity +root@debian11:/home/trainee# dpkg -i /home/trainee/linux*.deb 
- and components are determined from the config file.+</code>
  
- If mdadm can not find all of the components for an array, it will assemble +Constatez la création d'un nouveau grub.cfg :
- it but not activate it unless --run or --scan is given.  To preserve this +
- behaviour even with --scan, add --no-degraded.  Note that "all of the +
- components" means as many as were present the last time the array was running +
- as recorded in the superblock.  If the array was already degraded, and +
- the missing device is not a new problem, it will still be assembled.  It +
- is only newly missing devices that cause the array not to be started.+
  
-Options that are valid with --assemble (-A) are: +<code> 
-  --bitmap=          : bitmap file to use with the array +root@debian11:/home/trainee# grep 5.11.1 /boot/grub/grub.cfg 
-  --uuid=       -u   : uuid of array to assembleDevices which don'+        echo    'Loading Linux 5.11.1 ...' 
-                       have this uuid are excluded +        linux   /boot/vmlinuz-5.11.1 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
-  --super-minor= -m  : minor number to look for in super-block when +        initrd  /boot/initrd.img-5.11.1 
-                       choosing devices to use. +        menuentry 'Debian GNU/Linux, with Linux 5.11.1' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.1-advanced-9887a74f-a680-4bde-8f04-db5ae9ea186e'
-  --name=       -N   : Array name to look for in super-block+                echo    'Loading Linux 5.11.1 ...' 
-  --config    -c   : config file +                linux   /boot/vmlinuz-5.11.1 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro  quiet 
-  --scan        -s   : scan config file for missing information +                initrd  /boot/initrd.img-5.11.1 
-  --run         -R   : Try to start the array even if not enough devices +        menuentry 'Debian GNU/Linux, with Linux 5.11.1 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.11.1-recovery-9887a74f-a680-4bde-8f04-db5ae9ea186e
-                       for a full array are present +                echo    'Loading Linux 5.11.1 ...' 
-  --force       -f   : Assemble the array even if some superblocks appear +                linux   /boot/vmlinuz-5.11.1 root=UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e ro single  
-                     : out-of-date This involves modifying the superblocks. +                initrd  /boot/initrd.img-5.11.1
-  --update=     -U   : Update superblock: try '---update=?for option list+
-  --no-degraded      : Assemble but do not start degraded arrays. +
-  --readonly    -o   : Mark the array as read-onlyNo resync will start+
 </code> </code>
  
-Constatez maintenant les informations concernant le RAID 5 créé :+====1.6 - Désinstaller un Noyau==== 
 + 
 +Lister les noyaux installés :
  
 <code> <code>
-root@debian8:~# cat /proc/mdstat +root@debian11:/home/trainee# dpkg -l | grep -i "linux-image*" | awk '{print $2}' 
-Personalities : [raid6] [raid5] [raid4]  +linux-image-5.10.0-13-amd64 
-md1 : active raid5 sda11[3] sda9[1] sda6[0] +linux-image-5.11.
-      974848 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU] +linux-image-amd64
-       +
-unused devices: <none>+
 </code> </code>
  
-Grâce à la commande mdadm, il est possible d'obtenir d'avantage d'informations :+Le noyau se désinstalle comme tout autre paquet :
  
 <code> <code>
-root@debian8:~mdadm --query /dev/md1 +root@debian11:/home/traineeapt-get -y purge "linux-image-5.11.1" 
-/dev/md1952.16MiB raid5 3 devices, sparesUse mdadm --detail for more detail.+Reading package lists... Done 
 +Building dependency tree... Done 
 +Reading state information... Done 
 +The following packages will be REMOVED: 
 +  linux-image-5.11.1* 
 +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 
 +After this operation, 15.1 MB disk space will be freed. 
 +(Reading database ... 118012 files and directories currently installed.) 
 +Removing linux-image-5.11.1 (5.11.1-1) ... 
 +update-initramfs: Deleting /boot/initrd.img-5.11.1 
 +Generating grub configuration file ... 
 +Found background image: /usr/share/images/desktop-base/desktop-grub.png 
 +Found linux image/boot/vmlinuz-5.10.0-13-amd64 
 +Found initrd image: /boot/initrd.img-5.10.0-13-amd64 
 +done 
 +(Reading database ... 117967 files and directories currently installed.) 
 +Purging configuration files for linux-image-5.11.1 (5.11.1-1) ...
 </code> </code>
  
-L'option **- -detail** produit le résultat suivant :+Vérifiez que le fichier grub.cfg a été modifié :
  
 <code> <code>
-root@debian8:~mdadm --query /dev/md1 +root@debian11:/home/traineegrep 5.11.1 /boot/grub/grub.cfg 
-/dev/md1: 952.16MiB raid5 3 devices, 0 spares. Use mdadm --detail for more detail+root@debian11:/home/trainee#  
-root@debian8:~# mdadm --detail /dev/md1 +</code>
-/dev/md1: +
-        Version : 1.2 +
-  Creation Time : Wed Aug  3 13:20:07 2016 +
-     Raid Level : raid5 +
-     Array Size : 974848 (952.16 MiB 998.24 MB) +
-  Used Dev Size : 487424 (476.08 MiB 499.12 MB) +
-   Raid Devices : 3 +
-  Total Devices : 3 +
-    Persistence : Superblock is persistent+
  
-    Update Time Wed Aug  3 13:20:16 2016 +Dernièrement, listez les noyaux disponibles :
-          State : clean  +
- Active Devices : 3 +
-Working Devices : 3 +
- Failed Devices : 0 +
-  Spare Devices : 0+
  
-         Layout left-symmetric +<code> 
-     Chunk Size : 512K+root@debian11:/home/trainee# dpkg -l | grep -i "linux-image*" | awk '{print $2}' 
 +linux-image-5.10.0-13-amd64 
 +linux-image-amd64 
 +</code>
  
-           Name : debian8: (local to host debian8) +=====LAB #2 - Mise à Jour du Noyau avec le Gestionnaire des Paquets=====
-           UUID : 41b8799a:e24feb35:39e9aa3a:ec920626 +
-         Events : 18+
  
-    Number   Major   Minor   RaidDevice State +Afin d'obtenir la **dernière version du noyau pré-compliée** par Debian, il convient d'ajouter les dépôts **unstable** : 
-       0              6        0      active sync   /dev/sda6 + 
-       1              9        1      active sync   /dev/sda9 +<code> 
-       3             11        2      active sync   /dev/sda11+root@debian11:/home/trainee# echo "deb http://deb.debian.org/debian unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list 
 +deb http://deb.debian.org/debian unstable main contrib non-free 
 +root@debian11:/home/trainee# echo "deb-src http://deb.debian.org/debian unstable main contrib non-free" | sudo tee -a /etc/apt/sources.list 
 +deb-src http://deb.debian.org/debian unstable main contrib non-free
 </code> </code>
  
-Notez la ligne **Persistence : Superblock is persistent**. En effet, cette 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.+Afin de ne faire que des mises à jour du **noyau** à partir de ce dépôt, créez le fichier **/etc/apt/preferences** :
  
-<WRAP center round todo+<code
-Recherchez la signification des termes Layout, Chunk size, Major et Minor. +root@debian11:/home/trainee# vi /etc/apt/preferences 
-</WRAP>+root@debian11:/home/trainee# cat /etc/apt/preferences 
 +Package: * 
 +Pin: release a=bullseye 
 +Pin-Priority: 500
  
-Cependant, il necéssaire de renseigner le fichier **/etc/mdadm/mdadm.conf** afin que le RAID soit contruit à chaque démarrage :+Package: linux-image-amd64 
 +Pin: release a=unstable 
 +Pin-Priority: 1000 
 + 
 +Package: * 
 +Pin: release a=unstable 
 +Pin-Priority: 100 
 +</code> 
 + 
 +Mettez à jour apt :
  
 <code> <code>
-root@debian8:~echo 'DEVICES /dev/sda6 /dev/sda9 /dev/sda11' > /etc/mdadm/mdadm.conf +root@debian11:/home/traineeapt update 
-root@debian8:~# mdadm --detail --scan >> /etc/mdadm/mdadm.conf  +Hit:1 http://security.debian.org/debian-security bullseye-security InRelease 
-root@debian8:~# cat /etc/mdadm/mdadm.conf +Hit:2 http://deb.debian.org/debian bullseye InRelease 
-DEVICES /dev/sda6 /dev/sda9 /dev/sda11 +Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB] 
-ARRAY /dev/md1 metadata=1.2 name=debian8:1 UUID=41b8799a:e24feb35:39e9aa3a:ec920626+Get:4 http://deb.debian.org/debian unstable InRelease [165 kB] 
 +Get:5 http://deb.debian.org/debian unstable/contrib Sources [57.6 kB] 
 +Get:6 http://deb.debian.org/debian unstable/main Sources [9,700 kB] 
 +Get:7 http://deb.debian.org/debian unstable/non-free Sources [89.6 kB] 
 +Get:8 http://deb.debian.org/debian unstable/main amd64 Packages [9,154 kB] 
 +Get:9 http://deb.debian.org/debian unstable/main Translation-en [6,780 kB] 
 +Get:10 http://deb.debian.org/debian unstable/contrib amd64 Packages [65.4 kB] 
 +Get:11 http://deb.debian.org/debian unstable/contrib Translation-en [55.9 kB] 
 +Get:12 http://deb.debian.org/debian unstable/non-free amd64 Packages [112 kB] 
 +Get:13 http://deb.debian.org/debian unstable/non-free Translation-en [103 kB] 
 +Fetched 26.3 MB in 5s (4,955 kB/s)                          
 +Reading package lists... Done 
 +Building dependency tree... Done 
 +Reading state information... Done 
 +2 packages can be upgraded. Run 'apt list --upgradable' to see them.
 </code> </code>
  
-Chaque unité peut être examinée individuellement :+Installez ensuite les mises-à-jour du noyau :
  
 <code> <code>
-root@debian8:~mdadm --examine /dev/sda6 +root@debian11:/home/traineeapt -y  upgrade 
-/dev/sda6: +</code>
-          Magic : a92b4efc +
-        Version : 1.2 +
-    Feature Map : 0x0 +
-     Array UUID : 41b8799a:e24feb35:39e9aa3a:ec920626 +
-           Name : debian8: (local to host debian8) +
-  Creation Time : Wed Aug  3 13:20:07 2016 +
-     Raid Level : raid5 +
-   Raid Devices : 3+
  
- Avail Dev Size 974848 (476.08 MiB 499.12 MB) +Re-démarrez votre VM :
-     Array Size : 974848 (952.16 MiB 998.24 MB) +
-    Data Offset : 2048 sectors +
-   Super Offset : 8 sectors +
-   Unused Space : before=1960 sectors, after=0 sectors +
-          State : clean +
-    Device UUID : be46c991:3ad0ce5e:0bf2ec4e:1de865aa+
  
-    Update Time : Wed Aug  3 13:20:16 2016 +<code> 
-  Bad Block Log 512 entries available at offset 72 sectors +root@debian11:/home/trainee# reboot 
-       Checksum : 16f72803 - correct +</code>
-         Events : 18+
  
-         Layout : left-symmetric +Connectez-vous de nouveau à la VM et contrôlez la version du noyau :
-     Chunk Size 512K+
  
-   Device Role : Active device 0 +<code> 
-   Array State AAA ('A' == active, '.' == missing, 'R' == replacing)+trainee@debian11:~$ uname -a 
 +Linux debian11 5.17.0-1-amd64 #1 SMP PREEMPT Debian 5.17.3-1 (2022-04-18x86_64 GNU/Linux
 </code> </code>
  
-A ce stade il est intéressant de noter comment réagir lors d'une défaillance d'un disqueDans notre cas nous allons indiquer au système que la partition /dev/sda6 est devenue défaillante :+Déconnectez-vous et re-connectez-vous directement en tant que root. 
 + 
 +=====LAB #3 - 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. 
 + 
 +Commencez par vérifiez que le paquet **quota** est bien installé :
  
 <code> <code>
-root@debian8:~# mdadm --manage --set-faulty /dev/md1 /dev/sda6 +root@debian11:~# dpkg --get-selections | grep quota 
-mdadmset /dev/sda6 faulty in /dev/md1+root@debian11:~# apt -y install quota
 </code> </code>
  
-L'utilisation de la ligne de commande suivante nous confirme le statut de /dev/sda6 :+Editez le fichier **/etc/fstab** en ajoutant les options **usrquota** et **grpquota** à la ligne **/home** :
  
 <code> <code>
-root@debian8:~# mdadm --detail /dev/md1 +root@debian11:~# vi /etc/fstab 
-/dev/md1: +root@debian11:~# cat /etc/fstab 
-        Version 1.2 +# /etc/fstabstatic file system information
-  Creation Time : Wed Aug  3 13:20:07 2016 +# 
-     Raid Level : raid5 +# Use 'blkid' to print the universally unique identifier for a 
-     Array Size : 974848 (952.16 MiB 998.24 MB+# device; this may be used with UUID= as a more robust way to name devices 
-  Used Dev Size : 487424 (476.08 MiB 499.12 MB) +# that works even if disks are added and removed. See fstab(5). 
-   Raid Devices : 3 +
-  Total Devices : 3 +# systemd generates mount units based on this file, see systemd.mount(5). 
-    Persistence : Superblock is persistent+# Please run 'systemctl daemon-reload' after making changes here
 +# 
 +# <file system> <mount point>   <type>  <options>       <dump>  <pass> 
 +# / was on /dev/sda1 during installation 
 +UUID=9887a74f-a680-4bde-8f04-db5ae9ea186e /               ext4    errors=remount-ro 0       1 
 +UUID=24f1821e-1d5b-4256-8ee3-c9ee6b382ddc /home           ext4    defaults,usrquota,grpquota    0 0 
 +# swap was on /dev/sda5 during installation 
 +UUID=1f9439f5-4b19-49b1-b292-60c2c674cee9 none            swap    sw              0       0 
 +/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto           0 
 +</code>
  
-    Update Time Wed Aug  3 13:27:53 2016 +Démontez puis remontez /home :
-          State : clean, degraded  +
- Active Devices : 2 +
-Working Devices : 2 +
- Failed Devices : 1 +
-  Spare Devices : 0+
  
-         Layout left-symmetric +<code> 
-     Chunk Size 512K+root@debian11:~# umount /home 
 +root@debian11:~# mount -a 
 +</code>
  
-           Name debian8: (local to host debian8) +Vérifiez ensuite que les options soient prises en compte :
-           UUID : 41b8799a:e24feb35:39e9aa3a:ec920626 +
-         Events : 20+
  
-    Number   Major   Minor   RaidDevice State +<code> 
-                                removed +root@debian11:~# cat /etc/mtab 
-             8        9             active sync   /dev/sda9 +sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 
-       3             11        2      active sync   /dev/sda11+proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 
 +udev /dev devtmpfs rw,nosuid,relatime,size=1976600k,nr_inodes=494150,mode=755,inode64 0 0 
 +devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 
 +tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=402384k,mode=755,inode64 0 0 
 +/dev/sda1 / ext4 rw,relatime,errors=remount-ro 0 0 
 +securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0 
 +tmpfs /dev/shm tmpfs rw,nosuid,nodev,inode64 0 0 
 +tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k,inode64 0 0 
 +cgroup2 /sys/fs/cgroup cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot 0 0 
 +pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0 
 +bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0 
 +systemd-/proc/sys/fs/binfmt_misc autofs rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13172 0 0 
 +mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0 
 +hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0 
 +tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0 
 +debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0 
 +configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0 
 +fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0 
 +tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=402380k,nr_inodes=100595,mode=700,inode64 0 0 
 +/dev/sdb1 /home ext4 rw,relatime,quota,usrquota,grpquota 0 0 
 +</code>
  
-                    6             faulty   /dev/sda6+====3.1 La Commande quotacheck==== 
 + 
 +Pour activer les quotas sur /home, il convient d'utiliser la commande **quotacheck** : 
 + 
 +<code> 
 +root@debian11:~# quotacheck -cugvm -f /dev/sdb1 
 +quotacheck: Your kernel probably supports ext4 quota feature but you are using external quota files. Please switch your filesystem to use ext4 quota feature as external quota files on ext4 are deprecated. 
 +quotacheck: Scanning /dev/sdb1 [/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 7199 directories and 81583 files 
 +quotacheck: Old file not found. 
 +quotacheck: Old file not found.
 </code> </code>
  
-Il est maintenant nécessaire de supprimer /dev/sda6 de notre RAID 5 :+Les options de la commande quotacheck sont :
  
 <code> <code>
-root@debian8:~# mdadm --manage --remove /dev/md1 /dev/sda6 +root@debian11:~# quotacheck --help 
-mdadm: hot removed /dev/sda6 from /dev/md1+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> </code>
  
-A l'examen de notre RAID, on constate que /dev/sda6 a été supprimé :+Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home :
  
 <code> <code>
-root@debian8:~# mdadm --detail /dev/md1 +root@debian11:~# ls -la /home 
-/dev/md1: +total 44 
-        Version : 1.2 +drwxr-xr-x  4 root    root     4096 May  1 18:05 . 
-  Creation Time : Wed Aug  3 13:20:07 2016 +drwxr-xr-x 20 root    root     4096 May  1 17:41 .. 
-     Raid Level raid5 +-rw-------  1 root    root     7168 May  1 18:05 aquota.group 
-     Array Size 974848 (952.16 MiB 998.24 MB) +-rw-------  1 root    root     7168 May  1 18:05 aquota.user 
-  Used Dev Size 487424 (476.08 MiB 499.12 MB) +drwx------  2 root    root    16384 May  1 15:31 lost+found 
-   Raid Devices 3 +drwxr-xr-x 15 trainee trainee  4096 May  1 16:28 trainee 
-  Total Devices 2 +</code>
-    Persistence : Superblock is persistent+
  
-    Update Time Wed Aug  3 13:29:30 2016 +Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** :
-          State : clean, degraded  +
- Active Devices : 2 +
-Working Devices : 2 +
- Failed Devices : 0 +
-  Spare Devices : 0+
  
-         Layout left-symmetric +<code> 
-     Chunk Size 512K+root@debian11:~# groupadd fenestros && useradd -m fenestros -c FenestrOs -d /home/fenestros -g fenestros -s /bin/bash 
 +root@debian11:~# passwd fenestros 
 +New password: fenestros 
 +Retype new password: fenestros 
 +passwd: password updated successfully 
 +</code>
  
-           Name : debian8: (local to host debian8) +====3.2 - La Commande edquota====
-           UUID : 41b8799a:e24feb35:39e9aa3a:ec920626 +
-         Events : 21+
  
-    Number   Major   Minor   RaidDevice State +Mettez en place maintenant un quota de 10Mo pour l'utilisateur **fenestros** : 
-       0              0        0      removed + 
-       1              9        1      active sync   /dev/sda9 +<code> 
-                   11        2      active sync   /dev/sda11+root@debian8:~# EDITOR=/usr/bin/vi 
 +root@debian8:~# export EDITOR 
 +root@debian8:~# edquota -u fenestros -f /home
 </code> </code>
  
-Constatez maintenant l'existance de votre RAID :+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/sdb1                                  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/sdb1                               8000      10000          0        0        0 
 +</file> 
 + 
 +Les options de la commande **edquota** sont :
  
 <code> <code>
-root@debian8:~# cat /proc/mdstat +root@debian11:~# edquota --help 
-Personalities : [raid6] [raid5] [raid4]  +edquotaUsage: 
-md1 : active raid5 sda11[3sda9[1+        edquota [-rm] [-u] [-F formatname[-p username] [-f filesystem] username ... 
-      974848 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [_UU+        edquota [-rm-g [-F formatname[-p groupname] [-f filesystem] groupname ... 
-       +        edquota [-rm] -P [-F formatname] [-p projectname] [-f filesystem] projectname ... 
-unused devices<none>+        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 tojack@suse.cz
 </code> </code>
  
 <WRAP center round important> <WRAP center round important>
-Notez que le RAID a été démarré avec 2 unités au lieu de trois.+**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/sda6 il convient d'utiliser l'option **--add** :+====3.3 La Commande quotaon==== 
 + 
 +Appliquez maintenant les quotas :
  
 <code> <code>
-root@debian8:~# mdadm --manage --add /dev/md1 /dev/sda12 +root@debian11:~# quotaon -a
-mdadm: added /dev/sda12+
 </code> </code>
  
-L'exemen du RAID indique que /dev/sda12 a été ajouté en tant que //spare// et à l'issu de quelques secondes le RAID 5 a été reconstruite :+Les options de la commande **quotaon** sont :
  
 <code> <code>
-root@debian8:~# mdadm --manage --add /dev/md1 /dev/sda12 +root@debian11:~# quotaon --help 
-mdadmadded /dev/sda12 +quotaon: Usage
-root@debian8:~# mdadm --detail /dev/md1 +        quotaon [-guPvp] [-F quotaformat] [-x state] -a 
-/dev/md1: +        quotaon [-guPvp] [-F quotaformat] [-x state] filesys ...
-        Version : 1.+
-  Creation Time : Wed Aug  3 13:20:07 2016 +
-     Raid Level : raid5 +
-     Array Size : 974848 (952.16 MiB 998.24 MB) +
-  Used Dev Size : 487424 (476.08 MiB 499.12 MB) +
-   Raid Devices : 3 +
-  Total Devices : 3 +
-    Persistence : Superblock is persistent+
  
-    Update Time : Wed Aug  3 13:35:24 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 : debian8: (local to host debian8) +Quand l'utilisateur fenestros aura dépassé le quota **souple**, il recevra un message d'avertissement. Quand 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 : 41b8799a:e24feb35:39e9aa3a:ec920626 +
-         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       12        0      active sync   /dev/sda12 + 
-       1              9        1      active sync   /dev/sda9 +<WRAP center round important> 
-                   11        2      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@debian11:~# repquota /home 
 +*** Report for user quotas on device /dev/sdb1 
 +Block grace time: 7days; Inode grace time: 7days 
 +                        Block limits                File limits 
 +User            used    soft    hard  grace    used  soft  hard  grace 
 +---------------------------------------------------------------------- 
 +root      --  241004             0           2528                
 +trainee   -- 1409108                      86253                 
 +   
 </code> </code>
  
-Naturellement, il nécessaire de renseigner le fichier **/etc/mdadm/mdadm.conf** du changement afin que le RAID soit construit à chaque démarrage :+<WRAP center round important> 
 +**Important** - Notez que l'utilisateur fenestros ne figure pas dans la liste. Le quota n'est pas visible tant que l'utilisateur ne s'est pas connecté pour la première fois. Notez aussi les période de grâce de **7** jours. 
 +</WRAP> 
 + 
 +Les options de la commande **repquota** sont :
  
 <code> <code>
-root@debian8:~# echo 'DEVICES /dev/sda12 /dev/sda9 /dev/sda11' > /etc/mdadm/mdadm.conf +root@debian11:~# repquota --help 
-root@debian8:~# mdadm --detail --scan >> /etc/mdadm/mdadm.conf +repquota: Utility for reporting quotas
-root@debian8:~# cat /etc/mdadm/mdadm.conf +Usage: 
-DEVICES /dev/sda12 /dev/sda9 /dev/sda11 +repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] [-O (default | xml | csv)] (-a | mntpoint) 
-ARRAY /dev/md1 metadata=1.name=debian8:1 UUID=41b8799a:e24feb35:39e9aa3a:ec9206260+ 
 +-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[=units]  display numbers in human friendly units (MB, GB, 
 +                              ...). Units can be also specified explicitely by 
 +                              an optional argument in format [kgt],[kgt] where 
 +                              the first character specifies space units and the 
 +                              second character specifies inode units 
 +-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> </code>
  
 +====3.5 - La Commande quota====
 +
 +Pour visualiser les quotas d'un utilisateur spécifique, il convient d'utiliser la commande **quota** :
 +
 +<code>
 +root@debian11:~# quota fenestros
 +Disk quotas for user fenestros (uid 1001): no limited resources used
 +
 +root@debian11:~# su - fenestros
 +
 +fenestros@debian11:~$ touch test
 +
 +fenestros@debian11:~$ exit
 +logout
 +
 +root@debian11:~# quota fenestros
 +Disk quotas for user fenestros (uid 1001): 
 +     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
 +      /dev/sdb1          8000   10000                                      
 +</code>
 +
 +Les options de la commande **quota** sont :
 +
 +<code>
 +root@debian11:~# 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 [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -P projectname ...
 +        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[=units]  display numbers in human friendly units (MB, GB,
 +                              ...). Units can be also specified explicitely by
 +                              an optional argument in format [kgt],[kgt] where
 +                              the first character specifies space units and the
 +                              second character specifies inode units
 +    --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
 +    --filesystem=path         display quota information only for given
 +                              filesystem, remaining command line arguments
 +                              are still treated as user/group/project names
 +-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.
 +
 +Les options de la commande **warnquota** sont :
 +
 +<code>
 +root@debian11:~# warnquota --help
 +warnquota: Usage:
 +  warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...]
 +
 +-u, --user                      warn users
 +-g, --group                     warn groups
 +-s, --human-readable[=units]    display numbers in human friendly units (MB,
 +                                GB, ...). Units can be also specified
 +                                explicitely by an optional argument in format
 +                                [kgt],[kgt] where the first character specifies
 +                                space units and the second character specifies
 +                                inode 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
 +-I, --ignore-config-errors      ignore unknown statements in config file
 +-h, --help                      display this help message and exit
 +-V, --version                   display version information and exit
 +
 +warnquota: Bugs to jack@suse.cz
 +</code>
  
 ----- -----
-<html> +Copyright © 2022 Hugh Norris.
-<div align="center"> +
-Copyright © 2020 Hugh Norris.<br><br> +
-</div> +
-</html> +
------+
Menu